Skip to content

Commit

Permalink
Fix upgrade e2e test trying to pick a version that hasn't been releas…
Browse files Browse the repository at this point in the history
…ed yet
  • Loading branch information
adejanovski committed Mar 23, 2023
1 parent fd13fee commit 439af5d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
42 changes: 22 additions & 20 deletions test/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,11 @@ func TestOperator(t *testing.T) {
fixture: framework.NewTestFixture("gc/4.0-jdk11-ZGC", controlPlane),
}))
})
// TODO temporarily disabled until issue in generateK8ssandraOperatorKustomization is fixed
//t.Run("UpgradeOperatorImage", e2eTest(ctx, &e2eTestOpts{
// testFunc: createSingleDatacenterClusterWithUpgrade,
// fixture: framework.NewTestFixture("single-dc-upgrade", controlPlane),
// initialVersion: pointer.String("v1.4.1"), // Has to be the Helm chart version, not the operator image tag
//}))
t.Run("UpgradeOperatorImage", e2eTest(ctx, &e2eTestOpts{
testFunc: createSingleDatacenterClusterWithUpgrade,
fixture: framework.NewTestFixture("single-dc-upgrade", controlPlane),
initialVersion: pointer.String("v1.4.1"), // Has to be the Helm chart version, not the operator image tag
}))
t.Run("StargateJwt", e2eTest(ctx, &e2eTestOpts{
testFunc: stargateJwt,
fixture: framework.NewTestFixture("stargate-jwt", controlPlane),
Expand Down Expand Up @@ -475,14 +474,16 @@ func beforeTest(t *testing.T, f *framework.E2eFramework, opts *e2eTestOpts) erro
}

deploymentConfig := framework.OperatorDeploymentConfig{
Namespace: opts.operatorNamespace,
ClusterScoped: opts.clusterScoped,
ImageName: *imageName,
ImageTag: *imageTag,
Namespace: opts.operatorNamespace,
ClusterScoped: opts.clusterScoped,
ImageName: *imageName,
ImageTag: *imageTag,
GithubKustomization: false,
}

if opts.initialVersion != nil {
deploymentConfig.ImageTag = *opts.initialVersion
deploymentConfig.GithubKustomization = true
}

if err := f.DeployK8ssandraOperator(deploymentConfig); err != nil {
Expand Down Expand Up @@ -873,6 +874,17 @@ func createSingleDatacenterClusterWithUpgrade(t *testing.T, ctx context.Context,
initialStargatePodNames := GetStargatePodNames(t, f, ctx, stargateDeploymentKey)
require.Len(initialStargatePodNames, 1, "expected 1 Stargate pod in namespace %s", namespace)

t.Log("retrieve database credentials")
username, password, err := f.RetrieveDatabaseCredentials(ctx, f.DataPlaneContexts[0], namespace, k8ssandra.SanitizedName())
require.NoError(err, "failed to retrieve database credentials")

t.Log("deploying Stargate ingress routes in context", f.DataPlaneContexts[0])
stargateRestHostAndPort := ingressConfigs[f.DataPlaneContexts[0]].StargateRest
stargateGrpcHostAndPort := ingressConfigs[f.DataPlaneContexts[0]].StargateGrpc
stargateCqlHostAndPort := ingressConfigs[f.DataPlaneContexts[0]].StargateCql
f.DeployStargateIngresses(t, f.DataPlaneContexts[0], namespace, dcPrefix+"-stargate-service", stargateRestHostAndPort, stargateGrpcHostAndPort)
defer f.UndeployAllIngresses(t, f.DataPlaneContexts[0], namespace)

// Perform the upgrade
err = upgradeToLatest(t, ctx, f, namespace)
require.NoError(err, "failed to upgrade to latest version")
Expand All @@ -892,16 +904,6 @@ func createSingleDatacenterClusterWithUpgrade(t *testing.T, ctx context.Context,
}, polling.stargateReady.timeout, polling.stargateReady.interval)
}

t.Log("retrieve database credentials")
username, password, err := f.RetrieveDatabaseCredentials(ctx, f.DataPlaneContexts[0], namespace, k8ssandra.SanitizedName())
require.NoError(err, "failed to retrieve database credentials")

t.Log("deploying Stargate ingress routes in context", f.DataPlaneContexts[0])
stargateRestHostAndPort := ingressConfigs[f.DataPlaneContexts[0]].StargateRest
stargateGrpcHostAndPort := ingressConfigs[f.DataPlaneContexts[0]].StargateGrpc
stargateCqlHostAndPort := ingressConfigs[f.DataPlaneContexts[0]].StargateCql
f.DeployStargateIngresses(t, f.DataPlaneContexts[0], namespace, dcPrefix+"-stargate-service", stargateRestHostAndPort, stargateGrpcHostAndPort)
defer f.UndeployAllIngresses(t, f.DataPlaneContexts[0], namespace)
checkStargateApisReachable(t, ctx, f.DataPlaneContexts[0], namespace, dcPrefix, stargateRestHostAndPort, stargateGrpcHostAndPort, stargateCqlHostAndPort, username, password, false, f)

replication := map[string]int{"dc1": 1}
Expand Down
11 changes: 6 additions & 5 deletions test/framework/e2e_framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ func generateK8ssandraOperatorKustomization(config OperatorDeploymentConfig) err
dataPlaneDir := "data-plane"
config.ControlPlaneComponent = "../../../../config/deployments/control-plane"
config.DataPlaneComponent = "../../../../config/deployments/data-plane"
// TODO fix this, it fails in GHA during the release process
//if config.ImageTag != "latest" {
// config.ControlPlaneComponent = "github.com/k8ssandra/k8ssandra-operator/config/deployments/control-plane?ref=" + config.ImageTag
// config.DataPlaneComponent = "github.com/k8ssandra/k8ssandra-operator/config/deployments/data-plane?ref=" + config.ImageTag
//}

if config.GithubKustomization {
config.ControlPlaneComponent = "github.com/k8ssandra/k8ssandra-operator/config/deployments/control-plane?ref=" + config.ImageTag
config.DataPlaneComponent = "github.com/k8ssandra/k8ssandra-operator/config/deployments/data-plane?ref=" + config.ImageTag
}
controlPlaneTmpl := `
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
Expand Down Expand Up @@ -353,6 +353,7 @@ type OperatorDeploymentConfig struct {
ClusterScoped bool
ImageName string
ImageTag string
GithubKustomization bool // If true, use the kustomization.yaml from the github repo
ControlPlaneComponent string
DataPlaneComponent string
}
Expand Down
2 changes: 1 addition & 1 deletion test/testdata/fixtures/single-dc-upgrade/k8ssandra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
- metadata:
name: dc1
k8sContext: kind-k8ssandra-0
size: 1
size: 2
storageConfig:
cassandraDataVolumeClaimSpec:
storageClassName: standard
Expand Down

0 comments on commit 439af5d

Please sign in to comment.