-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a simple e2e test for the presence of consumed capacity (#1079)
* Add a simple e2e test for the presence of consumed capacity in the space provisioner configs. We cannot do much more because we cannot mess with the registered members, nor can we add/remove new members. * Add a small test to make sure adding the last space disables the SPC. --------- Co-authored-by: Matous Jobanek <[email protected]>
- Loading branch information
1 parent
fc38f5d
commit cf7674a
Showing
5 changed files
with
95 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import ( | |
"testing" | ||
"time" | ||
|
||
"github.com/codeready-toolchain/toolchain-common/pkg/test/assertions" | ||
commonauth "github.com/codeready-toolchain/toolchain-common/pkg/test/auth" | ||
testSpc "github.com/codeready-toolchain/toolchain-common/pkg/test/spaceprovisionerconfig" | ||
authsupport "github.com/codeready-toolchain/toolchain-e2e/testsupport/auth" | ||
|
@@ -280,6 +281,46 @@ func (s *userSignupIntegrationTest) TestProvisionToOtherClusterWhenOneIsFull() { | |
}) | ||
} | ||
|
||
func (s *userSignupIntegrationTest) TestFillingUpClusterCapacityFlipsSPCsToNotReady() { | ||
t := s.T() | ||
hostAwait := s.Host() | ||
memberAwait1 := s.Member1() | ||
memberAwait2 := s.Member2() | ||
|
||
spaceprovisionerconfig.UpdateForCluster(t, hostAwait.Awaitility, memberAwait1.ClusterName, testSpc.MaxNumberOfSpaces(1)) | ||
spaceprovisionerconfig.UpdateForCluster(t, hostAwait.Awaitility, memberAwait2.ClusterName, testSpc.Enabled(false)) | ||
hostAwait.UpdateToolchainConfig(t, testconfig.AutomaticApproval().Enabled(true)) | ||
|
||
t.Run("SPC with free capacity is ready", func(t *testing.T) { | ||
// then | ||
_, err := wait.For(t, hostAwait.Awaitility, &toolchainv1alpha1.SpaceProvisionerConfig{}).FirstThat( | ||
assertions.Has(spaceprovisionerconfig.ReferenceToToolchainCluster(memberAwait1.ClusterName)), | ||
assertions.Is(testSpc.Ready())) | ||
require.NoError(t, err) | ||
|
||
_, err = wait.For(t, hostAwait.Awaitility, &toolchainv1alpha1.SpaceProvisionerConfig{}).FirstThat( | ||
assertions.Has(spaceprovisionerconfig.ReferenceToToolchainCluster(memberAwait2.ClusterName)), | ||
assertions.Is(testSpc.NotReady())) | ||
require.NoError(t, err) | ||
}) | ||
|
||
t.Run("deploying a space fills up the member, flipping its SPC to not ready", func(t *testing.T) { | ||
// when | ||
NewSignupRequest(s.Awaitilities). | ||
Username("fill-up-user-1"). | ||
Email("[email protected]"). | ||
WaitForMUR(). | ||
RequireConditions(wait.ConditionSet(wait.Default(), wait.ApprovedAutomatically())...). | ||
Execute(s.T()) | ||
|
||
// then | ||
_, err := wait.For(t, hostAwait.Awaitility, &toolchainv1alpha1.SpaceProvisionerConfig{}).FirstThat( | ||
assertions.Has(spaceprovisionerconfig.ReferenceToToolchainCluster(memberAwait1.ClusterName)), | ||
assertions.Is(testSpc.NotReady())) | ||
require.NoError(t, err) | ||
}) | ||
} | ||
|
||
func (s *userSignupIntegrationTest) TestUserIDAndAccountIDClaimsPropagated() { | ||
hostAwait := s.Host() | ||
|
||
|
@@ -533,7 +574,12 @@ func (s *userSignupIntegrationTest) TestCapacityManagementWithManualApproval() { | |
Execute(s.T()) | ||
userSignup := user.UserSignup | ||
|
||
_, spcNotReadyError := wait.For(t, hostAwait.Awaitility, &toolchainv1alpha1.SpaceProvisionerConfig{}).FirstThat( | ||
assertions.Has(spaceprovisionerconfig.ReferenceToToolchainCluster(memberAwait1.ClusterName)), | ||
assertions.Is(testSpc.NotReady())) | ||
|
||
// then | ||
require.NoError(t, spcNotReadyError) | ||
s.userIsNotProvisioned(t, userSignup) | ||
|
||
t.Run("reset the max number and expect the user will be provisioned", func(t *testing.T) { | ||
|
@@ -566,7 +612,12 @@ func (s *userSignupIntegrationTest) TestCapacityManagementWithManualApproval() { | |
Execute(s.T()) | ||
userSignup := user.UserSignup | ||
|
||
_, spcNotReadyError := wait.For(t, hostAwait.Awaitility, &toolchainv1alpha1.SpaceProvisionerConfig{}).FirstThat( | ||
assertions.Has(spaceprovisionerconfig.ReferenceToToolchainCluster(memberAwait1.ClusterName)), | ||
assertions.Is(testSpc.NotReady())) | ||
|
||
// then | ||
require.NoError(t, spcNotReadyError) | ||
s.userIsNotProvisioned(t, userSignup) | ||
|
||
t.Run("reset the threshold and expect the user will be provisioned", func(t *testing.T) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters