Skip to content

Commit

Permalink
configmigrate: imp tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ainar-g committed Oct 2, 2024
1 parent da8777c commit 16ecebb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions internal/configmigrate/migrator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,18 @@ func TestMigrateConfig_Migrate(t *testing.T) {
// TODO(a.garipov): Consider ways of merging into the previous one.
func TestMigrateConfig_Migrate_v29(t *testing.T) {
const (
pathUnix = "/path/to/file.txt"
pathWindows = `C:\path\to\file.txt`
pathUnix = `/path/to/file.txt`
userDirPatUnix = `TestMigrateConfig_Migrate/v29/data/userfilters/*`

pathWindows = `C:\path\to\file.txt`
userDirPatWindows = `TestMigrateConfig_Migrate\v29\data\userfilters\*`
)

pathToReplace := pathUnix
patternToReplace := userDirPatUnix
if runtime.GOOS == "windows" {
pathToReplace = pathWindows
patternToReplace = userDirPatWindows
}

body, err := fs.ReadFile(testdata, "TestMigrateConfig_Migrate/v29/input.yml")
Expand All @@ -237,6 +242,7 @@ func TestMigrateConfig_Migrate_v29(t *testing.T) {
require.NoError(t, err)

wantBody = bytes.ReplaceAll(wantBody, []byte("FILEPATH"), []byte(pathToReplace))
wantBody = bytes.ReplaceAll(wantBody, []byte("USERFILTERSPATH"), []byte(patternToReplace))

migrator := configmigrate.New(&configmigrate.Config{
WorkingDir: t.Name(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ filtering:
parental_enabled: false
safebrowsing_enabled: false
safe_fs_patterns:
- TestMigrateConfig_Migrate/v29/data/userfilters/*
- USERFILTERSPATH
- FILEPATH
safe_search:
enabled: false
Expand Down

0 comments on commit 16ecebb

Please sign in to comment.