Search Options

Results per page
Sort
Preferred Languages
Advance

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

  1. 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 May 01 22:53:12 GMT 2024
    - Last Modified: Tue Dec 13 01:08:07 GMT 2022
    - 1.9K bytes
    - Viewed (0)
  2. istioctl/pkg/writer/envoy/configdump/endpoint_test.go

    			filter: EndpointFilter{
    				Port: 8080,
    			},
    		},
    	}
    	for _, tt := range tests {
    		t.Run(tt.name, func(t *testing.T) {
    			gotOut := &bytes.Buffer{}
    			cw := &ConfigWriter{Stdout: gotOut}
    			cd, _ := os.ReadFile("testdata/endpoint/configdump.json")
    			cw.Prime(cd)
    			err := cw.PrintEndpointsSummary(tt.filter)
    			assert.NoError(t, err)
    
    			wantOutputFile := path.Join("testdata/endpoint", fmt.Sprintf("%s_output.txt", tt.name))
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Tue Jul 12 02:25:59 GMT 2022
    - 2.4K bytes
    - Viewed (0)
  3. operator/cmd/mesh/operator_test.go

    	}
    
    	if refreshGoldenFiles() {
    		t.Logf("Refreshing golden file for %s", goldenFilepath)
    		if err := os.WriteFile(goldenFilepath, []byte(gotYAML), 0o644); err != nil {
    			t.Error(err)
    		}
    	}
    
    	wantYAML, err := readFile(goldenFilepath)
    	if err != nil {
    		t.Fatal(err)
    	}
    
    	if diff := util.YAMLDiff(wantYAML, gotYAML); diff != "" {
    		t.Fatalf("diff: %s", diff)
    	}
    }
    
    func TestOperatorDumpJSONFormat(t *testing.T) {
    Go
    - Registered: Wed Mar 20 22:53:08 GMT 2024
    - Last Modified: Tue Aug 29 14:15:33 GMT 2023
    - 6.4K bytes
    - Viewed (0)
  4. cni/test/install_cni.go

    // checkResult checks if resultFile is equal to expectedFile at each tick until timeout
    func checkResult(result, expected string) error {
    	resultFile, err := os.ReadFile(result)
    	if err != nil {
    		return fmt.Errorf("couldn't read result: %v", err)
    	}
    	expectedFile, err := os.ReadFile(expected)
    	if err != nil {
    		return fmt.Errorf("couldn't read expected: %v", err)
    	}
    	if !bytes.Equal(resultFile, expectedFile) {
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Fri Jan 26 20:34:28 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  5. cni/pkg/install/cniconfig.go

    	return writeCNIConfig(ctx, cniConfig, getPluginConfig(cfg))
    }
    
    func readCNIConfigTemplate(template cniConfigTemplate) ([]byte, error) {
    	if file.Exists(template.cniNetworkConfigFile) {
    		cniConfig, err := os.ReadFile(template.cniNetworkConfigFile)
    		if err != nil {
    			return nil, err
    		}
    		installLog.Infof("Using CNI config template from %s", template.cniNetworkConfigFile)
    		return cniConfig, nil
    	}
    
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Fri Jan 26 20:34:28 GMT 2024
    - 10.4K bytes
    - Viewed (0)
  6. 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 May 01 22:53:12 GMT 2024
    - Last Modified: Tue Mar 12 10:02:09 GMT 2024
    - 2.3K bytes
    - Viewed (0)
  7. 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 May 01 22:53:12 GMT 2024
    - Last Modified: Wed May 17 02:22:22 GMT 2023
    - 15.4K bytes
    - Viewed (0)
  8. 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 May 01 22:53:12 GMT 2024
    - Last Modified: Fri Aug 11 01:19:03 GMT 2023
    - 4.9K bytes
    - Viewed (0)
  9. 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 May 01 22:53:12 GMT 2024
    - Last Modified: Wed Jan 03 23:08:06 GMT 2024
    - 3.5K bytes
    - Viewed (0)
  10. cni/pkg/util/pluginutil.go

    				return
    			}
    			errChan <- err
    		}
    	}
    }
    
    // Read CNI config from file and return the unmarshalled JSON as a map
    func ReadCNIConfigMap(path string) (map[string]any, error) {
    	cniConfig, err := os.ReadFile(path)
    	if err != nil {
    		return nil, err
    	}
    
    	var cniConfigMap map[string]any
    	if err = json.Unmarshal(cniConfig, &cniConfigMap); err != nil {
    		return nil, fmt.Errorf("%s: %w", path, err)
    	}
    
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Fri Jan 26 20:34:28 GMT 2024
    - 3.6K bytes
    - Viewed (0)
Back to top