Skip to content

Commit

Permalink
fix: static check for redis strings e2e test
Browse files Browse the repository at this point in the history
Signed-off-by: wangrushen <[email protected]>
  • Loading branch information
dovics committed Oct 27, 2024
1 parent b617e98 commit 91ae8d1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion tests/scalers/redis/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func RemoveCluster(t *testing.T, name, namespace string) {
helper.DeleteNamespace(t, namespace)
}

func InstallClient(t *testing.T, kc *kubernetes.Clientset, name, namespace string) {
func InstallClient(t *testing.T, name, namespace string) {
var data = templateData{
Namespace: namespace,
RedisName: name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,26 +142,26 @@ func TestScaler(t *testing.T) {
// Create Redis Cluster
redis.InstallCluster(t, kc, testName, redisNamespace, redisPassword)

redis.InstallClient(t, kc, clientName, redisNamespace)
redis.InstallClient(t, clientName, redisNamespace)
// wait until client is ready
time.Sleep(10 * time.Second)

// Create kubernetes resources for testing
CreateKubernetesResources(t, kc, testNamespace, data, templates)

testActivation(t, kc, data)
testScaleOut(t, kc, data)
testActivation(t, kc)
testScaleOut(t, kc)
testScaleIn(t, kc)
}

func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) {
func testActivation(t *testing.T, kc *kubernetes.Clientset) {
t.Log("--- testing activation ---")
setKeyValue(t, 4)

AssertReplicaCountNotChangeDuringTimePeriod(t, kc, deploymentName, testNamespace, minReplicaCount, 60)
}

func testScaleOut(t *testing.T, kc *kubernetes.Clientset, data templateData) {
func testScaleOut(t *testing.T, kc *kubernetes.Clientset) {
t.Log("--- testing scale out ---")
setKeyValue(t, 10)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,26 +145,26 @@ func TestScaler(t *testing.T) {

// Create Redis Standalone
redis.InstallSentinel(t, kc, testName, redisNamespace, redisPassword)
redis.InstallClient(t, kc, clientName, redisNamespace)
redis.InstallClient(t, clientName, redisNamespace)
// wait until client is ready
time.Sleep(10 * time.Second)

// Create kubernetes resources for testing
CreateKubernetesResources(t, kc, testNamespace, data, templates)

testActivation(t, kc, data)
testScaleOut(t, kc, data)
testActivation(t, kc)
testScaleOut(t, kc)
testScaleIn(t, kc)
}

func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) {
func testActivation(t *testing.T, kc *kubernetes.Clientset) {
t.Log("--- testing activation ---")
setKeyValue(t, 4)

AssertReplicaCountNotChangeDuringTimePeriod(t, kc, deploymentName, testNamespace, minReplicaCount, 60)
}

func testScaleOut(t *testing.T, kc *kubernetes.Clientset, data templateData) {
func testScaleOut(t *testing.T, kc *kubernetes.Clientset) {
t.Log("--- testing scale out ---")
setKeyValue(t, 10)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,26 +141,26 @@ func TestScaler(t *testing.T) {

// Create Redis Standalone
redis.InstallStandalone(t, kc, testName, redisNamespace, redisPassword)
redis.InstallClient(t, kc, clientName, redisNamespace)
redis.InstallClient(t, clientName, redisNamespace)
// wait until client is ready
time.Sleep(10 * time.Second)

// Create kubernetes resources for testing
CreateKubernetesResources(t, kc, testNamespace, data, templates)

testActivation(t, kc, data)
testScaleOut(t, kc, data)
testActivation(t, kc)
testScaleOut(t, kc)
testScaleIn(t, kc)
}

func testActivation(t *testing.T, kc *kubernetes.Clientset, data templateData) {
func testActivation(t *testing.T, kc *kubernetes.Clientset) {
t.Log("--- testing activation ---")
setKeyValue(t, 4)

AssertReplicaCountNotChangeDuringTimePeriod(t, kc, deploymentName, testNamespace, minReplicaCount, 60)
}

func testScaleOut(t *testing.T, kc *kubernetes.Clientset, data templateData) {
func testScaleOut(t *testing.T, kc *kubernetes.Clientset) {
t.Log("--- testing scale out ---")
setKeyValue(t, 10)

Expand Down

0 comments on commit 91ae8d1

Please sign in to comment.