Skip to content

Commit d461191

Browse files
authored
Improve backwards compatibility test (#785)
1 parent 770fda2 commit d461191

File tree

3 files changed

+43
-9
lines changed

3 files changed

+43
-9
lines changed

.github/workflows/compatibility-tests.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,19 @@ jobs:
3737
fail-fast: false
3838
matrix:
3939
compatibilityVersion:
40+
- 3.5.2
4041
- 3.5.0
4142
- 3.4.3
4243
- 3.4.2
4344
- 3.4.1
4445
- 3.4.0
4546
- 3.3.5
4647
- 3.3.4
47-
- 3.3.3
4848
include:
49+
- compatibilityVersion: 3.5.2
50+
coherence-image: "ghcr.io/oracle/coherence-ce:14.1.2-0-2"
51+
compatibilitySelector: control-plane=coherence
52+
k8s: kindest/node:v1.33.1@sha256:050072256b9a903bd914c0b2866828150cb229cea0efe5892e2b644d5dd3b34f
4953
- compatibilityVersion: 3.5.0
5054
coherence-image: "ghcr.io/oracle/coherence-ce:14.1.2-0-2"
5155
compatibilitySelector: control-plane=coherence
@@ -74,10 +78,6 @@ jobs:
7478
coherence-image: "ghcr.io/oracle/coherence-ce:22.06.12"
7579
compatibilitySelector: control-plane=coherence
7680
k8s: kindest/node:v1.29.2@sha256:51a1434a5397193442f0be2a297b488b6c919ce8a3931be0ce822606ea5ca245
77-
- compatibilityVersion: 3.3.3
78-
coherence-image: "ghcr.io/oracle/coherence-ce:22.06.12"
79-
compatibilitySelector: control-plane=coherence
80-
k8s: kindest/node:v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72
8181

8282
steps:
8383
- uses: actions/checkout@v4

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,6 +1585,18 @@ just-compatibility-test: ## Run the Operator backwards compatibility tests WITH
15851585
$(GOTESTSUM) --format standard-verbose --junitfile $(TEST_LOGS_DIR)/operator-e2e-compatibility-test.xml \
15861586
-- $(GO_TEST_FLAGS_E2E) ./test/e2e/compatibility/...
15871587

1588+
helm-install-prev: ## Install previous operator version for the Operator backwards compatibility tests
1589+
helm repo add coherence https://oracle.github.io/coherence-operator/charts
1590+
helm repo update
1591+
helm upgrade --version $(COMPATIBLE_VERSION) \
1592+
--namespace $(OPERATOR_NAMESPACE) operator coherence/coherence-operator
1593+
1594+
helm-upgrade-current: ## Upgrade from the previous to the current operator version for the Operator backwards compatibility tests
1595+
helm upgrade --set image=$(OPERATOR_IMAGE) \
1596+
--set defaultCoherenceUtilsImage=$(OPERATOR_IMAGE) \
1597+
--namespace $(OPERATOR_NAMESPACE) \
1598+
operator $(BUILD_HELM)/coherence-operator
1599+
15881600

15891601
# ----------------------------------------------------------------------------------------------------------------------
15901602
# Executes the Go end-to-end Operator Kubernetes versions certification tests.

test/e2e/compatibility/compatibility_test.go

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,33 @@ func TestCompatibility(t *testing.T) {
8686

8787
// scale up to make sure that the Operator can still manage the Coherence cluster
8888
n := fmt.Sprintf("coherence/%s", d.Name)
89-
t.Logf("Scaling coherence resource %s in namespace %s to 3 replicas\n", n, ns)
90-
cmd := exec.Command("kubectl", "-n", ns, "scale", n, "--replicas=3")
89+
replicas := 3
90+
testContext.Logf("Scaling coherence resource %s in namespace %s to %d replicas\n", n, ns, replicas)
91+
cmd := exec.Command("kubectl", "-n", ns, "scale", n, fmt.Sprintf("--replicas=%d", replicas))
9192
cmd.Stdout = os.Stdout
9293
cmd.Stderr = os.Stderr
9394
err = cmd.Run()
9495
g.Expect(err).NotTo(HaveOccurred())
95-
_ = assertDeploymentEventuallyInDesiredState(t, d, 3)
96+
_ = assertDeploymentEventuallyInDesiredState(t, d, int32(replicas))
97+
98+
testContext.Logf("Updating coherence resource %s in namespace %s\n", d.Name, ns)
99+
updated := &cohv1.Coherence{}
100+
err = testContext.Client.Get(context.TODO(), d.GetNamespacedName(), updated)
101+
g.Expect(err).NotTo(HaveOccurred())
102+
103+
l := updated.Spec.Labels
104+
if l == nil {
105+
l = make(map[string]string)
106+
}
107+
l["testCompatibility"] = "updated"
108+
updated.Spec.Labels = l
109+
110+
err = testContext.Client.Update(testContext.Context, updated)
111+
g.Expect(err).NotTo(HaveOccurred())
112+
113+
testContext.Logf("Waiting for Pods in updated coherence resource %s in namespace %s\n", d.Name, ns)
114+
_, err = helper.WaitForPodsWithLabel(testContext, ns, "testCompatibility=updated", replicas, time.Second*20, time.Minute*10)
115+
g.Expect(err).NotTo(HaveOccurred())
96116
}
97117

98118
func InstallPreviousVersion(g *GomegaWithT, ns, name, version, selector string) {
@@ -107,7 +127,9 @@ func InstallPreviousVersion(g *GomegaWithT, ns, name, version, selector string)
107127
err = os.MkdirAll(prevDir, os.ModePerm)
108128
g.Expect(err).NotTo(HaveOccurred())
109129

110-
cmd := exec.Command("helm", "fetch", "--version", version,
130+
var cmd *exec.Cmd
131+
132+
cmd = exec.Command("helm", "fetch", "--version", version,
111133
"--untar", "--untardir", prevDir, "coherence/coherence-operator")
112134

113135
cmd.Stdout = os.Stdout

0 commit comments

Comments
 (0)