diff --git a/config/configStruct.go b/config/configStruct.go index 7f26e58b0..068b13c6e 100644 --- a/config/configStruct.go +++ b/config/configStruct.go @@ -33,7 +33,7 @@ type ConfigStruct struct { Kube KubeConfig `yaml:"kube"` SelfNamespace string `yaml:"selfnamespace" default:"kubeshark"` DumpLogs bool `yaml:"dumplogs" default:"false"` - ConfigFilePath string `yaml:"configpath" readonly:""` + ConfigFilePath string `yaml:"configpath,omitempty" readonly:""` HeadlessMode bool `yaml:"headless" default:"false"` } diff --git a/config/config_test.go b/config/config_test.go index 099dca7a4..2327900ce 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -1,33 +1,12 @@ package config_test import ( - "fmt" "reflect" "strings" - "testing" "github.com/kubeshark/kubeshark/config" - "gopkg.in/yaml.v3" ) -func TestConfigWriteIgnoresReadonlyFields(t *testing.T) { - var readonlyFields []string - - configElem := reflect.ValueOf(&config.ConfigStruct{}).Elem() - getFieldsWithReadonlyTag(configElem, &readonlyFields) - - configWithDefaults, _ := config.GetConfigWithDefaults() - configWithDefaultsBytes, _ := yaml.Marshal(configWithDefaults) - for _, readonlyField := range readonlyFields { - t.Run(readonlyField, func(t *testing.T) { - readonlyFieldToCheck := fmt.Sprintf(" %s:", readonlyField) - if strings.Contains(string(configWithDefaultsBytes), readonlyFieldToCheck) { - t.Errorf("unexpected result - readonly field: %v, config: %v", readonlyField, configWithDefaults) - } - }) - } -} - func getFieldsWithReadonlyTag(currentElem reflect.Value, readonlyFields *[]string) { for i := 0; i < currentElem.NumField(); i++ { currentField := currentElem.Type().Field(i)