Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 84 for ReadFile (0.18 sec)

  1. istioctl/pkg/writer/envoy/configdump/configdump_test.go

    			inputFile:   "",
    			wantConfigs: 0,
    			wantErr:     true,
    		},
    	}
    	for _, tt := range tests {
    		t.Run(tt.name, func(t *testing.T) {
    			cw := &ConfigWriter{}
    			cd, _ := os.ReadFile(tt.inputFile)
    			err := cw.Prime(cd)
    			if cw.configDump == nil {
    				if tt.wantConfigs != 0 {
    					t.Errorf("wanted some configs loaded but config dump was nil")
    				}
    Go
    - Registered: Wed Apr 17 22:53:10 GMT 2024
    - Last Modified: Wed Jan 03 23:08:06 GMT 2024
    - 3.5K bytes
    - Viewed (0)
  2. istioctl/pkg/writer/compare/comparator_test.go

    func TestComparatorMismatchedConfigs(t *testing.T) {
    	cfg, err := os.ReadFile("testdata/configdump.json")
    	if err != nil {
    		t.Fatalf("Failed to read test data: %v", err)
    	}
    	diffCfg, err := os.ReadFile("testdata/configdump_diff.json")
    	if err != nil {
    		t.Fatalf("Failed to read test data: %v", err)
    	}
    
    	var outputBuffer bytes.Buffer
    Go
    - Registered: Wed Apr 17 22:53:10 GMT 2024
    - Last Modified: Tue Mar 12 10:02:09 GMT 2024
    - 2.3K bytes
    - Viewed (0)
  3. internal/config/certs.go

    // decrypted using the ENV_VAR: MINIO_CERT_PASSWD.
    func LoadX509KeyPair(certFile, keyFile string) (tls.Certificate, error) {
    	certPEMBlock, err := os.ReadFile(certFile)
    	if err != nil {
    		return tls.Certificate{}, ErrTLSReadError(nil).Msg("Unable to read the public key: %s", err)
    	}
    	keyPEMBlock, err := os.ReadFile(keyFile)
    	if err != nil {
    		return tls.Certificate{}, ErrTLSReadError(nil).Msg("Unable to read the private key: %s", err)
    	}
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Mon Sep 04 19:57:37 GMT 2023
    - 3.8K bytes
    - Viewed (0)
  4. internal/ioutil/read_file.go

    	_, err = io.ReadFull(f, dst)
    	return dst, st, err
    }
    
    // ReadFile reads the named file and returns the contents.
    // A successful call returns err == nil, not err == EOF.
    // Because ReadFile reads the whole file, it does not treat an EOF from Read
    // as an error to be reported.
    //
    // passes NOATIME flag for reads on Unix systems to avoid atime updates.
    func ReadFile(name string) ([]byte, error) {
    	// Don't wrap with un-needed buffer.
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Sat Dec 09 18:17:51 GMT 2023
    - 2.3K bytes
    - Viewed (0)
  5. cni/pkg/install/cniconfig_test.go

    		},
    	}
    
    	for _, c := range cases {
    		t.Run(c.name, func(t *testing.T) {
    			istioConf := testutils.ReadFile(t, filepath.Join("testdata", c.newConfFilename))
    			existingConfFilepath := filepath.Join("testdata", c.existingConfFilename)
    			existingConf := testutils.ReadFile(t, existingConfFilepath)
    
    			output, err := insertCNIConfig(istioConf, existingConf)
    			if err != nil {
    				if !c.expectedFailure {
    Go
    - Registered: Wed Apr 17 22:53:10 GMT 2024
    - Last Modified: Wed May 17 02:22:22 GMT 2023
    - 15.4K bytes
    - Viewed (0)
  6. cni/pkg/install/kubeconfig.go

    	} else {
    		caFile := model.GetOrDefault(cfg.KubeCAFile, constants.ServiceAccountPath+"/ca.crt")
    		caContents, err := os.ReadFile(caFile)
    		if err != nil {
    			return kubeconfig{}, err
    		}
    		cluster.CertificateAuthorityData = caContents
    	}
    
    	token, err := os.ReadFile(constants.ServiceAccountPath + "/token")
    	if err != nil {
    		return kubeconfig{}, err
    	}
    
    	const contextName = "istio-cni-context"
    Go
    - Registered: Wed Apr 17 22:53:10 GMT 2024
    - Last Modified: Fri Aug 11 01:19:03 GMT 2023
    - 4.9K bytes
    - Viewed (0)
  7. istioctl/pkg/writer/envoy/configdump/ecds_test.go

    	cw := &ConfigWriter{Stdout: gotOut}
    	cd, _ := os.ReadFile("testdata/ecds/configdump.json")
    	cw.Prime(cd)
    	err := cw.PrintEcdsSummary()
    	assert.NoError(t, err)
    
    	util.CompareContent(t, gotOut.Bytes(), "testdata/ecds/output.txt")
    }
    
    func TestPrintEcdsYaml(t *testing.T) {
    	gotOut := &bytes.Buffer{}
    	cw := &ConfigWriter{Stdout: gotOut}
    	cd, _ := os.ReadFile("testdata/ecds/configdump.json")
    	cw.Prime(cd)
    Go
    - Registered: Wed Apr 17 22:53:10 GMT 2024
    - Last Modified: Tue Dec 13 01:08:07 GMT 2022
    - 1.9K bytes
    - Viewed (0)
  8. cmd/bitrot-whole.go

    	tillOffset int64           // Affects the length of data requested in disk.ReadFile depending on Read()'s offset
    	buf        []byte          // Holds bit-rot verified data
    }
    
    func (b *wholeBitrotReader) ReadAt(buf []byte, offset int64) (n int, err error) {
    	if b.buf == nil {
    		b.buf = make([]byte, b.tillOffset-offset)
    		if _, err := b.disk.ReadFile(context.TODO(), b.volume, b.filePath, offset, b.buf, b.verifier); err != nil {
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Wed Jan 31 02:11:45 GMT 2024
    - 2.7K bytes
    - Viewed (0)
  9. istioctl/pkg/writer/ztunnel/configdump/configdump_test.go

    			inputFile:   "testdata/dump.json",
    			wantConfigs: 27,
    			wantErr:     false,
    		},
    	}
    	for _, tt := range tests {
    		t.Run(tt.name, func(t *testing.T) {
    			cw := &ConfigWriter{}
    			cd, _ := os.ReadFile(tt.inputFile)
    			err := cw.Prime(cd)
    			if cw.ztunnelDump == nil {
    				if tt.wantConfigs != 0 {
    					t.Errorf("wanted some configs loaded but config dump was nil")
    				}
    Go
    - Registered: Wed Apr 17 22:53:10 GMT 2024
    - Last Modified: Fri Feb 02 18:21:48 GMT 2024
    - 3.6K bytes
    - Viewed (0)
  10. operator/cmd/mesh/manifest_shared_test.go

    		for _, o := range objects.Items {
    			no := o.DeepCopy()
    			out = append(out, object.NewK8sObject(no, nil, nil))
    		}
    	}
    	return out
    }
    
    // readFile reads a file and returns the contents.
    func readFile(path string) (string, error) {
    	b, err := os.ReadFile(path)
    	return string(b), err
    }
    
    // writeFile writes a file and returns an error if operation is unsuccessful.
    func writeFile(path string, data []byte) error {
    Go
    - Registered: Wed Mar 20 22:53:08 GMT 2024
    - Last Modified: Tue Feb 20 22:39:28 GMT 2024
    - 11.7K bytes
    - Viewed (0)
Back to top