Skip to content

Commit

Permalink
Make TestResourcesRepoNotFile Less Specific
Browse files Browse the repository at this point in the history
  • Loading branch information
Cailyn Edwards committed Jan 26, 2023
1 parent fb29492 commit 90281a6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions api/krusty/localizer/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,14 @@ func TestResourcesRepoNotFile(t *testing.T) {

err := localizer.Run(fsActual, testDir.String(), "", testDir.Join("dst"))

const readmeErr = `yaml: line 28: mapping values are not allowed in this context`
fileErr := fmt.Sprintf(`invalid resource at file "%s": MalformedYAMLError: %s`, repo, readmeErr)
const readmeErr = `mapping values are not allowed in this context`
fileErr := fmt.Sprintf(`invalid resource at file "%s": MalformedYAMLError:`, repo)
rootErr := fmt.Sprintf(`unable to localize root "%s": unable to find one of 'kustomization.yaml', 'kustomization.yml' or 'Kustomization'`, repo)
var actualErr PathLocalizeError
require.ErrorAs(t, err, &actualErr)
require.Equal(t, repo, actualErr.Path)
require.EqualError(t, actualErr.FileError, fileErr)
require.ErrorContains(t, actualErr.FileError, readmeErr)
require.ErrorContains(t, actualErr.FileError, fileErr)
require.ErrorContains(t, actualErr.RootError, rootErr)

SetupDir(t, fsExpected, testDir.String(), kustomization)
Expand Down

0 comments on commit 90281a6

Please sign in to comment.