From 86aaa3977c15d81bccc615ed54dec6e4399a141d Mon Sep 17 00:00:00 2001 From: axenteoctavian Date: Tue, 12 Nov 2024 18:09:11 +0200 Subject: [PATCH 1/5] implemented override with array of string and int --- common/reflectcommon/structFieldsUpdate.go | 12 ++- .../reflectcommon/structFieldsUpdate_test.go | 81 ++++++++++++++++++- testscommon/toml/config.go | 7 ++ testscommon/toml/config.toml | 4 + testscommon/toml/overwrite.toml | 79 +++++++++--------- 5 files changed, 138 insertions(+), 45 deletions(-) diff --git a/common/reflectcommon/structFieldsUpdate.go b/common/reflectcommon/structFieldsUpdate.go index be8671eff4f..4e70a0d3728 100644 --- a/common/reflectcommon/structFieldsUpdate.go +++ b/common/reflectcommon/structFieldsUpdate.go @@ -122,7 +122,7 @@ func trySetTheNewValue(value *reflect.Value, newValue interface{}) error { case reflect.Struct: structVal := reflect.ValueOf(newValue) - return trySetStructValue(value, structVal) + return trySetItemValue(value, structVal) case reflect.Map: mapValue := reflect.ValueOf(newValue) @@ -141,7 +141,7 @@ func trySetSliceValue(value *reflect.Value, newValue interface{}) error { item := sliceVal.Index(i) newItem := reflect.New(value.Type().Elem()).Elem() - err := trySetStructValue(&newItem, item) + err := trySetItemValue(&newItem, item) if err != nil { return err } @@ -154,7 +154,7 @@ func trySetSliceValue(value *reflect.Value, newValue interface{}) error { return nil } -func trySetStructValue(value *reflect.Value, newValue reflect.Value) error { +func trySetItemValue(value *reflect.Value, newValue reflect.Value) error { switch newValue.Kind() { case reflect.Invalid: return fmt.Errorf("invalid new value kind") @@ -162,6 +162,12 @@ func trySetStructValue(value *reflect.Value, newValue reflect.Value) error { return updateStructFromMap(value, newValue) case reflect.Struct: // overwrite with go struct return updateStructFromStruct(value, newValue) + case reflect.Interface: + return trySetTheNewValue(value, newValue.Interface()) + case reflect.String: + return trySetTheNewValue(value, newValue.Interface()) + case reflect.Int: + return trySetTheNewValue(value, newValue.Interface()) default: return fmt.Errorf("unsupported type <%s> when trying to set the value of type <%s>", newValue.Kind(), value.Kind()) } diff --git a/common/reflectcommon/structFieldsUpdate_test.go b/common/reflectcommon/structFieldsUpdate_test.go index 44d3ae7d694..bcf168a25b3 100644 --- a/common/reflectcommon/structFieldsUpdate_test.go +++ b/common/reflectcommon/structFieldsUpdate_test.go @@ -76,12 +76,12 @@ func TestAdaptStructureValueBasedOnPath(t *testing.T) { t.Parallel() path := "TrieSyncStorage.DB" - expectedNewValue := "provided value" + expectedNewValue := false cfg := &config.Config{} err := AdaptStructureValueBasedOnPath(cfg, path, expectedNewValue) - require.Equal(t, "unsupported type when trying to set the value of type ", err.Error()) + require.Equal(t, "unsupported type when trying to set the value of type ", err.Error()) }) t.Run("should error when setting invalid type on struct", func(t *testing.T) { @@ -1064,10 +1064,10 @@ func TestAdaptStructureValueBasedOnPath(t *testing.T) { path := "TestConfigNestedStruct.ConfigNestedStruct.Message.MessageDescription" - expectedNewValue := []int{10, 20} + expectedNewValue := []float32{10.1, 20.2} err = AdaptStructureValueBasedOnPath(testConfig, path, expectedNewValue) - require.Equal(t, "unsupported type when trying to set the value of type ", err.Error()) + require.Equal(t, "unsupported type when trying to set the value of type ", err.Error()) }) t.Run("should error on slice when override different struct", func(t *testing.T) { @@ -1204,6 +1204,79 @@ func TestAdaptStructureValueBasedOnPath(t *testing.T) { require.Equal(t, "unsupported type when trying to add value in type ", err.Error()) }) + t.Run("should work and override string array from config", func(t *testing.T) { + t.Parallel() + + testConfig, err := loadTestConfig("../../testscommon/toml/config.toml") + require.NoError(t, err) + + expectedArray := []string{"x", "y", "z"} + + err = AdaptStructureValueBasedOnPath(testConfig, "TestArray.Strings", expectedArray) + require.NoError(t, err) + require.Equal(t, expectedArray, testConfig.TestArray.Strings) + }) + + t.Run("should work and override int array from config", func(t *testing.T) { + t.Parallel() + + testConfig, err := loadTestConfig("../../testscommon/toml/config.toml") + require.NoError(t, err) + + expectedArray := []int{10, 20, 30} + + err = AdaptStructureValueBasedOnPath(testConfig, "TestArray.Ints", expectedArray) + require.NoError(t, err) + require.Equal(t, expectedArray, testConfig.TestArray.Ints) + }) + + t.Run("should work and override string array", func(t *testing.T) { + t.Parallel() + + testConfig, err := loadTestConfig("../../testscommon/toml/config.toml") + require.NoError(t, err) + + overrideConfig, err := loadOverrideConfig("../../testscommon/toml/overwrite.toml") + require.NoError(t, err) + + err = AdaptStructureValueBasedOnPath(testConfig, overrideConfig.OverridableConfigTomlValues[38].Path, overrideConfig.OverridableConfigTomlValues[38].Value) + require.NoError(t, err) + expectedArray := []string{"x", "y", "z"} + require.Equal(t, expectedArray, testConfig.TestArray.Strings) + }) + + t.Run("should work and override int array", func(t *testing.T) { + t.Parallel() + + testConfig, err := loadTestConfig("../../testscommon/toml/config.toml") + require.NoError(t, err) + + overrideConfig, err := loadOverrideConfig("../../testscommon/toml/overwrite.toml") + require.NoError(t, err) + + err = AdaptStructureValueBasedOnPath(testConfig, overrideConfig.OverridableConfigTomlValues[39].Path, overrideConfig.OverridableConfigTomlValues[39].Value) + require.NoError(t, err) + expectedArray := []int{10, 20, 30} + require.Equal(t, expectedArray, testConfig.TestArray.Ints) + }) + + t.Run("should work and override struct of array", func(t *testing.T) { + t.Parallel() + + testConfig, err := loadTestConfig("../../testscommon/toml/config.toml") + require.NoError(t, err) + + overrideConfig, err := loadOverrideConfig("../../testscommon/toml/overwrite.toml") + require.NoError(t, err) + expectedStringsArray := []string{"x", "y", "z"} + expectedIntsArray := []int{10, 20, 30} + + err = AdaptStructureValueBasedOnPath(testConfig, overrideConfig.OverridableConfigTomlValues[40].Path, overrideConfig.OverridableConfigTomlValues[40].Value) + require.NoError(t, err) + require.Equal(t, expectedStringsArray, testConfig.TestArray.Strings) + require.Equal(t, expectedIntsArray, testConfig.TestArray.Ints) + }) + } func loadTestConfig(filepath string) (*toml.Config, error) { diff --git a/testscommon/toml/config.go b/testscommon/toml/config.go index 56cfeb1f0ad..7f64ee446d4 100644 --- a/testscommon/toml/config.go +++ b/testscommon/toml/config.go @@ -16,6 +16,7 @@ type Config struct { TestConfigNestedStruct TestMap TestInterface + TestArray } // TestConfigI8 will hold an int8 value for testing @@ -180,3 +181,9 @@ type MapValues struct { type TestInterface struct { Value interface{} } + +// TestArray will hold an array of strings and integers +type TestArray struct { + Strings []string + Ints []int +} diff --git a/testscommon/toml/config.toml b/testscommon/toml/config.toml index 91512d5e664..890e3922789 100644 --- a/testscommon/toml/config.toml +++ b/testscommon/toml/config.toml @@ -51,3 +51,7 @@ [Map] [Map.Key1] Number = 999 + +[TestArray] + Strings = ["a", "b", "c"] + Ints = [0, 1, 2] diff --git a/testscommon/toml/overwrite.toml b/testscommon/toml/overwrite.toml index 63f74b7828c..5e495e5c08b 100644 --- a/testscommon/toml/overwrite.toml +++ b/testscommon/toml/overwrite.toml @@ -1,40 +1,43 @@ OverridableConfigTomlValues = [ - { File = "config.toml", Path = "TestConfigI8.Int8.Number", Value = 127 }, - { File = "config.toml", Path = "TestConfigI8.Int8.Number", Value = 128 }, - { File = "config.toml", Path = "TestConfigI8.Int8.Number", Value = -128 }, - { File = "config.toml", Path = "TestConfigI8.Int8.Number", Value = -129 }, - { File = "config.toml", Path = "TestConfigI16.Int16.Number", Value = 32767 }, - { File = "config.toml", Path = "TestConfigI16.Int16.Number", Value = 32768 }, - { File = "config.toml", Path = "TestConfigI16.Int16.Number", Value = -32768 }, - { File = "config.toml", Path = "TestConfigI16.Int16.Number", Value = -32769 }, - { File = "config.toml", Path = "TestConfigI32.Int32.Number", Value = 2147483647 }, - { File = "config.toml", Path = "TestConfigI32.Int32.Number", Value = 2147483648 }, - { File = "config.toml", Path = "TestConfigI32.Int32.Number", Value = -2147483648 }, - { File = "config.toml", Path = "TestConfigI32.Int32.Number", Value = -2147483649 }, - { File = "config.toml", Path = "TestConfigI64.Int64.Number", Value = 9223372036854775807 }, - { File = "config.toml", Path = "TestConfigI64.Int64.Number", Value = -9223372036854775808 }, - { File = "config.toml", Path = "TestConfigU8.Uint8.Number", Value = 255 }, - { File = "config.toml", Path = "TestConfigU8.Uint8.Number", Value = 256 }, - { File = "config.toml", Path = "TestConfigU8.Uint8.Number", Value = -256 }, - { File = "config.toml", Path = "TestConfigU16.Uint16.Number", Value = 65535 }, - { File = "config.toml", Path = "TestConfigU16.Uint16.Number", Value = 65536 }, - { File = "config.toml", Path = "TestConfigU16.Uint16.Number", Value = -65536 }, - { File = "config.toml", Path = "TestConfigU32.Uint32.Number", Value = 4294967295 }, - { File = "config.toml", Path = "TestConfigU32.Uint32.Number", Value = 4294967296 }, - { File = "config.toml", Path = "TestConfigU32.Uint32.Number", Value = -4294967296 }, - { File = "config.toml", Path = "TestConfigU64.Uint64.Number", Value = 9223372036854775807 }, - { File = "config.toml", Path = "TestConfigU64.Uint64.Number", Value = -9223372036854775808 }, - { File = "config.toml", Path = "TestConfigF32.Float32.Number", Value = 3.4 }, - { File = "config.toml", Path = "TestConfigF32.Float32.Number", Value = 3.4e+39 }, - { File = "config.toml", Path = "TestConfigF32.Float32.Number", Value = -3.4 }, - { File = "config.toml", Path = "TestConfigF32.Float32.Number", Value = -3.4e+40 }, - { File = "config.toml", Path = "TestConfigF64.Float64.Number", Value = 1.7e+308 }, - { File = "config.toml", Path = "TestConfigF64.Float64.Number", Value = -1.7e+308 }, - { File = "config.toml", Path = "TestConfigStruct.ConfigStruct.Description", Value = { Number = 11 } }, - { File = "config.toml", Path = "TestConfigStruct.ConfigStruct.Description", Value = { Nr = 222 } }, - { File = "config.toml", Path = "TestConfigStruct.ConfigStruct.Description", Value = { Number = "11" } }, - { File = "config.toml", Path = "TestConfigNestedStruct.ConfigNestedStruct", Value = { Text = "Overwritten text", Message = { Public = false, MessageDescription = [{ Text = "Overwritten Text1" }] } } }, - { File = "config.toml", Path = "TestConfigNestedStruct.ConfigNestedStruct.Message.MessageDescription", Value = [{ Text = "Overwritten Text1" }, { Text = "Overwritten Text2" }] }, - { File = "config.toml", Path = "TestMap.Map", Value = { "Key1" = { Number = 10 }, "Key2" = { Number = 11 } } }, - { File = "config.toml", Path = "TestMap.Map", Value = { "Key2" = { Number = 2 }, "Key3" = { Number = 3 } } }, + { File = "config.toml", Path = "TestConfigI8.Int8.Number", Value = 127 }, + { File = "config.toml", Path = "TestConfigI8.Int8.Number", Value = 128 }, + { File = "config.toml", Path = "TestConfigI8.Int8.Number", Value = -128 }, + { File = "config.toml", Path = "TestConfigI8.Int8.Number", Value = -129 }, + { File = "config.toml", Path = "TestConfigI16.Int16.Number", Value = 32767 }, + { File = "config.toml", Path = "TestConfigI16.Int16.Number", Value = 32768 }, + { File = "config.toml", Path = "TestConfigI16.Int16.Number", Value = -32768 }, + { File = "config.toml", Path = "TestConfigI16.Int16.Number", Value = -32769 }, + { File = "config.toml", Path = "TestConfigI32.Int32.Number", Value = 2147483647 }, + { File = "config.toml", Path = "TestConfigI32.Int32.Number", Value = 2147483648 }, + { File = "config.toml", Path = "TestConfigI32.Int32.Number", Value = -2147483648 }, + { File = "config.toml", Path = "TestConfigI32.Int32.Number", Value = -2147483649 }, + { File = "config.toml", Path = "TestConfigI64.Int64.Number", Value = 9223372036854775807 }, + { File = "config.toml", Path = "TestConfigI64.Int64.Number", Value = -9223372036854775808 }, + { File = "config.toml", Path = "TestConfigU8.Uint8.Number", Value = 255 }, + { File = "config.toml", Path = "TestConfigU8.Uint8.Number", Value = 256 }, + { File = "config.toml", Path = "TestConfigU8.Uint8.Number", Value = -256 }, + { File = "config.toml", Path = "TestConfigU16.Uint16.Number", Value = 65535 }, + { File = "config.toml", Path = "TestConfigU16.Uint16.Number", Value = 65536 }, + { File = "config.toml", Path = "TestConfigU16.Uint16.Number", Value = -65536 }, + { File = "config.toml", Path = "TestConfigU32.Uint32.Number", Value = 4294967295 }, + { File = "config.toml", Path = "TestConfigU32.Uint32.Number", Value = 4294967296 }, + { File = "config.toml", Path = "TestConfigU32.Uint32.Number", Value = -4294967296 }, + { File = "config.toml", Path = "TestConfigU64.Uint64.Number", Value = 9223372036854775807 }, + { File = "config.toml", Path = "TestConfigU64.Uint64.Number", Value = -9223372036854775808 }, + { File = "config.toml", Path = "TestConfigF32.Float32.Number", Value = 3.4 }, + { File = "config.toml", Path = "TestConfigF32.Float32.Number", Value = 3.4e+39 }, + { File = "config.toml", Path = "TestConfigF32.Float32.Number", Value = -3.4 }, + { File = "config.toml", Path = "TestConfigF32.Float32.Number", Value = -3.4e+40 }, + { File = "config.toml", Path = "TestConfigF64.Float64.Number", Value = 1.7e+308 }, + { File = "config.toml", Path = "TestConfigF64.Float64.Number", Value = -1.7e+308 }, + { File = "config.toml", Path = "TestConfigStruct.ConfigStruct.Description", Value = { Number = 11 } }, + { File = "config.toml", Path = "TestConfigStruct.ConfigStruct.Description", Value = { Nr = 222 } }, + { File = "config.toml", Path = "TestConfigStruct.ConfigStruct.Description", Value = { Number = "11" } }, + { File = "config.toml", Path = "TestConfigNestedStruct.ConfigNestedStruct", Value = { Text = "Overwritten text", Message = { Public = false, MessageDescription = [{ Text = "Overwritten Text1" }] } } }, + { File = "config.toml", Path = "TestConfigNestedStruct.ConfigNestedStruct.Message.MessageDescription", Value = [{ Text = "Overwritten Text1" }, { Text = "Overwritten Text2" }] }, + { File = "config.toml", Path = "TestMap.Map", Value = { "Key1" = { Number = 10 }, "Key2" = { Number = 11 } } }, + { File = "config.toml", Path = "TestMap.Map", Value = { "Key2" = { Number = 2 }, "Key3" = { Number = 3 } } }, + { File = "config.toml", Path = "TestArray.Strings", Value = ["x", "y", "z"] }, + { File = "config.toml", Path = "TestArray.Ints", Value = [10, 20, 30] }, + { File = "config.toml", Path = "TestArray", Value = { Strings = ["x", "y", "z"], Ints = [10, 20, 30] } }, ] From 1a05453a36674c2eb21e47ecc70a626fc6054b84 Mon Sep 17 00:00:00 2001 From: axenteoctavian Date: Tue, 12 Nov 2024 18:23:38 +0200 Subject: [PATCH 2/5] better way for set slice --- common/reflectcommon/structFieldsUpdate.go | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/common/reflectcommon/structFieldsUpdate.go b/common/reflectcommon/structFieldsUpdate.go index 4e70a0d3728..7f8940b0400 100644 --- a/common/reflectcommon/structFieldsUpdate.go +++ b/common/reflectcommon/structFieldsUpdate.go @@ -122,11 +122,11 @@ func trySetTheNewValue(value *reflect.Value, newValue interface{}) error { case reflect.Struct: structVal := reflect.ValueOf(newValue) - return trySetItemValue(value, structVal) + return trySetStructValue(value, structVal) case reflect.Map: mapValue := reflect.ValueOf(newValue) - return tryUpdateMapValue(value, mapValue) + return trySetMapValue(value, mapValue) default: return fmt.Errorf("unsupported type <%s> when trying to set the value '%v' of type <%s>", valueKind, newValue, reflect.TypeOf(newValue)) } @@ -141,7 +141,7 @@ func trySetSliceValue(value *reflect.Value, newValue interface{}) error { item := sliceVal.Index(i) newItem := reflect.New(value.Type().Elem()).Elem() - err := trySetItemValue(&newItem, item) + err := trySetTheNewValue(&newItem, item.Interface()) if err != nil { return err } @@ -154,7 +154,7 @@ func trySetSliceValue(value *reflect.Value, newValue interface{}) error { return nil } -func trySetItemValue(value *reflect.Value, newValue reflect.Value) error { +func trySetStructValue(value *reflect.Value, newValue reflect.Value) error { switch newValue.Kind() { case reflect.Invalid: return fmt.Errorf("invalid new value kind") @@ -162,18 +162,12 @@ func trySetItemValue(value *reflect.Value, newValue reflect.Value) error { return updateStructFromMap(value, newValue) case reflect.Struct: // overwrite with go struct return updateStructFromStruct(value, newValue) - case reflect.Interface: - return trySetTheNewValue(value, newValue.Interface()) - case reflect.String: - return trySetTheNewValue(value, newValue.Interface()) - case reflect.Int: - return trySetTheNewValue(value, newValue.Interface()) default: return fmt.Errorf("unsupported type <%s> when trying to set the value of type <%s>", newValue.Kind(), value.Kind()) } } -func tryUpdateMapValue(value *reflect.Value, newValue reflect.Value) error { +func trySetMapValue(value *reflect.Value, newValue reflect.Value) error { if value.IsNil() { value.Set(reflect.MakeMap(value.Type())) } From 458e04fae54140f6b46d27fa6a34e27ea540f89f Mon Sep 17 00:00:00 2001 From: axenteoctavian Date: Tue, 12 Nov 2024 18:25:38 +0200 Subject: [PATCH 3/5] rollback some changes --- common/reflectcommon/structFieldsUpdate_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/reflectcommon/structFieldsUpdate_test.go b/common/reflectcommon/structFieldsUpdate_test.go index bcf168a25b3..79bf0caacb3 100644 --- a/common/reflectcommon/structFieldsUpdate_test.go +++ b/common/reflectcommon/structFieldsUpdate_test.go @@ -76,12 +76,12 @@ func TestAdaptStructureValueBasedOnPath(t *testing.T) { t.Parallel() path := "TrieSyncStorage.DB" - expectedNewValue := false + expectedNewValue := "provided value" cfg := &config.Config{} err := AdaptStructureValueBasedOnPath(cfg, path, expectedNewValue) - require.Equal(t, "unsupported type when trying to set the value of type ", err.Error()) + require.Equal(t, "unsupported type when trying to set the value of type ", err.Error()) }) t.Run("should error when setting invalid type on struct", func(t *testing.T) { @@ -1064,10 +1064,10 @@ func TestAdaptStructureValueBasedOnPath(t *testing.T) { path := "TestConfigNestedStruct.ConfigNestedStruct.Message.MessageDescription" - expectedNewValue := []float32{10.1, 20.2} + expectedNewValue := []int{10, 20} err = AdaptStructureValueBasedOnPath(testConfig, path, expectedNewValue) - require.Equal(t, "unsupported type when trying to set the value of type ", err.Error()) + require.Equal(t, "unsupported type when trying to set the value of type ", err.Error()) }) t.Run("should error on slice when override different struct", func(t *testing.T) { From 8a1e9ed20c1d980f1602d8e12af7407aebf41bf6 Mon Sep 17 00:00:00 2001 From: axenteoctavian Date: Tue, 12 Nov 2024 18:36:24 +0200 Subject: [PATCH 4/5] update test name --- common/reflectcommon/structFieldsUpdate_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/reflectcommon/structFieldsUpdate_test.go b/common/reflectcommon/structFieldsUpdate_test.go index 79bf0caacb3..c2b3edced1f 100644 --- a/common/reflectcommon/structFieldsUpdate_test.go +++ b/common/reflectcommon/structFieldsUpdate_test.go @@ -1260,7 +1260,7 @@ func TestAdaptStructureValueBasedOnPath(t *testing.T) { require.Equal(t, expectedArray, testConfig.TestArray.Ints) }) - t.Run("should work and override struct of array", func(t *testing.T) { + t.Run("should work and override struct of arrays", func(t *testing.T) { t.Parallel() testConfig, err := loadTestConfig("../../testscommon/toml/config.toml") From 0fd6cedc626774315657a74fdc621148027086cb Mon Sep 17 00:00:00 2001 From: axenteoctavian Date: Wed, 13 Nov 2024 10:02:24 +0200 Subject: [PATCH 5/5] update test name --- common/reflectcommon/structFieldsUpdate_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/reflectcommon/structFieldsUpdate_test.go b/common/reflectcommon/structFieldsUpdate_test.go index c2b3edced1f..27a30ea9d00 100644 --- a/common/reflectcommon/structFieldsUpdate_test.go +++ b/common/reflectcommon/structFieldsUpdate_test.go @@ -1204,7 +1204,7 @@ func TestAdaptStructureValueBasedOnPath(t *testing.T) { require.Equal(t, "unsupported type when trying to add value in type ", err.Error()) }) - t.Run("should work and override string array from config", func(t *testing.T) { + t.Run("should work and override string array", func(t *testing.T) { t.Parallel() testConfig, err := loadTestConfig("../../testscommon/toml/config.toml") @@ -1217,7 +1217,7 @@ func TestAdaptStructureValueBasedOnPath(t *testing.T) { require.Equal(t, expectedArray, testConfig.TestArray.Strings) }) - t.Run("should work and override int array from config", func(t *testing.T) { + t.Run("should work and override int array", func(t *testing.T) { t.Parallel() testConfig, err := loadTestConfig("../../testscommon/toml/config.toml") @@ -1230,7 +1230,7 @@ func TestAdaptStructureValueBasedOnPath(t *testing.T) { require.Equal(t, expectedArray, testConfig.TestArray.Ints) }) - t.Run("should work and override string array", func(t *testing.T) { + t.Run("should work and override string array from toml", func(t *testing.T) { t.Parallel() testConfig, err := loadTestConfig("../../testscommon/toml/config.toml") @@ -1245,7 +1245,7 @@ func TestAdaptStructureValueBasedOnPath(t *testing.T) { require.Equal(t, expectedArray, testConfig.TestArray.Strings) }) - t.Run("should work and override int array", func(t *testing.T) { + t.Run("should work and override int array from toml", func(t *testing.T) { t.Parallel() testConfig, err := loadTestConfig("../../testscommon/toml/config.toml") @@ -1260,7 +1260,7 @@ func TestAdaptStructureValueBasedOnPath(t *testing.T) { require.Equal(t, expectedArray, testConfig.TestArray.Ints) }) - t.Run("should work and override struct of arrays", func(t *testing.T) { + t.Run("should work and override struct of arrays from toml", func(t *testing.T) { t.Parallel() testConfig, err := loadTestConfig("../../testscommon/toml/config.toml")