Skip to content

Commit

Permalink
Add graceful cleanup for redis cluster e2e test (#1493)
Browse files Browse the repository at this point in the history
Signed-off-by: Deepak <sah.sslpu@gmail.com>
  • Loading branch information
goku321 committed Jan 9, 2021
1 parent 0928097 commit 38c76c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions tests/scalers/redis-cluster-lists.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ test.after.always.cb('clean up deployment', t => {
`scaledobject.keda.sh/${redisWorkerHostPortRefDeploymentName}`,
`scaledobject.keda.sh/${redisWorkerAddressRefDeploymentName}`,
`scaledobject.keda.sh/${redisWorkerHostPortRefTriggerAuthDeploymentName}`,
'triggerauthentication.keda.sh/keda-redis-list-triggerauth',
'triggerauthentication.keda.sh/keda-redis-list-triggerauth-host-port',
'triggerauthentication.keda.sh/keda-redis-cluster-list-triggerauth',
'triggerauthentication.keda.sh/keda-redis-cluster-list-triggerauth-host-port',
`deployment/${redisWorkerAddressRefDeploymentName}`,
`deployment/${redisWorkerHostPortRefTriggerAuthDeploymentName}`,
`deployment/${redisWorkerHostPortRefDeploymentName}`,
Expand All @@ -264,6 +264,7 @@ test.after.always.cb('clean up deployment', t => {
}
sh.exec(`kubectl delete namespace ${testNamespace}`)

sh.exec(`helm delete ${redisClusterName} --namespace ${redisNamespace}`)
sh.exec(`kubectl delete namespace ${redisNamespace}`)
t.end()
})
Expand Down
5 changes: 2 additions & 3 deletions tests/scalers/redis-cluster-streams.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ const redisService = 'redis-cluster-streams'
const testNamespace = 'redis-cluster-streams-test'
const redisPassword = 'foobared'
let redisHost = ''
let redisAddress = ''
const redisPort = 6379
const numMessages = 100

test.before(t => {
Expand All @@ -35,7 +33,6 @@ test.before(t => {

// Get Redis cluster address.
redisHost = sh.exec(`kubectl get svc ${redisService} -n ${redisNamespace} -o jsonpath='{.spec.clusterIP}'`)
redisAddress = `${redisHost}:${redisPort}`

// Create test namespace.
sh.exec(`kubectl create namespace ${testNamespace}`)
Expand Down Expand Up @@ -114,13 +111,15 @@ test.after.always.cb('clean up deployment', t => {
'triggerauthentications.keda.sh/keda-redis-stream-triggerauth',
'secret/redis-password',
'deployment/redis-streams-consumer',
'job/redis-streams-producer',
]

for (const resource of resources) {
sh.exec(`kubectl delete ${resource} --namespace ${testNamespace}`)
}
sh.exec(`kubectl delete namespace ${testNamespace}`)

sh.exec(`helm delete ${redisClusterName} --namespace ${redisNamespace}`)
sh.exec(`kubectl delete namespace ${redisNamespace}`)
t.end()
})
Expand Down

0 comments on commit 38c76c5

Please sign in to comment.