Skip to content

Commit

Permalink
RESP and HotRodMigration test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Drobek authored and ryanemerson committed Sep 5, 2024
1 parent 8bf447e commit 5afa0ef
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func TestRollingUpgrade(t *testing.T) {
ispn := testKube.WaitForInfinispanConditionWithTimeout(spec.Name, tutils.Namespace, ispnv1.ConditionWellFormed, conditionTimeout)

// ISPN-15651 Test migrating Indexed caches from 14.0.25.Final onwards
indexSupported := latestOperand.GTE(version.Operand{UpstreamVersion: &semver.Version{Major: 14, Minor: 0, Patch: 25}})
indexSupported := latestOperand.UpstreamVersion.GTE(*version.Operand{UpstreamVersion: &semver.Version{Major: 14, Minor: 0, Patch: 25}}.UpstreamVersion)
if indexSupported {
createIndexedCache(entriesPerCache, client)
}
Expand Down
12 changes: 7 additions & 5 deletions test/e2e/infinispan/smoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ func TestBaseFunctionality(t *testing.T) {
verifyDefaultAuthention(require, ispn)
verifyScheduling(assert, require, ispn)

// Verify that the Redis endpoint is accessible
redis := tutils.RedisClientForCluster(ispn, testKube)
size, err := redis.DBSize(context.TODO()).Result()
tutils.ExpectNoError(err)
assert.Equal(int64(0), size)
if tutils.IsVersionAtLeast("15.0.0") {
// Verify that the Redis endpoint is accessible
redis := tutils.RedisClientForCluster(ispn, testKube)
size, err := redis.DBSize(context.TODO()).Result()
tutils.ExpectNoError(err)
assert.Equal(int64(0), size)
}
}

// Make sure no PVCs were created
Expand Down
15 changes: 11 additions & 4 deletions test/e2e/utils/asserts.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,20 @@ func SkipForMajor(t *testing.T, infinispanMajor uint64, message string) {
}
}

func SkipPriorTo(t *testing.T, version, message string) {
func IsVersionAtLeast(version string) bool {
if OperandVersion != "" {
operand_cur, _ := VersionManager().WithRef(OperandVersion)
version_min, _ := semver.Parse(version)
if operand_cur.UpstreamVersion.LE(version_min) {
t.Skip(message)
}
return operand_cur.UpstreamVersion.GE(version_min)
}

// Assume yes if OperandVersion isn't specified
return true
}

func SkipPriorTo(t *testing.T, version, message string) {
if !IsVersionAtLeast(version) {
t.Skip(message)
}
}

Expand Down
17 changes: 13 additions & 4 deletions test/e2e/utils/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,13 +441,22 @@ func RedisClientForCluster(i *ispnv1.Infinispan, kube *TestKubernetes) *redis.Cl
// We can then use the host and port of the client to initialize the redis client as access is via the Single port
httpClient := HTTPClientForClusterWithVersionManager(i, kube, nil)
user, pass := userAndPassword(i, kube)
httpClient.GetHostAndPort()
return redis.NewClient(&redis.Options{
Addr: httpClient.GetHostAndPort(),
hostAndPort := httpClient.GetHostAndPort()

options := &redis.Options{
Addr: hostAndPort,
Username: *user,
Password: *pass,
DB: 0, // use default DB
})
}

if i.Spec.Security.EndpointEncryption != nil && i.Spec.Security.EndpointEncryption.Type != "None" {
options.TLSConfig = &tls.Config{
InsecureSkipVerify: true,
}
}

return redis.NewClient(options)
}

// Operand replicates the semantics of InitialiseOperandVersion pipeline handler for determing Operand version when no version is explicitly provided
Expand Down
6 changes: 5 additions & 1 deletion test/e2e/utils/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,11 @@ func (k TestKubernetes) WaitForExternalService(ispn *ispnv1.Infinispan, timeout
err = k.Kubernetes.ResourcesList(ispn.Namespace, ispn.ExternalServiceSelectorLabels(), routeList, context.TODO())
ExpectNoError(err)
if len(routeList.Items) > 0 {
hostAndPort = routeList.Items[0].Spec.Host
if routeList.Items[0].Spec.TLS != nil {
hostAndPort = routeList.Items[0].Spec.Host + ":443"
} else {
hostAndPort = routeList.Items[0].Spec.Host + ":80"
}
}
}
if hostAndPort == "" {
Expand Down

0 comments on commit 5afa0ef

Please sign in to comment.