@@ -42,11 +42,18 @@ func TestUpgrade(t *testing.T) {
42
42
43
43
testKube .CreateInfinispan (spec , tutils .Namespace )
44
44
testKube .WaitForInfinispanPods (replicas , tutils .SinglePodTimeout , spec .Name , tutils .Namespace )
45
- testKube .WaitForInfinispanConditionWithTimeout (spec .Name , spec .Namespace , ispnv1 .ConditionWellFormed , conditionTimeout )
46
- assertNoDegradedCaches ()
45
+ spec = testKube .WaitForInfinispanConditionWithTimeout (spec .Name , spec .Namespace , ispnv1 .ConditionWellFormed , conditionTimeout )
46
+
47
+ versionManager := testKube .VersionManagerFromCSV (sub )
48
+ operand , err := versionManager .WithRef (spec .Spec .Version )
49
+ tutils .ExpectNoError (err )
47
50
48
51
numEntries := 100
49
- client := tutils .HTTPClientForClusterWithVersionManager (spec , testKube , testKube .VersionManagerFromCSV (sub ))
52
+ client := tutils .HTTPClientForClusterWithVersionManager (spec , testKube , versionManager )
53
+
54
+ if locksCacheDegraded (operand ) {
55
+ healDegradedLocksCache (operand , client )
56
+ }
50
57
51
58
// Add a persistent cache with data to ensure contents can be read after upgrade(s)
52
59
createAndPopulatePersistentCache (persistentCacheName , numEntries , client )
@@ -77,7 +84,7 @@ func TestUpgrade(t *testing.T) {
77
84
// https://github.com/infinispan/infinispan-operator/issues/1719
78
85
time .Sleep (time .Minute )
79
86
80
- versionManager : = testKube .VersionManagerFromCSV (sub )
87
+ versionManager = testKube .VersionManagerFromCSV (sub )
81
88
if ispnPreUpgrade .Spec .Version == "" {
82
89
relatedImageJdk := testKube .InstalledCSVEnv ("RELATED_IMAGE_OPENJDK" , sub )
83
90
if relatedImageJdk != "" {
@@ -118,6 +125,13 @@ func TestUpgrade(t *testing.T) {
118
125
continue
119
126
}
120
127
128
+ client = tutils .HTTPClientForClusterWithVersionManager (spec , testKube , versionManager )
129
+ op , err := versionManager .WithRef (ispnPreUpgrade .Spec .Version )
130
+ tutils .ExpectNoError (err )
131
+ if locksCacheDegraded (op ) {
132
+ healDegradedLocksCache (op , client )
133
+ }
134
+
121
135
tutils .ExpectNoError (
122
136
testKube .UpdateInfinispan (ispn , func () {
123
137
ispn .Spec .Version = latestOperand .Ref ()
@@ -142,9 +156,12 @@ func TestUpgrade(t *testing.T) {
142
156
// Ensure that persistent cache entries have survived the upgrade(s)
143
157
// Refresh the hostAddr and client as the url will change if NodePort is used.
144
158
client = tutils .HTTPClientForClusterWithVersionManager (spec , testKube , versionManager )
145
- assertNoDegradedCaches ()
146
159
tutils .NewCacheHelper (persistentCacheName , client ).AssertSize (numEntries )
147
160
161
+ if locksCacheDegraded (latestOperand ) {
162
+ healDegradedLocksCache (latestOperand , client )
163
+ }
164
+
148
165
// Restore the backup and ensure that the cache exists with the expected number of entries
149
166
restoreName := "upgrade-restore-" + strings .ReplaceAll (strings .TrimLeft (sub .Status .CurrentCSV , olm .SubName + ".v" ), "." , "-" )
150
167
if restore , err := createRestoreAndWaitToSucceed (restoreName , backup , t ); err != nil {
@@ -163,7 +180,7 @@ func TestUpgrade(t *testing.T) {
163
180
checkBatch (t , spec )
164
181
165
182
// Kill the first pod to ensure that the cluster can recover from failover after upgrade
166
- err : = testKube .Kubernetes .Client .Delete (ctx , & corev1.Pod {
183
+ err = testKube .Kubernetes .Client .Delete (ctx , & corev1.Pod {
167
184
ObjectMeta : metav1.ObjectMeta {
168
185
Name : spec .Name + "-0" ,
169
186
Namespace : tutils .Namespace ,
@@ -174,7 +191,7 @@ func TestUpgrade(t *testing.T) {
174
191
testKube .WaitForInfinispanConditionWithTimeout (spec .Name , tutils .Namespace , ispnv1 .ConditionWellFormed , conditionTimeout )
175
192
176
193
// Ensure that persistent cache entries still contain the expected numEntries
177
- versionManager : = testKube .VersionManagerFromCSV (sub )
194
+ versionManager = testKube .VersionManagerFromCSV (sub )
178
195
client = tutils .HTTPClientForClusterWithVersionManager (spec , testKube , versionManager )
179
196
tutils .NewCacheHelper (persistentCacheName , client ).AssertSize (numEntries )
180
197
}
0 commit comments