Skip to content

Commit 33cf815

Browse files
authored
Testing composite index queries against production (#11865)
1 parent 40025e5 commit 33cf815

File tree

11 files changed

+492
-75
lines changed

11 files changed

+492
-75
lines changed

.github/workflows/firestore.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,40 @@ jobs:
179179
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/firestore.plist.gpg \
180180
Firestore/Example/App/GoogleService-Info.plist "$plist_secret"
181181

182+
- name: Install Google Service Account key
183+
run: |
184+
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/firestore-integration.json.gpg \
185+
google-service-account.json "$plist_secret"
186+
187+
# create composite indexes with Terraform
188+
- name: Set up Google Cloud SDK
189+
uses: google-github-actions/setup-gcloud@v1
190+
- name: Setup Terraform
191+
uses: hashicorp/setup-terraform@v2
192+
- name: Terraform Init
193+
run: |
194+
cd Firestore
195+
terraform init
196+
- name: Terraform Apply
197+
run: |
198+
cd Firestore
199+
200+
# Define a temporary file, redirect both stdout and stderr to it
201+
output_file=$(mktemp)
202+
if ! terraform apply -var-file=../google-service-account.json -auto-approve > "$output_file" 2>&1 ; then
203+
cat "$output_file"
204+
if cat "$output_file" | grep -q "index already exists"; then
205+
echo "==================================================================================="
206+
echo "Terraform apply failed due to index already exists; We can safely ignore this error."
207+
echo "==================================================================================="
208+
fi
209+
exit 1
210+
fi
211+
rm -f "$output_file"
212+
env:
213+
GOOGLE_APPLICATION_CREDENTIALS: ../google-service-account.json
214+
continue-on-error: true
215+
182216
- name: Setup build
183217
run: scripts/install_prereqs.sh Firestore ${{ runner.os }} cmake
184218

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,9 @@ FirebaseAppCheck/Apps/AppCheckCustomProvideApp/AppCheckCustomProvideApp/GoogleSe
156156
/Example/FirestoreSample/ui-debug.log
157157
/Example/FirestoreSample/firestore-debug.log
158158
/Example/FirestoreSample/firebase-debug.log
159+
160+
# generated Terraform docs
161+
.terraform/*
162+
.terraform.lock.hcl
163+
*.tfstate
164+
*.tfstate.*

Firestore/Example/Firestore.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@
246246
23EFC681986488B033C2B318 /* leveldb_opener_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 75860CD13AF47EB1EA39EC2F /* leveldb_opener_test.cc */; };
247247
2403890A78D7AB099754A18C /* bloom_filter.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1E0C7C0DCD2790019E66D8CC /* bloom_filter.pb.cc */; };
248248
2428E92E063EBAEA44BA5913 /* target_index_matcher_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 63136A2371C0C013EC7A540C /* target_index_matcher_test.cc */; };
249+
242BC62992ACC1A5B142CD4A /* FIRCompositeIndexQueryTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65AF0AB593C3AD81A1F1A57E /* FIRCompositeIndexQueryTests.mm */; };
249250
248DE4F56DD938F4DBCCF39B /* bundle_reader_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 6ECAF7DE28A19C69DF386D88 /* bundle_reader_test.cc */; };
250251
24B75C63BDCD5551B2F69901 /* testing_hooks_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = A002425BC4FC4E805F4175B6 /* testing_hooks_test.cc */; };
251252
24CB39421C63CD87242B31DF /* bundle_reader_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 6ECAF7DE28A19C69DF386D88 /* bundle_reader_test.cc */; };
@@ -1050,6 +1051,7 @@
10501051
9CC32ACF397022BB7DF11B52 /* Validation_BloomFilterTest_MD5_500_0001_bloom_filter_proto.json in Resources */ = {isa = PBXBuildFile; fileRef = D22D4C211AC32E4F8B4883DA /* Validation_BloomFilterTest_MD5_500_0001_bloom_filter_proto.json */; };
10511052
9CE07BAAD3D3BC5F069D38FE /* grpc_streaming_reader_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = B6D964922154AB8F00EB9CFB /* grpc_streaming_reader_test.cc */; };
10521053
9D71628E38D9F64C965DF29E /* FSTAPIHelpers.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5492E04E202154AA00B64F25 /* FSTAPIHelpers.mm */; };
1054+
9E1997789F19BF2E9029012E /* FIRCompositeIndexQueryTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65AF0AB593C3AD81A1F1A57E /* FIRCompositeIndexQueryTests.mm */; };
10531055
9E656F4FE92E8BFB7F625283 /* to_string_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = B696858D2214B53900271095 /* to_string_test.cc */; };
10541056
9EE1447AA8E68DF98D0590FF /* precondition_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 549CCA5520A36E1F00BCEB75 /* precondition_test.cc */; };
10551057
9EE81B1FB9B7C664B7B0A904 /* resume_token_spec_test.json in Resources */ = {isa = PBXBuildFile; fileRef = 54DA12A41F315EE100DD57A1 /* resume_token_spec_test.json */; };
@@ -1318,6 +1320,7 @@
13181320
C9F96C511F45851D38EC449C /* status.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 618BBE9920B89AAC00B5BCE7 /* status.pb.cc */; };
13191321
CA2392732BA7F8985699313D /* Validation_BloomFilterTest_MD5_1_1_membership_test_result.json in Resources */ = {isa = PBXBuildFile; fileRef = 3369AC938F82A70685C5ED58 /* Validation_BloomFilterTest_MD5_1_1_membership_test_result.json */; };
13201322
CA989C0E6020C372A62B7062 /* testutil.cc in Sources */ = {isa = PBXBuildFile; fileRef = 54A0352820A3B3BD003E0143 /* testutil.cc */; };
1323+
CAEA2A42D3120B48C6EE39E8 /* FIRCompositeIndexQueryTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65AF0AB593C3AD81A1F1A57E /* FIRCompositeIndexQueryTests.mm */; };
13211324
CAFB1E0ED514FEF4641E3605 /* log_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 54C2294E1FECABAE007D065B /* log_test.cc */; };
13221325
CB2C731116D6C9464220626F /* FIRQueryUnitTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = FF73B39D04D1760190E6B84A /* FIRQueryUnitTests.mm */; };
13231326
CB8BEF34CC4A996C7BE85119 /* persistence_testing.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9113B6F513D0473AEABBAF1F /* persistence_testing.cc */; };
@@ -1890,6 +1893,7 @@
18901893
62E54B832A9E910A003347C8 /* IndexingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IndexingTests.swift; sourceTree = "<group>"; };
18911894
63136A2371C0C013EC7A540C /* target_index_matcher_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = target_index_matcher_test.cc; sourceTree = "<group>"; };
18921895
64AA92CFA356A2360F3C5646 /* filesystem_testing.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = filesystem_testing.h; sourceTree = "<group>"; };
1896+
65AF0AB593C3AD81A1F1A57E /* FIRCompositeIndexQueryTests.mm */ = {isa = PBXFileReference; includeInIndex = 1; path = FIRCompositeIndexQueryTests.mm; sourceTree = "<group>"; };
18931897
67786C62C76A740AEDBD8CD3 /* FSTTestingHooks.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = FSTTestingHooks.h; sourceTree = "<group>"; };
18941898
69E6C311558EC77729A16CF1 /* Pods-Firestore_Example_iOS-Firestore_SwiftTests_iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Firestore_Example_iOS-Firestore_SwiftTests_iOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Firestore_Example_iOS-Firestore_SwiftTests_iOS/Pods-Firestore_Example_iOS-Firestore_SwiftTests_iOS.debug.xcconfig"; sourceTree = "<group>"; };
18951899
6A7A30A2DB3367E08939E789 /* bloom_filter.pb.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = bloom_filter.pb.h; sourceTree = "<group>"; };
@@ -2995,6 +2999,7 @@
29952999
EF6C285029E462A200A7D4F1 /* FIRAggregateTests.mm */,
29963000
73866A9F2082B069009BB4FF /* FIRArrayTransformTests.mm */,
29973001
776530F066E788C355B78457 /* FIRBundlesTests.mm */,
3002+
65AF0AB593C3AD81A1F1A57E /* FIRCompositeIndexQueryTests.mm */,
29983003
129A369928CA555B005AE7E2 /* FIRCountTests.mm */,
29993004
5492E070202154D600B64F25 /* FIRCursorTests.mm */,
30003005
5492E06C202154D500B64F25 /* FIRDatabaseTests.mm */,
@@ -4523,6 +4528,7 @@
45234528
95ED06D2B0078D3CDB821B68 /* FIRArrayTransformTests.mm in Sources */,
45244529
DB3ADDA51FB93E84142EA90D /* FIRBundlesTests.mm in Sources */,
45254530
0500A324CEC854C5B0CF364C /* FIRCollectionReferenceTests.mm in Sources */,
4531+
CAEA2A42D3120B48C6EE39E8 /* FIRCompositeIndexQueryTests.mm in Sources */,
45264532
129A369C28CA555B005AE7E2 /* FIRCountTests.mm in Sources */,
45274533
EC160876D8A42166440E0B53 /* FIRCursorTests.mm in Sources */,
45284534
EA38690795FBAA182A9AA63E /* FIRDatabaseTests.mm in Sources */,
@@ -4762,6 +4768,7 @@
47624768
660E99DEDA0A6FC1CCB200F9 /* FIRArrayTransformTests.mm in Sources */,
47634769
AE068EDBC74AF27679CCB6DA /* FIRBundlesTests.mm in Sources */,
47644770
BA0BB02821F1949783C8AA50 /* FIRCollectionReferenceTests.mm in Sources */,
4771+
9E1997789F19BF2E9029012E /* FIRCompositeIndexQueryTests.mm in Sources */,
47654772
129A369B28CA555B005AE7E2 /* FIRCountTests.mm in Sources */,
47664773
A55266E6C986251D283CE948 /* FIRCursorTests.mm in Sources */,
47674774
7DD67E9621C52B790E844B16 /* FIRDatabaseTests.mm in Sources */,
@@ -5248,6 +5255,7 @@
52485255
73866AA12082B0A5009BB4FF /* FIRArrayTransformTests.mm in Sources */,
52495256
4B54FA587C7107973FD76044 /* FIRBundlesTests.mm in Sources */,
52505257
7BCC5973C4F4FCC272150E31 /* FIRCollectionReferenceTests.mm in Sources */,
5258+
242BC62992ACC1A5B142CD4A /* FIRCompositeIndexQueryTests.mm in Sources */,
52515259
129A369A28CA555B005AE7E2 /* FIRCountTests.mm in Sources */,
52525260
5492E079202154D600B64F25 /* FIRCursorTests.mm in Sources */,
52535261
5492E075202154D600B64F25 /* FIRDatabaseTests.mm in Sources */,

0 commit comments

Comments
 (0)