Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nakamasato committed Mar 11, 2023
1 parent 4a44703 commit 06523ea
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions e2e/e2e_test.go
Expand Up @@ -38,11 +38,13 @@ var _ = Describe("E2e", func() {
BeforeEach(func() {
deleteMySQLUserIfExist(ctx)
deleteMySQLIfExist(ctx)
deleteMySQLSecretIfExist(ctx)
})

AfterEach(func() {
deleteMySQLUserIfExist(ctx)
deleteMySQLIfExist(ctx)
deleteMySQLSecretIfExist(ctx)
})

Describe("Creating and deleting MySQL/MySQLUser object", func() {
Expand Down Expand Up @@ -183,6 +185,15 @@ func checkMySQLHasUser(mysqluser string) (int, error) {
}
}

func deleteMySQLSecretIfExist(ctx context.Context) {
secret := &corev1.Secret{}
err := k8sClient.Get(ctx, client.ObjectKey{Namespace: mysqlNamespace, Name: secretName}, secret)
if err != nil {
return
}
Expect(k8sClient.Delete(ctx, secret)).Should(Succeed())
}

func deleteMySQLServiceIfExist(ctx context.Context) {
svcNames := []string{"mysql", "mysql-nodeport"}
for _, svcName := range svcNames {
Expand Down

0 comments on commit 06523ea

Please sign in to comment.