Skip to content

Commit d3fdc3e

Browse files
Fix tests
1 parent 15dd55b commit d3fdc3e

File tree

3 files changed

+23
-43
lines changed

3 files changed

+23
-43
lines changed

v2/internal/controllers/appconfiguration_keyvalue_v1api20240601_crud_test.go

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
appconfig "github.com/Azure/azure-service-operator/v2/api/appconfiguration/v1api20240601"
1414
"github.com/Azure/azure-service-operator/v2/internal/testcommon"
1515
"github.com/Azure/azure-service-operator/v2/internal/util/to"
16-
"github.com/Azure/azure-service-operator/v2/pkg/genruntime"
1716
)
1817

1918
func Test_AppConfiguration_KeyValue_v1api20240601_CRUD(t *testing.T) {
@@ -26,7 +25,7 @@ func Test_AppConfiguration_KeyValue_v1api20240601_CRUD(t *testing.T) {
2625
tc := globalTestContext.ForTest(t)
2726

2827
rg := tc.CreateTestResourceGroupAndWait()
29-
28+
3029
// Create ConfigurationStore
3130
cs := &appconfig.ConfigurationStore{
3231
ObjectMeta: tc.MakeObjectMeta("confstore"),
@@ -40,7 +39,7 @@ func Test_AppConfiguration_KeyValue_v1api20240601_CRUD(t *testing.T) {
4039
PublicNetworkAccess: to.Ptr(appconfig.ConfigurationStoreProperties_PublicNetworkAccess_Enabled),
4140
},
4241
}
43-
42+
4443
tc.CreateResourceAndWait(cs)
4544

4645
tc.RunParallelSubtests(
@@ -73,33 +72,33 @@ func AppConfiguration_KeyValue_v1api20240601_CRUD(tc *testcommon.KubePerTestCont
7372
keyValue := &appconfig.KeyValue{
7473
ObjectMeta: tc.MakeObjectMetaWithName(keyValueName),
7574
Spec: appconfig.KeyValue_Spec{
76-
AzureName: to.Ptr("MyApp:Settings:TestKey"),
77-
Owner: testcommon.AsOwner(cs),
78-
Value: to.Ptr("TestValue"),
75+
AzureName: "MyApp:Settings:TestKey",
76+
Owner: testcommon.AsOwner(cs),
77+
Value: to.Ptr("TestValue"),
7978
ContentType: to.Ptr("text/plain"),
8079
Tags: map[string]string{
8180
"Environment": "Test",
8281
"Team": "Backend",
8382
},
8483
},
8584
}
86-
85+
8786
tc.CreateResourceAndWait(keyValue)
88-
87+
8988
armId := *keyValue.Status.Id
9089
tc.Expect(keyValue.Status.Key).ToNot(BeNil())
9190
tc.Expect(*keyValue.Status.Key).To(Equal("MyApp:Settings:TestKey"))
9291
tc.Expect(keyValue.Status.Value).ToNot(BeNil())
9392
tc.Expect(*keyValue.Status.Value).To(Equal("TestValue"))
94-
93+
9594
// Update the value
9695
old := keyValue.DeepCopy()
9796
keyValue.Spec.Value = to.Ptr("UpdatedTestValue")
9897
tc.PatchResourceAndWait(old, keyValue)
9998
tc.Expect(*keyValue.Status.Value).To(Equal("UpdatedTestValue"))
100-
99+
101100
tc.DeleteResourceAndWait(keyValue)
102-
101+
103102
// Ensure that the resource was really deleted in Azure
104103
exists, _, err := tc.AzureClient.CheckExistenceWithGetByID(
105104
tc.Ctx,
@@ -116,22 +115,22 @@ func AppConfiguration_Replica_v1api20240601_CRUD(tc *testcommon.KubePerTestConte
116115
replica := &appconfig.Replica{
117116
ObjectMeta: tc.MakeObjectMetaWithName(replicaName),
118117
Spec: appconfig.Replica_Spec{
119-
AzureName: to.Ptr("eastus2-replica"),
118+
AzureName: "eastus2-replica",
120119
Owner: testcommon.AsOwner(cs),
121120
Location: to.Ptr("eastus2"),
122121
},
123122
}
124-
123+
125124
tc.CreateResourceAndWait(replica)
126-
125+
127126
armId := *replica.Status.Id
128127
tc.Expect(replica.Status.Location).ToNot(BeNil())
129128
tc.Expect(*replica.Status.Location).To(Equal("eastus2"))
130129
tc.Expect(replica.Status.Endpoint).ToNot(BeNil())
131130
tc.Expect(replica.Status.ProvisioningState).ToNot(BeNil())
132-
131+
133132
tc.DeleteResourceAndWait(replica)
134-
133+
135134
// Ensure that the resource was really deleted in Azure
136135
exists, _, err := tc.AzureClient.CheckExistenceWithGetByID(
137136
tc.Ctx,
@@ -148,31 +147,31 @@ func AppConfiguration_Snapshot_v1api20240601_CRUD(tc *testcommon.KubePerTestCont
148147
snapshot := &appconfig.Snapshot{
149148
ObjectMeta: tc.MakeObjectMetaWithName(snapshotName),
150149
Spec: appconfig.Snapshot_Spec{
151-
AzureName: to.Ptr("test-snapshot"),
152-
Owner: testcommon.AsOwner(cs),
150+
AzureName: "test-snapshot",
151+
Owner: testcommon.AsOwner(cs),
153152
CompositionType: to.Ptr(appconfig.SnapshotProperties_CompositionType_Key),
154153
Filters: []appconfig.KeyValueFilter{
155154
{
156155
Key: to.Ptr("MyApp:*"),
157156
},
158157
},
159-
RetentionPeriod: to.Ptr("P30D"),
158+
RetentionPeriod: to.Ptr(60 * 60 * 24 * 30), // 30 days
160159
Tags: map[string]string{
161160
"Environment": "Test",
162161
"Purpose": "Testing",
163162
},
164163
},
165164
}
166-
165+
167166
tc.CreateResourceAndWait(snapshot)
168-
167+
169168
armId := *snapshot.Status.Id
170169
tc.Expect(snapshot.Status.CompositionType).ToNot(BeNil())
171170
tc.Expect(snapshot.Status.ProvisioningState).ToNot(BeNil())
172171
tc.Expect(snapshot.Status.ItemsCount).ToNot(BeNil())
173-
172+
174173
tc.DeleteResourceAndWait(snapshot)
175-
174+
176175
// Ensure that the resource was really deleted in Azure
177176
exists, _, err := tc.AzureClient.CheckExistenceWithGetByID(
178177
tc.Ctx,

v2/samples/appconfiguration/v1api20240601/v1api20240601_keyvalue_with_configmap.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

v2/samples/appconfiguration/v1api20240601/v1api20240601_snapshot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ spec:
1313
label: "production"
1414
- key: "MyApp:Features:*"
1515
label: "production"
16-
retentionPeriod: "P30D"
16+
retentionPeriod: 2592000 # 30 days in seconds
1717
tags:
1818
Environment: "Production"
1919
Version: "v1.0.0"

0 commit comments

Comments
 (0)