Skip to content

Commit

Permalink
Fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
burmanm committed Sep 5, 2024
1 parent a9fae75 commit f04541b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pkg/images/images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func TestDefaultImageConfigParsing(t *testing.T) {

path, err = GetCassandraImage("cassandra", "4.1.4")
assert.NoError(err)
assert.Equal("k8ssandra/cass-management-api:4.1.4-ubi8", path)
assert.Equal("k8ssandra/cass-management-api:4.1.4-ubi", path)
}

func TestImageConfigParsing(t *testing.T) {
Expand Down
15 changes: 3 additions & 12 deletions tests/util/ginkgo/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package ginkgo_util
import (
"encoding/base64"
"fmt"
"github.com/pkg/errors"
"os"
"path/filepath"
"regexp"
Expand All @@ -15,6 +14,8 @@ import (
"strings"
"time"

"github.com/pkg/errors"

ginkgo "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"gopkg.in/yaml.v2"
Expand Down Expand Up @@ -424,24 +425,14 @@ func (ns *NsWrapper) Log(step string) {
ginkgo.By(step)
}

func (ns *NsWrapper) getDcNameWithOverride(dcName string) string {
json := "jsonpath={.spec.datacenterName}"
k := kubectl.Get("CassandraDatacenter", dcName).FormatOutput(json)
dcNameOverride := ns.OutputPanic(k)
if dcNameOverride == "" {
return dcName
}
return dcNameOverride
}

func (ns *NsWrapper) WaitForDatacenterReadyWithTimeouts(dcName string, podCountTimeout int, dcReadyTimeout int) {
json := "jsonpath={.spec.size}"
k := kubectl.Get("CassandraDatacenter", dcName).FormatOutput(json)
sizeString := ns.OutputPanic(k)
size, err := strconv.Atoi(sizeString)
Expect(err).ToNot(HaveOccurred())

ns.WaitForDatacenterReadyPodCountWithTimeout(ns.getDcNameWithOverride(dcName), size, podCountTimeout)
ns.WaitForDatacenterReadyPodCountWithTimeout(dcName, size, podCountTimeout)
ns.WaitForDatacenterOperatorProgress(dcName, "Ready", dcReadyTimeout)
}

Expand Down

0 comments on commit f04541b

Please sign in to comment.