forked from infinispan/infinispan-operator
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spec.Image field always overwritten by Operand image for CVE releases. …
…Fixes infinispan#1817
- Loading branch information
1 parent
ae253b6
commit b249ee2
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package infinispan | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
ispnv1 "github.com/infinispan/infinispan-operator/api/v1" | ||
"github.com/infinispan/infinispan-operator/pkg/kubernetes" | ||
"github.com/infinispan/infinispan-operator/pkg/reconcile/pipeline/infinispan/handler/provision" | ||
tutils "github.com/infinispan/infinispan-operator/test/e2e/utils" | ||
"github.com/stretchr/testify/assert" | ||
appsv1 "k8s.io/api/apps/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
"k8s.io/utils/pointer" | ||
) | ||
|
||
func TestCustomImage(t *testing.T) { | ||
t.Parallel() | ||
defer testKube.CleanNamespaceAndLogOnPanic(t, tutils.Namespace) | ||
|
||
img := "quay.io/infinispan/server:latest" | ||
spec := tutils.DefaultSpec(t, testKube, func(i *ispnv1.Infinispan) { | ||
i.Spec.Image = pointer.String(img) | ||
}) | ||
|
||
testKube.CreateInfinispan(spec, tutils.Namespace) | ||
testKube.WaitForInfinispanPods(1, tutils.SinglePodTimeout, spec.Name, tutils.Namespace) | ||
testKube.WaitForInfinispanCondition(spec.Name, spec.Namespace, ispnv1.ConditionWellFormed) | ||
|
||
ss := &appsv1.StatefulSet{} | ||
tutils.ExpectNoError(testKube.Kubernetes.Client.Get(context.TODO(), types.NamespacedName{Namespace: spec.Namespace, Name: spec.GetStatefulSetName()}, ss)) | ||
container := kubernetes.GetContainer(provision.InfinispanContainer, &ss.Spec.Template.Spec) | ||
// Ensure that no SS rolling upgrade is executed as the default test Operand is marked as a CVE release | ||
// https://github.com/infinispan/infinispan-operator/issues/1817 | ||
assert.Equal(t, int64(1), ss.Generation) | ||
assert.Equal(t, img, container.Image) | ||
} |