Skip to content

Commit

Permalink
Add setup unit test to make target 'test' (#1038)
Browse files Browse the repository at this point in the history
* upgrade controller-runtime version

* add setup tests to make target

* remove skip

* fixes for running setup unit tests

---------

Co-authored-by: Rajiv Senthilnathan <[email protected]>
Co-authored-by: Francisc Munteanu <[email protected]>
  • Loading branch information
3 people authored Aug 21, 2024
1 parent 1c38d06 commit 4a1e146
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion make/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -437,5 +437,12 @@ display-eval:

.PHONY: test
## Run the unit tests in the 'testsupport/...' packages
test:
test: test-support test-setup

.PHONY: test-support
test-support:
@go test github.com/codeready-toolchain/toolchain-e2e/testsupport/... -failfast

.PHONY: test-setup
test-setup:
@go test github.com/codeready-toolchain/toolchain-e2e/setup/... -failfast
4 changes: 2 additions & 2 deletions setup/metrics/format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func TestBytesToMBString(t *testing.T) {
// when
result := bytesToMBString(val)

require.Equal(t, "0.00 MB", result)
require.Equal(t, "0.00", result)
})

t.Run("non-zero value", func(t *testing.T) {
Expand All @@ -25,7 +25,7 @@ func TestBytesToMBString(t *testing.T) {
// when
result := bytesToMBString(val)

require.Equal(t, "117.74 MB", result)
require.Equal(t, "117.74", result)
})
})
}
Expand Down
2 changes: 1 addition & 1 deletion setup/operators/operators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func TestEnsureOperatorsInstalled(t *testing.T) {
err := EnsureOperatorsInstalled(context.TODO(), cl, scheme, []string{"installtemplates/kiali.yaml"})

// then
require.EqualError(t, err, "failed to verify installation of operator with subscription 'kiali-ossm': could not find a Subscription with name 'kiali-ossm' in namespace 'openshift-operators' that meets the expected criteria: timed out waiting for the condition")
require.ErrorContains(t, err, "could not find a Subscription with name 'kiali-ossm' in namespace 'openshift-operators' that meets the expected criteria: timed out waiting for the condition")
})

t.Run("error when getting csv", func(t *testing.T) {
Expand Down

0 comments on commit 4a1e146

Please sign in to comment.