From cb0063156b5ad323f51e9d2b2158b7afbb0788cd Mon Sep 17 00:00:00 2001 From: Eugene Burkov Date: Thu, 7 Sep 2023 17:55:10 +0300 Subject: [PATCH] Pull request 2000: fix windows tests Merge in DNS/adguard-home from fix-windows-migr-test to master Squashed commit of the following: commit be0550f0d6b99f2f18a2bdc9b8e330600c224ea4 Author: Eugene Burkov Date: Thu Sep 7 17:42:12 2023 +0300 confmigrate: fix windows tests --- ...igrations_test.go => migrations_internal_test.go} | 0 internal/confmigrate/migrator_test.go | 12 ++++++------ 2 files changed, 6 insertions(+), 6 deletions(-) rename internal/confmigrate/{migrations_test.go => migrations_internal_test.go} (100%) diff --git a/internal/confmigrate/migrations_test.go b/internal/confmigrate/migrations_internal_test.go similarity index 100% rename from internal/confmigrate/migrations_test.go rename to internal/confmigrate/migrations_internal_test.go diff --git a/internal/confmigrate/migrator_test.go b/internal/confmigrate/migrator_test.go index 5cc8f3fb..27ac0592 100644 --- a/internal/confmigrate/migrator_test.go +++ b/internal/confmigrate/migrator_test.go @@ -3,7 +3,7 @@ package confmigrate_test import ( "io/fs" "os" - "path/filepath" + "path" "testing" "github.com/AdguardTeam/AdGuardHome/internal/confmigrate" @@ -12,6 +12,9 @@ import ( yaml "gopkg.in/yaml.v3" ) +// testdata is a virtual filesystem containing test data. +var testdata = os.DirFS("testdata") + // getField returns the value located at the given indexes in the given object. // It fails the test if the value is not found or of the expected type. The // indexes can be either strings or integers, and are interpreted as map keys or @@ -42,9 +45,6 @@ func getField[T any](t require.TestingT, obj any, indexes ...any) (val T) { return obj.(T) } -// testdata is a virtual filesystem containing test data. -var testdata = os.DirFS("testdata") - func TestMigrateConfig_Migrate(t *testing.T) { const ( inputFileName = "input.yml" @@ -189,10 +189,10 @@ func TestMigrateConfig_Migrate(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - body, err := fs.ReadFile(testdata, filepath.Join(t.Name(), inputFileName)) + body, err := fs.ReadFile(testdata, path.Join(t.Name(), inputFileName)) require.NoError(t, err) - wantBody, err := fs.ReadFile(testdata, filepath.Join(t.Name(), outputFileName)) + wantBody, err := fs.ReadFile(testdata, path.Join(t.Name(), outputFileName)) require.NoError(t, err) migrator := confmigrate.New(&confmigrate.Config{