all: sync with master; upd chlog

This commit is contained in:
Ainar Garipov
2023-09-11 17:51:50 +03:00
parent 7b93f5d7cf
commit 258eecc55b
48 changed files with 265 additions and 178 deletions

View File

@@ -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{