-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding mysql tests, refactored some password/username gen
- Loading branch information
Showing
7 changed files
with
344 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
// +build all mysql | ||
|
||
package controllers | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1" | ||
"github.com/Azure/azure-service-operator/pkg/errhelp" | ||
) | ||
|
||
func TestMySQLServerControllerNoResourceGroup(t *testing.T) { | ||
t.Parallel() | ||
defer PanicRecover(t) | ||
ctx := context.Background() | ||
|
||
// Add any setup steps that needs to be executed before each test | ||
rgName := GenerateTestResourceNameWithRandom("mysqlsrv-rg", 10) | ||
rgLocation := tc.resourceGroupLocation | ||
mySQLServerName := GenerateTestResourceNameWithRandom("mysql-srv", 10) | ||
|
||
// Create the mySQLServer object and expect the Reconcile to be created | ||
mySQLServerInstance := azurev1alpha1.NewDefaultMySQLServer(mySQLServerName, rgName, rgLocation) | ||
|
||
EnsureInstanceWithResult(ctx, t, tc, mySQLServerInstance, errhelp.ResourceGroupNotFoundErrorCode, false) | ||
EnsureDelete(ctx, t, tc, mySQLServerInstance) | ||
} | ||
|
||
func TestMySQLServerControllerBadLocation(t *testing.T) { | ||
t.Parallel() | ||
defer PanicRecover(t) | ||
ctx := context.Background() | ||
|
||
// Add any setup steps that needs to be executed before each test | ||
rgLocation := GenerateTestResourceNameWithRandom("mysqlsrv-rg", 10) | ||
rgName := tc.resourceGroupName | ||
mySQLServerName := GenerateTestResourceNameWithRandom("mysql-srv", 10) | ||
|
||
// Create the mySQLServer object and expect the Reconcile to be created | ||
mySQLServerInstance := azurev1alpha1.NewDefaultMySQLServer(mySQLServerName, rgName, rgLocation) | ||
|
||
EnsureInstanceWithResult(ctx, t, tc, mySQLServerInstance, errhelp.InvalidResourceLocation, false) | ||
EnsureDelete(ctx, t, tc, mySQLServerInstance) | ||
} | ||
|
||
func TestMySQLServerControllerHappyPath(t *testing.T) { | ||
t.Parallel() | ||
defer PanicRecover(t) | ||
ctx := context.Background() | ||
|
||
// Add any setup steps that needs to be executed before each test | ||
rgLocation := "eastus2" | ||
rgName := tc.resourceGroupName | ||
mySQLServerName := GenerateTestResourceNameWithRandom("mysql-srv", 10) | ||
|
||
// Create the mySQLServer object and expect the Reconcile to be created | ||
mySQLServerInstance := azurev1alpha1.NewDefaultMySQLServer(mySQLServerName, rgName, rgLocation) | ||
|
||
EnsureInstance(ctx, t, tc, mySQLServerInstance) | ||
EnsureDelete(ctx, t, tc, mySQLServerInstance) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.