@@ -2,11 +2,9 @@ package infinispan
2
2
3
3
import (
4
4
"context"
5
- "strconv"
6
5
"testing"
7
6
8
7
ispnv1 "github.com/infinispan/infinispan-operator/api/v1"
9
- "github.com/infinispan/infinispan-operator/pkg/infinispan/version"
10
8
"github.com/infinispan/infinispan-operator/pkg/kubernetes"
11
9
"github.com/infinispan/infinispan-operator/pkg/reconcile/pipeline/infinispan/handler/provision"
12
10
tutils "github.com/infinispan/infinispan-operator/test/e2e/utils"
@@ -20,30 +18,31 @@ func TestCustomImage(t *testing.T) {
20
18
t .Parallel ()
21
19
defer testKube .CleanNamespaceAndLogOnPanic (t , tutils .Namespace )
22
20
23
- var operand version.Operand
24
- versionManager := tutils .VersionManager ()
25
- // Attempting to use latest Infinispan Server image while having version set to different major will result in misconfiguration by Operator
26
- if tutils .OperandVersion != "" {
27
- operand , _ = versionManager .WithRef (tutils .OperandVersion )
28
- } else {
29
- operand = versionManager .Latest ()
30
- }
31
- img := "quay.io/infinispan/server:" + strconv .FormatUint (operand .UpstreamVersion .Major , 10 ) + "." + strconv .FormatUint (operand .UpstreamVersion .Minor , 10 )
21
+ // Get the two latest Operands that share the same major/minor version, otherwise we'll hit incompatibility issue
22
+ customOperand , versionOperand := specImageOperands ()
32
23
24
+ // Use customerOperand (previous release) as a custom image and spec.version of the latest release in the stream
33
25
spec := tutils .DefaultSpec (t , testKube , func (i * ispnv1.Infinispan ) {
34
- i .Spec .Image = pointer .String (img )
26
+ i .Spec .Image = pointer .String (customOperand .Image )
27
+ i .Spec .Version = versionOperand .Ref ()
35
28
})
36
29
37
30
testKube .CreateInfinispan (spec , tutils .Namespace )
38
31
testKube .WaitForInfinispanPods (1 , tutils .SinglePodTimeout , spec .Name , tutils .Namespace )
32
+
39
33
ispn := testKube .WaitForInfinispanCondition (spec .Name , spec .Namespace , ispnv1 .ConditionWellFormed )
40
- assert .Equal (t , img , ispn .Status .Operand .Image )
34
+
35
+ assert .True (t , ispn .Status .Operand .CustomImage )
36
+ assert .Equal (t , customOperand .Image , ispn .Status .Operand .Image )
37
+ assert .Equal (t , versionOperand .Ref (), ispn .Status .Operand .Version )
38
+ assert .Equal (t , ispnv1 .OperandPhaseRunning , ispn .Status .Operand .Phase )
41
39
42
40
ss := & appsv1.StatefulSet {}
43
41
tutils .ExpectNoError (testKube .Kubernetes .Client .Get (context .TODO (), types.NamespacedName {Namespace : spec .Namespace , Name : spec .GetStatefulSetName ()}, ss ))
44
42
container := kubernetes .GetContainer (provision .InfinispanContainer , & ss .Spec .Template .Spec )
43
+
45
44
// Ensure that no SS rolling upgrade is executed as the default test Operand is marked as a CVE release
46
45
// https://github.com/infinispan/infinispan-operator/issues/1817
47
46
assert .Equal (t , int64 (1 ), ss .Generation )
48
- assert .Equal (t , img , container .Image )
47
+ assert .Equal (t , customOperand . Image , container .Image )
49
48
}
0 commit comments