Skip to content

Commit 3990d4c

Browse files
authored
Quick check uses dummy google-services file, and skip certain tests (#705)
1 parent f82c423 commit 3990d4c

File tree

7 files changed

+76
-3
lines changed

7 files changed

+76
-3
lines changed

.github/workflows/desktop.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,6 @@ jobs:
310310
- name: Prepare for integration tests
311311
run: |
312312
pip install -r scripts/gha/requirements.txt
313-
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
314313
- name: Install OpenSSL
315314
run: |
316315
sudo apt install openssl
@@ -325,7 +324,8 @@ jobs:
325324
--output_directory "${{ github.workspace }}" \
326325
--artifact_name "desktop-ubuntu-latest-openssl" \
327326
--noadd_timestamp \
328-
--short_output_paths
327+
--short_output_paths \
328+
--cmake_flag=-DFIREBASE_QUICK_TEST=ON
329329
- name: Summarize build results
330330
if: ${{ !cancelled() }}
331331
shell: bash
@@ -343,7 +343,7 @@ jobs:
343343
npm install -g firebase-tools
344344
- name: Run Desktop integration tests
345345
run: |
346-
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}" --artifact testapps-desktop-ubuntu-latest-openssl
346+
cp scripts/gha/integration_testing/google-services.json testapps-desktop-ubuntu-latest-openssl/firestore/google-services.json
347347
firebase emulators:exec --only firestore --project demo-example 'python scripts/gha/desktop_tester.py --testapp_dir testapps-desktop-ubuntu-latest-openssl --logfile_name "desktop-ubuntu-latest-openssl"'
348348
env:
349349
USE_FIRESTORE_EMULATOR: true

CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ option(FIREBASE_USE_LINUX_CXX11_ABI
7878
option(FIREBASE_GITHUB_ACTION_BUILD
7979
"Indicates that this build was created from a GitHub Action" OFF)
8080

81+
option(FIREBASE_QUICK_TEST
82+
"Enable quick tests will skip tests which requires access to the SECRET" OFF)
83+
8184
set(FIREBASE_ANDROID_STL "" CACHE STRING "STL implementation to use.")
8285
if (NOT FIREBASE_ANDROID_STL STREQUAL "")
8386
set(ANDROID_STL ${FIREBASE_ANDROID_STL})

app/CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,13 @@ target_compile_definitions(firebase_app
347347
-DINTERNAL_EXPERIMENTAL=1
348348
)
349349

350+
if(FIREBASE_QUICK_TEST)
351+
target_compile_definitions(firebase_app
352+
PUBLIC
353+
QUICK_CHECK
354+
)
355+
endif()
356+
350357
# firebase_app has a dependency on flatbuffers, which needs to be included.
351358
target_link_libraries(firebase_app
352359
PRIVATE

firestore/integration_test_internal/src/firestore_test.cc

+1
Original file line numberDiff line numberDiff line change
@@ -1462,6 +1462,7 @@ TEST_F(FirestoreIntegrationTest, DomainObjectsReferToSameFirestoreInstance) {
14621462
}
14631463

14641464
TEST_F(FirestoreIntegrationTest, AuthWorks) {
1465+
SKIP_TEST_ON_QUICK_CHECK;
14651466
// This app instance is managed by the text fixture.
14661467
App* app = GetApp();
14671468
EXPECT_NE(app, nullptr);

firestore/integration_test_internal/src/integration_test.cc

+9
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ TEST_F(FirebaseFirestoreBasicTest, TestInitializeAndTerminate) {
345345
}
346346

347347
TEST_F(FirebaseFirestoreBasicTest, TestSignIn) {
348+
SKIP_TEST_ON_QUICK_CHECK;
348349
EXPECT_NE(shared_auth_->current_user(), nullptr);
349350
}
350351

@@ -385,6 +386,7 @@ TEST_F(FirebaseFirestoreBasicTest, TestDocument) {
385386
}
386387

387388
TEST_F(FirebaseFirestoreBasicTest, TestSetGet) {
389+
SKIP_TEST_ON_QUICK_CHECK;
388390
SignIn();
389391

390392
firebase::firestore::DocumentReference document = Doc();
@@ -405,6 +407,7 @@ TEST_F(FirebaseFirestoreBasicTest, TestSetGet) {
405407
}
406408

407409
TEST_F(FirebaseFirestoreBasicTest, TestSetUpdateGet) {
410+
SKIP_TEST_ON_QUICK_CHECK;
408411
SignIn();
409412

410413
firebase::firestore::DocumentReference document = Doc();
@@ -429,6 +432,7 @@ TEST_F(FirebaseFirestoreBasicTest, TestSetUpdateGet) {
429432
}
430433

431434
TEST_F(FirebaseFirestoreBasicTest, TestSetDelete) {
435+
SKIP_TEST_ON_QUICK_CHECK;
432436
SignIn();
433437

434438
firebase::firestore::DocumentReference document = Doc();
@@ -450,6 +454,7 @@ TEST_F(FirebaseFirestoreBasicTest, TestSetDelete) {
450454
}
451455

452456
TEST_F(FirebaseFirestoreBasicTest, TestDocumentListener) {
457+
SKIP_TEST_ON_QUICK_CHECK;
453458
SignIn();
454459

455460
firebase::firestore::DocumentReference document = Doc();
@@ -489,6 +494,7 @@ TEST_F(FirebaseFirestoreBasicTest, TestDocumentListener) {
489494
}
490495

491496
TEST_F(FirebaseFirestoreBasicTest, TestBatchWrite) {
497+
SKIP_TEST_ON_QUICK_CHECK;
492498
SignIn();
493499

494500
firebase::firestore::DocumentReference document1 = Doc("1");
@@ -518,6 +524,7 @@ TEST_F(FirebaseFirestoreBasicTest, TestBatchWrite) {
518524
}
519525

520526
TEST_F(FirebaseFirestoreBasicTest, TestRunTransaction) {
527+
SKIP_TEST_ON_QUICK_CHECK;
521528
SignIn();
522529

523530
WaitForCompletion(
@@ -603,6 +610,7 @@ TEST_F(FirebaseFirestoreBasicTest, TestRunTransaction) {
603610
// TODO: Add test for failing transaction.
604611

605612
TEST_F(FirebaseFirestoreBasicTest, TestQuery) {
613+
SKIP_TEST_ON_QUICK_CHECK;
606614
SignIn();
607615

608616
firebase::firestore::CollectionReference collection = GetTestCollection();
@@ -665,6 +673,7 @@ TEST_F(FirebaseFirestoreBasicTest,
665673
}
666674

667675
TEST_F(FirebaseFirestoreBasicTest, TestInvalidatingReferencesWhenDeletingApp) {
676+
SKIP_TEST_ON_QUICK_CHECK;
668677
delete shared_app_;
669678
shared_app_ = nullptr;
670679
// TODO: Ensure existing Firestore objects are invalidated.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"project_info": {
3+
"project_number": "1",
4+
"firebase_url": "1",
5+
"project_id": "cpp-firestore-test-app",
6+
"storage_bucket": "1"
7+
},
8+
"client": [
9+
{
10+
"client_info": {
11+
"mobilesdk_app_id": "1",
12+
"android_client_info": {
13+
"package_name": "1"
14+
}
15+
},
16+
"oauth_client": [
17+
{
18+
"client_id": "1",
19+
"client_type": 3
20+
}
21+
],
22+
"api_key": [
23+
{
24+
"current_key": "1"
25+
}
26+
],
27+
"services": {
28+
"analytics_service": {
29+
"status": 1
30+
},
31+
"appinvite_service": {
32+
"status": 1,
33+
"other_platform_oauth_client": []
34+
},
35+
"ads_service": {
36+
"status": 2
37+
}
38+
}
39+
}
40+
],
41+
"configuration_version": "1"
42+
}

testing/test_framework/src/firebase_test_framework.h

+11
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,17 @@ namespace firebase_test_framework {
178178
#define SKIP_TEST_IF_USING_STLPORT ((void)0)
179179
#endif // defined(STLPORT)
180180

181+
#if defined(QUICK_CHECK)
182+
#define SKIP_TEST_ON_QUICK_CHECK \
183+
{ \
184+
app_framework::LogInfo("Skipping %s on quick check.", test_info_->name()); \
185+
GTEST_SKIP(); \
186+
return; \
187+
}
188+
#else
189+
#define SKIP_TEST_ON_QUICK_CHECK ((void)0)
190+
#endif // defined(QUICK_CHECK)
191+
181192
#define KNOWN_FAILURE(explanation) \
182193
{ FAIL() << test_info_->name() << " has a known failure: " << explanation; }
183194

0 commit comments

Comments
 (0)