Skip to content

Commit

Permalink
CR-25949: reposerver(repository): fixed unit tests after fix of repea…
Browse files Browse the repository at this point in the history
…ted resources generation for ApplicationSourceTypeDirectory
  • Loading branch information
oleksandr-codefresh committed Nov 13, 2024
1 parent 78094d6 commit 9f4fa6b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions reposerver/repository/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ func TestGenerateManifestsUseExactRevision(t *testing.T) {

res1, err := service.GenerateManifest(context.Background(), &q)
require.NoError(t, err)
assert.Len(t, res1.Manifests, 6)
assert.Len(t, res1.Manifests, 4)
assert.Equal(t, "abc", gitClient.Calls[0].Arguments[0])
}

Expand All @@ -677,7 +677,7 @@ func TestRecurseManifestsInDir(t *testing.T) {

res1, err := service.GenerateManifest(context.Background(), &q)
require.NoError(t, err)
assert.Len(t, res1.Manifests, 6)
assert.Len(t, res1.Manifests, 4)
}

func TestInvalidManifestsInDir(t *testing.T) {
Expand Down Expand Up @@ -2199,7 +2199,7 @@ func TestFindResources(t *testing.T) {
}, {
name: "Include Everything",
include: "*.yaml",
expectedNames: []string{"nginx-deployment", "nginx-deployment", "nginx-deployment-sub"},
expectedNames: []string{"nginx-deployment", "nginx-deployment-sub"},
}, {
name: "Include Subdirectory",
include: "**/*.yaml",
Expand Down Expand Up @@ -2254,10 +2254,10 @@ func TestFindManifests_Exclude_NothingMatches(t *testing.T) {
}, map[string]bool{}, resource.MustParse("0"))

require.NoError(t, err)
require.Len(t, objs, 3)
require.Len(t, objs, 2)

assert.ElementsMatch(t,
[]string{"nginx-deployment", "nginx-deployment-sub"}, []string{objs[0].obj.GetName(), objs[2].obj.GetName()})
[]string{"nginx-deployment", "nginx-deployment-sub"}, []string{objs[0].obj.GetName(), objs[1].obj.GetName()})
}

func tempDir(t *testing.T) string {
Expand Down Expand Up @@ -2606,7 +2606,7 @@ func Test_findManifests(t *testing.T) {
t.Run("recursion when recursion is enabled", func(t *testing.T) {
recurse := argoappv1.ApplicationSourceDirectory{Recurse: true}
manifests, err := findManifests(logCtx, "./testdata/recurse", "./testdata/recurse", nil, recurse, nil, resource.MustParse("0"))
assert.Len(t, manifests, 6)
assert.Len(t, manifests, 4)
require.NoError(t, err)
})

Expand Down Expand Up @@ -2665,7 +2665,7 @@ func Test_findManifests(t *testing.T) {
t.Run("group of files should be limited at precisely the sum of their size", func(t *testing.T) {
// There is a total of 10 files, each file being 10 bytes.
manifests, err := findManifests(logCtx, "./testdata/several-files", "./testdata/several-files", nil, noRecurse, nil, resource.MustParse("365"))
assert.Len(t, manifests, 55)
assert.Len(t, manifests, 10)
require.NoError(t, err)

manifests, err = findManifests(logCtx, "./testdata/several-files", "./testdata/several-files", nil, noRecurse, nil, resource.MustParse("364"))
Expand All @@ -2676,7 +2676,7 @@ func Test_findManifests(t *testing.T) {
t.Run("jsonnet isn't counted against size limit", func(t *testing.T) {
// Each file is 36 bytes. Only the 36-byte json file should be counted against the limit.
manifests, err := findManifests(logCtx, "./testdata/jsonnet-and-json", "./testdata/jsonnet-and-json", nil, noRecurse, nil, resource.MustParse("36"))
assert.Len(t, manifests, 3)
assert.Len(t, manifests, 2)
require.NoError(t, err)

manifests, err = findManifests(logCtx, "./testdata/jsonnet-and-json", "./testdata/jsonnet-and-json", nil, noRecurse, nil, resource.MustParse("35"))
Expand Down

0 comments on commit 9f4fa6b

Please sign in to comment.