Skip to content

Commit

Permalink
Fixed test
Browse files Browse the repository at this point in the history
Signed-off-by: Aymen Ben Tanfous <aymen.bentanfous@cimpress.com>
  • Loading branch information
Aymen Ben Tanfous committed Jun 8, 2022
1 parent 71bdb2f commit 33b6f3e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 37 deletions.
22 changes: 9 additions & 13 deletions applicationset/generators/pull_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
ctx := context.Background()
cases := []struct {
selectFunc func(context.Context, *argoprojiov1alpha1.PullRequestGenerator, *argoprojiov1alpha1.ApplicationSet) (pullrequest.PullRequestService, error)
branchSlug bool
expected []map[string]string
expectedErr error
}{
Expand All @@ -36,12 +35,12 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
nil,
)
},
branchSlug: false,
expected: []map[string]string{
{
"number": "1",
"branch": "branch1",
"head_sha": "089d92cbf9ff857a39e6feccd32798ca700fb958",
"number": "1",
"branch": "branch1",
"branch_slug": "branch1",
"head_sha": "089d92cbf9ff857a39e6feccd32798ca700fb958",
},
},
expectedErr: nil,
Expand All @@ -60,12 +59,12 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
nil,
)
},
branchSlug: true,
expected: []map[string]string{
{
"number": "2",
"branch": "feat-areally-long-pull-request-name-to-test-argo",
"head_sha": "9b34ff5bd418e57d58891eb0aa0728043ca1e8be",
"number": "2",
"branch": "feat/areally+long_pull_request_name_to_test_argo_slugification_and_branch_name_shortening_feature",
"branch_slug": "feat-areally-long-pull-request-name-to-test-argo",
"head_sha": "9b34ff5bd418e57d58891eb0aa0728043ca1e8be",
},
},
expectedErr: nil,
Expand All @@ -78,7 +77,6 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
fmt.Errorf("fake error"),
)
},
branchSlug: false,
expected: nil,
expectedErr: fmt.Errorf("error listing repos: fake error"),
},
Expand All @@ -91,9 +89,7 @@ func TestPullRequestGithubGenerateParams(t *testing.T) {
generatorConfig := argoprojiov1alpha1.ApplicationSetGenerator{
PullRequest: &argoprojiov1alpha1.PullRequestGenerator{},
}
if c.branchSlug {
generatorConfig.PullRequest.BranchSlug = true
}

got, gotErr := gen.GenerateParams(&generatorConfig, nil)
assert.Equal(t, c.expectedErr, gotErr)
assert.ElementsMatch(t, c.expected, got)
Expand Down
6 changes: 0 additions & 6 deletions manifests/core-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4487,8 +4487,6 @@ spec:
- project
- repo
type: object
branchSlug:
type: boolean
filters:
items:
properties:
Expand Down Expand Up @@ -6665,8 +6663,6 @@ spec:
- project
- repo
type: object
branchSlug:
type: boolean
filters:
items:
properties:
Expand Down Expand Up @@ -7708,8 +7704,6 @@ spec:
- project
- repo
type: object
branchSlug:
type: boolean
filters:
items:
properties:
Expand Down
6 changes: 0 additions & 6 deletions manifests/crds/applicationset-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2335,8 +2335,6 @@ spec:
- project
- repo
type: object
branchSlug:
type: boolean
filters:
items:
properties:
Expand Down Expand Up @@ -4513,8 +4511,6 @@ spec:
- project
- repo
type: object
branchSlug:
type: boolean
filters:
items:
properties:
Expand Down Expand Up @@ -5556,8 +5552,6 @@ spec:
- project
- repo
type: object
branchSlug:
type: boolean
filters:
items:
properties:
Expand Down
6 changes: 0 additions & 6 deletions manifests/ha/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4487,8 +4487,6 @@ spec:
- project
- repo
type: object
branchSlug:
type: boolean
filters:
items:
properties:
Expand Down Expand Up @@ -6665,8 +6663,6 @@ spec:
- project
- repo
type: object
branchSlug:
type: boolean
filters:
items:
properties:
Expand Down Expand Up @@ -7708,8 +7704,6 @@ spec:
- project
- repo
type: object
branchSlug:
type: boolean
filters:
items:
properties:
Expand Down
6 changes: 0 additions & 6 deletions manifests/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4487,8 +4487,6 @@ spec:
- project
- repo
type: object
branchSlug:
type: boolean
filters:
items:
properties:
Expand Down Expand Up @@ -6665,8 +6663,6 @@ spec:
- project
- repo
type: object
branchSlug:
type: boolean
filters:
items:
properties:
Expand Down Expand Up @@ -7708,8 +7704,6 @@ spec:
- project
- repo
type: object
branchSlug:
type: boolean
filters:
items:
properties:
Expand Down

0 comments on commit 33b6f3e

Please sign in to comment.