mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-08-16 14:10:22 +03:00
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 <E.Burkov@AdGuard.COM> Date: Thu Sep 7 17:42:12 2023 +0300 confmigrate: fix windows tests
This commit is contained in:
parent
3b846bae6e
commit
cb0063156b
@ -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{
|
||||
|
Loading…
Reference in New Issue
Block a user