Skip to content

Commit

Permalink
Merge branch 'master' into refactor_WaitForDeployments
Browse files Browse the repository at this point in the history
  • Loading branch information
rsoaresd authored Nov 12, 2024
2 parents 22f7af0 + cbd8025 commit 1e8d00a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
3 changes: 2 additions & 1 deletion deploy/host-operator/e2e-tests/toolchainconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ spec:
segmentWriteKey: 'test devspaces segment write key'
segmentWriteKey: 'test sandbox segment write key'
environment: 'e2e-tests'
replicas: 2
# same number that is set in https://github.com/codeready-toolchain/host-operator/blob/master/deploy/registration-service/registration-service.yaml#L272-L273
replicas: 3
verification:
enabled: true
excludedEmailDomains: 'redhat.com,acme.com'
Expand Down
34 changes: 34 additions & 0 deletions test/e2e/parallel/toolchainconfig_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package parallel

import (
"context"
"testing"

testconfig "github.com/codeready-toolchain/toolchain-common/pkg/test/config"
"github.com/codeready-toolchain/toolchain-e2e/testsupport"
"github.com/stretchr/testify/require"
appsv1 "k8s.io/api/apps/v1"
"k8s.io/apimachinery/pkg/types"
)

func TestToolchainConfig(t *testing.T) {
awaitilities := testsupport.WaitForDeployments(t)
hostAwait := awaitilities.Host()

t.Run("update replica count for registration-service", func(t *testing.T) {
// get current replica count in registration-service
registrationServiceName := "registration-service"
rs := &appsv1.Deployment{}
err := hostAwait.Client.Get(context.TODO(), types.NamespacedName{Namespace: hostAwait.Namespace, Name: registrationServiceName}, rs)
require.NoError(t, err)
currentNrReplicas := *rs.Spec.Replicas

// update replica count in registration-service
newNrReplicas := currentNrReplicas + 1
hostAwait.UpdateToolchainConfig(t, testconfig.RegistrationService().Replicas(newNrReplicas))
hostAwait.WaitForDeploymentToGetReady(t, registrationServiceName, int(newNrReplicas))

// no need to revert to original replica count
// UpdateToolchainConfig returns the resource back to the original value/state at the end of the test
})
}
2 changes: 1 addition & 1 deletion testsupport/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func waitForOperators(t *testing.T) {
initHostAwait.WaitForDeploymentToGetReady(t, "host-operator-controller-manager", 1)

// wait for registration service to be ready
initHostAwait.WaitForDeploymentToGetReady(t, "registration-service", 2)
initHostAwait.WaitForDeploymentToGetReady(t, "registration-service", 3)

// set registration service values
registrationServiceRoute, err := initHostAwait.WaitForRouteToBeAvailable(t, registrationServiceNs, "registration-service", "/")
Expand Down

0 comments on commit 1e8d00a

Please sign in to comment.