Skip to content

Commit

Permalink
Using require package instead of assert and fixed code generation
Browse files Browse the repository at this point in the history
Signed-off-by: anandf <anjoseph@redhat.com>
  • Loading branch information
anandf committed Sep 24, 2024
1 parent f321a50 commit bf18f9f
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 20 deletions.
2 changes: 1 addition & 1 deletion assets/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions controller/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ func TestDeriveServiceAccountMatchingNamespaces(t *testing.T) {
sa, err := deriveServiceAccountToImpersonate(f.project, f.application)

// then, there should be no error and should use the right service account for impersonation
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, expectedSA, sa)
})

Expand Down Expand Up @@ -759,7 +759,7 @@ func TestDeriveServiceAccountMatchingNamespaces(t *testing.T) {
sa, err := deriveServiceAccountToImpersonate(f.project, f.application)

// then, there should be no error and should use the right service account for impersonation
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, expectedSA, sa)
})

Expand Down Expand Up @@ -798,7 +798,7 @@ func TestDeriveServiceAccountMatchingNamespaces(t *testing.T) {
sa, err := deriveServiceAccountToImpersonate(f.project, f.application)

// then, there should be no error and it should use the first matching service account for impersonation
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, expectedSA, sa)
})

Expand Down Expand Up @@ -832,7 +832,7 @@ func TestDeriveServiceAccountMatchingNamespaces(t *testing.T) {
sa, err := deriveServiceAccountToImpersonate(f.project, f.application)

// then, there should not be any error and should use the first matching glob pattern service account for impersonation
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, expectedSA, sa)
})

Expand Down Expand Up @@ -867,7 +867,7 @@ func TestDeriveServiceAccountMatchingNamespaces(t *testing.T) {
sa, err := deriveServiceAccountToImpersonate(f.project, f.application)

// then, there should be an error saying no match was found
assert.EqualError(t, err, expectedErrMsg)
require.EqualError(t, err, expectedErrMsg)
assert.Equal(t, expectedSA, sa)
})

Expand Down Expand Up @@ -895,7 +895,7 @@ func TestDeriveServiceAccountMatchingNamespaces(t *testing.T) {
sa, err := deriveServiceAccountToImpersonate(f.project, f.application)

// then, there should not be any error and the service account configured for with empty namespace should be used.
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, expectedSA, sa)
})

Expand Down Expand Up @@ -929,7 +929,7 @@ func TestDeriveServiceAccountMatchingNamespaces(t *testing.T) {
sa, err := deriveServiceAccountToImpersonate(f.project, f.application)

// then, there should not be any error and the catch all service account should be returned
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, expectedSA, sa)
})

Expand Down Expand Up @@ -964,7 +964,7 @@ func TestDeriveServiceAccountMatchingNamespaces(t *testing.T) {
assert.Equal(t, expectedSA, sa)

// then, there should not be any error and the service account with its namespace should be returned.
assert.NoError(t, err)
require.NoError(t, err)
})
}

Expand Down Expand Up @@ -1038,7 +1038,7 @@ func TestDeriveServiceAccountMatchingServers(t *testing.T) {
sa, err := deriveServiceAccountToImpersonate(f.project, f.application)

// then, there should not be any error and the right service account must be returned.
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, expectedSA, sa)
})

Expand Down Expand Up @@ -1077,7 +1077,7 @@ func TestDeriveServiceAccountMatchingServers(t *testing.T) {
sa, err := deriveServiceAccountToImpersonate(f.project, f.application)

// then, there should not be any error and first matching service account should be used
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, expectedSA, sa)
})

Expand Down Expand Up @@ -1112,7 +1112,7 @@ func TestDeriveServiceAccountMatchingServers(t *testing.T) {
assert.Equal(t, expectedSA, sa)

// then, there should not be any error and the service account of the glob pattern, being the first match should be returned.
assert.NoError(t, err)
require.NoError(t, err)
})

t.Run("no match among a valid list", func(t *testing.T) {
Expand Down Expand Up @@ -1146,7 +1146,7 @@ func TestDeriveServiceAccountMatchingServers(t *testing.T) {
sa, err := deriveServiceAccountToImpersonate(f.project, f.application)

// then, there an error with appropriate message must be returned
assert.EqualError(t, err, expectedErr)
require.EqualError(t, err, expectedErr)
assert.Equal(t, expectedSA, sa)
})

Expand Down Expand Up @@ -1180,7 +1180,7 @@ func TestDeriveServiceAccountMatchingServers(t *testing.T) {
sa, err := deriveServiceAccountToImpersonate(f.project, f.application)

// then, there should not be any error and the service account of the glob pattern match must be returned.
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, expectedSA, sa)
})

Expand Down Expand Up @@ -1214,7 +1214,7 @@ func TestDeriveServiceAccountMatchingServers(t *testing.T) {
sa, err := deriveServiceAccountToImpersonate(f.project, f.application)

// then, there should not be any error and the service account with the given namespace prefix must be returned.
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, expectedSA, sa)
})
}
Expand Down
5 changes: 4 additions & 1 deletion manifests/core-install.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion manifests/crds/appproject-crd.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion manifests/ha/install.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion manifests/install.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/apis/application/v1alpha1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bf18f9f

Please sign in to comment.