Skip to content

Commit 7f8858b

Browse files
Merge pull request #5431 from justinsb/firestoreindex_enable_mock_testing
FirestoreIndex: cleanup fixture tests
2 parents b2a5a32 + 6038c6b commit 7f8858b

File tree

14 files changed

+546
-362
lines changed

14 files changed

+546
-362
lines changed

config/tests/samples/create/harness.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ func NewHarness(ctx context.Context, t *testing.T, opts ...HarnessOption) *Harne
485485
testgcp.TestDependentNoNetworkProjectID.Set("mock-project")
486486
testgcp.TestDependentOrgProjectID.Set("example-project-01")
487487
testgcp.TestDependentFolderProjectID.Set("example-project-02")
488-
testgcp.FirestoreTestProject.Set("cnrm-test-firestore")
489488
testgcp.IdentityPlatformTestProject.Set("kcc-identity-platform")
490489
testgcp.RecaptchaEnterpriseTestProject.Set("kcc-recaptcha-enterprise")
491490

@@ -534,7 +533,6 @@ func NewHarness(ctx context.Context, t *testing.T, opts ...HarnessOption) *Harne
534533
}
535534
testgcp.TestDependentOrgProjectID.Set("example-project-01")
536535
testgcp.TestDependentFolderProjectID.Set("example-project-02")
537-
testgcp.FirestoreTestProject.Set("cnrm-test-firestore")
538536
testgcp.IdentityPlatformTestProject.Set("kcc-identity-platform")
539537
testgcp.RecaptchaEnterpriseTestProject.Set("kcc-recaptcha-enterprise")
540538
testgcp.TestOrgID.Set("123450001")
@@ -1000,6 +998,7 @@ func MaybeSkip(t *testing.T, name string, resources []*unstructured.Unstructured
1000998
case schema.GroupKind{Group: "eventarc.cnrm.cloud.google.com", Kind: "EventarcGoogleChannelConfig"}:
1001999

10021000
case schema.GroupKind{Group: "firestore.cnrm.cloud.google.com", Kind: "FirestoreDatabase"}:
1001+
case schema.GroupKind{Group: "firestore.cnrm.cloud.google.com", Kind: "FirestoreIndex"}:
10031002

10041003
case schema.GroupKind{Group: "kms.cnrm.cloud.google.com", Kind: "KMSKeyRing"}:
10051004
case schema.GroupKind{Group: "kms.cnrm.cloud.google.com", Kind: "KMSCryptoKey"}:
@@ -1159,7 +1158,6 @@ func MaybeSkip(t *testing.T, name string, resources []*unstructured.Unstructured
11591158
case "cloudstoragepathstoredinfotype":
11601159
case "dnsrecordset":
11611160
case "eventarctrigger":
1162-
case "firestoreindex":
11631161
case "identityplatformoauthidpconfig":
11641162
case "kmscryptokey":
11651163
case "logginglogview":

mockgcp/mockgcptests/harness.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ func (t *Harness) Init() {
172172
testgcp.TestDependentNoNetworkProjectID.Set("mock-project")
173173
testgcp.TestDependentOrgProjectID.Set("example-project-01")
174174
testgcp.TestDependentFolderProjectID.Set("example-project-02")
175-
testgcp.FirestoreTestProject.Set("cnrm-test-firestore")
176175
testgcp.IdentityPlatformTestProject.Set("kcc-identity-platform")
177176
testgcp.RecaptchaEnterpriseTestProject.Set("kcc-recaptcha-enterprise")
178177

@@ -220,7 +219,6 @@ func (t *Harness) Init() {
220219
// }
221220
// testgcp.TestDependentOrgProjectID.Set("example-project-01")
222221
// testgcp.TestDependentFolderProjectID.Set("example-project-02")
223-
// testgcp.FirestoreTestProject.Set("cnrm-test-firestore")
224222
// testgcp.IdentityPlatformTestProject.Set("kcc-identity-platform")
225223
// testgcp.RecaptchaEnterpriseTestProject.Set("kcc-recaptcha-enterprise")
226224
// testgcp.TestOrgID.Set("123450001")

pkg/test/controller/k8s.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ func ReplaceTestVars(t *testing.T, b []byte, uniqueID string, project testgcp.GC
173173
s = strings.Replace(s, fmt.Sprintf("${%s}", testgcp.IsolatedTestOrgName.Key), testgcp.IsolatedTestOrgName.Get(), -1)
174174
s = strings.Replace(s, fmt.Sprintf("${%s}", testgcp.TestBillingAccountID.Key), testgcp.TestBillingAccountID.Get(), -1)
175175
s = strings.Replace(s, fmt.Sprintf("${%s}", testgcp.TestBillingAccountIDForBillingResources.Key), testgcp.TestBillingAccountIDForBillingResources.Get(), -1)
176-
s = strings.Replace(s, fmt.Sprintf("${%s}", testgcp.FirestoreTestProject.Key), testgcp.FirestoreTestProject.Get(), -1)
177176
s = strings.Replace(s, fmt.Sprintf("${%s}", testgcp.IAMIntegrationTestsBillingAccountID.Key), testgcp.IAMIntegrationTestsBillingAccountID.Get(), -1)
178177
s = strings.Replace(s, fmt.Sprintf("${%s}", testgcp.CloudFunctionsTestProject), testgcp.GetCloudFunctionsTestProject(t), -1)
179178
s = strings.Replace(s, fmt.Sprintf("${%s}", testgcp.IdentityPlatformTestProject.Key), testgcp.IdentityPlatformTestProject.Get(), -1)

pkg/test/gcp/gcp.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ var (
6666
TestAttachedClusterName = EnvVar{Key: "TEST_ATTACHED_CLUSTER_NAME"}
6767
TestKCCAttachedClusterProject = EnvVar{Key: "KCC_ATTACHED_CLUSTER_TEST_PROJECT"}
6868
TestKCCAttachedClusterPlatformVersion = EnvVar{Key: "ATTACHED_CLUSTER_PLATFORM_VERSION"}
69-
FirestoreTestProject = EnvVar{Key: "FIRESTORE_TEST_PROJECT"}
7069
IdentityPlatformTestProject = EnvVar{Key: "IDENTITY_PLATFORM_TEST_PROJECT"}
7170
RecaptchaEnterpriseTestProject = EnvVar{Key: "RECAPTCHA_ENTERPRISE_TEST_PROJECT"}
7271
TestKCCVertexAIIndexBucket = EnvVar{Key: "KCC_VERTEX_AI_INDEX_TEST_BUCKET"}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: firestore.cnrm.cloud.google.com/v1beta1
2+
kind: FirestoreDatabase
3+
metadata:
4+
name: firestoredatabase-${uniqueId}-collectiongroups-sample-collection-${uniqueId}-indexes-${indexID}
5+
spec:
6+
projectRef:
7+
external: projects/${projectId}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
apiVersion: firestore.cnrm.cloud.google.com/v1beta1
2+
kind: FirestoreIndex
3+
metadata:
4+
annotations:
5+
cnrm.cloud.google.com/management-conflict-prevention-policy: none
6+
cnrm.cloud.google.com/project-id: ${projectId}
7+
cnrm.cloud.google.com/state-into-spec: absent
8+
finalizers:
9+
- cnrm.cloud.google.com/finalizer
10+
- cnrm.cloud.google.com/deletion-defender
11+
generation: 1
12+
labels:
13+
cnrm-test: "true"
14+
name: firestoreindex-${uniqueId}
15+
namespace: ${uniqueId}
16+
spec:
17+
collection: sample-collection-${uniqueId}
18+
database: firestoredatabase-${uniqueId}
19+
fields:
20+
- fieldPath: field1
21+
order: ASCENDING
22+
- fieldPath: field2
23+
order: DESCENDING
24+
status:
25+
conditions:
26+
- lastTransitionTime: "1970-01-01T00:00:00Z"
27+
message: The resource is up to date
28+
reason: UpToDate
29+
status: "True"
30+
type: Ready
31+
name: projects/${projectId}/databases/firestoredatabase-${uniqueId}/collectionGroups/sample-collection-${uniqueId}/indexes/${indexID}
32+
observedGeneration: 1

0 commit comments

Comments
 (0)