forked from Azure/azure-service-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azuresqlfirewallrule_controller_test.go
46 lines (36 loc) · 1.34 KB
/
azuresqlfirewallrule_controller_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//go:build all || azuresqlfirewall
// +build all azuresqlfirewall
package controllers
import (
"context"
"testing"
"github.com/Azure/azure-service-operator/api/v1beta1"
"github.com/Azure/azure-service-operator/pkg/errhelp"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func TestAzureSqlFirewallRuleControllerNoResourceGroup(t *testing.T) {
t.Parallel()
defer PanicRecover(t)
ctx := context.Background()
// Add any setup steps that needs to be executed before each test
//rgName := tc.resourceGroupName
sqlServerName := GenerateTestResourceNameWithRandom("sqlfwrule-test-srv", 10)
sqlFirewallRuleName := GenerateTestResourceNameWithRandom("fwrule-dev", 10)
// Create the SqlFirewallRule object and expect the Reconcile to be created
sqlFirewallRuleInstance := &v1beta1.AzureSqlFirewallRule{
ObjectMeta: metav1.ObjectMeta{
Name: sqlFirewallRuleName,
Namespace: "default",
},
Spec: v1beta1.AzureSqlFirewallRuleSpec{
ResourceGroup: GenerateTestResourceNameWithRandom("rg-fake-srv", 10),
Server: sqlServerName,
StartIPAddress: "0.0.0.0",
EndIPAddress: "0.0.0.0",
},
}
EnsureInstanceWithResult(ctx, t, tc, sqlFirewallRuleInstance, errhelp.ResourceGroupNotFoundErrorCode, false)
EnsureDelete(ctx, t, tc, sqlFirewallRuleInstance)
}