Skip to content

Conversation

@jonsimantov
Copy link
Contributor

@jonsimantov jonsimantov commented Mar 22, 2021

Overview

This PR adds the Firestore internal integration tests to the "Integration Tests" workflow when building against source. Additionally, it adds iOS and Android support for those tests. (A number of tests were modified or skipped due to issues; these will be fixed in a future PR.)

Removes tests from the old location in firestore/src/tests. If any of these integration tests can actually just be run as unit tests (e.g. they don't talk to the actual Firestore backend), they can be moved back into firestore/src/tests at some point in the future.

Increased test timeout from 5 minutes to 15 minutes across the board, since Firestore tests take much longer.

build_testapps.py

Now will build the internal integration test instead of the regular one, if there is one available and we are building against the source SDK. (The packaged SDK cannot test the internal APIs, so will only test the regular test.)

Because we build and run the internal test INSTEAD of the regular test, the internal test duplicates the regular test's main source file in addition to the bevy of additional tests it runs. This ensures that those tests still pass even when testing against source.

Android support

Built + tested on Android device. Several tests have issues, probably due to JNI and threads (the tests now run in a background thread). Those tests have been marked as skipped.

On Android, because we don't compile the Firestore core library, we bring in absl manually, as the tests themselves require absl.

iOS support

Built + tested on iOS device. Several tests (notably transaction_extra_test) time out on iOS and have been skipped.

A few changes are required to build these tests, in particular the XCode project tool needs to add the SDK directory to the header search paths so that the tests can include internal SDK headers.

Windows

A number of fixes for paths being too long and preprocessor issues.

@google-cla google-cla bot added the cla: yes label Mar 22, 2021
@jonsimantov jonsimantov added the tests-requested: quick Trigger a quick set of integration tests. label Mar 22, 2021
@github-actions github-actions bot added tests: in-progress This PR's integration tests are in progress. tests: failed This PR's integration tests failed. and removed tests-requested: quick Trigger a quick set of integration tests. labels Mar 22, 2021
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label Mar 22, 2021
@jonsimantov jonsimantov added the tests-requested: quick Trigger a quick set of integration tests. label Mar 22, 2021
@github-actions github-actions bot added tests: in-progress This PR's integration tests are in progress. tests: failed This PR's integration tests failed. and removed tests-requested: quick Trigger a quick set of integration tests. tests: failed This PR's integration tests failed. labels Mar 22, 2021
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label Mar 22, 2021
Make sure the internal integration test includes the external one.
@github-actions github-actions bot removed the tests: failed This PR's integration tests failed. label Mar 23, 2021
@jonsimantov jonsimantov requested a review from DellaBitta March 23, 2021 18:21
@github-actions github-actions bot added the tests: failed This PR's integration tests failed. label Mar 23, 2021
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label Mar 23, 2021
@jonsimantov jonsimantov added the tests-requested: quick Trigger a quick set of integration tests. label Mar 23, 2021
@github-actions github-actions bot added tests: in-progress This PR's integration tests are in progress. tests: failed This PR's integration tests failed. and removed tests-requested: quick Trigger a quick set of integration tests. tests: failed This PR's integration tests failed. labels Mar 23, 2021
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label Mar 24, 2021
Copy link
Contributor

@DellaBitta DellaBitta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits.

IMPORTANT: This file is used by both the regular and the internal Firestore
integration tests, and needs to be present and identical in both.
Please sure that any changes to this file are reflected in both of its locations:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "ensure"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

# Firestore's internal integration test requires absl on Android,
# so download it now.
set(ABSEIL_CPP_ROOT ${CMAKE_CURRENT_LIST_DIR}/external/abseil-cpp/src/abseil-cpp)
if (NOT EXISTS ${ABSEIL_CPP_ROOT}/absl/base/attributes.h)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be done on just a directory so that it's less fragile?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


constexpr char kClassName[] =
PROGUARD_KEEP_CLASS "com/google/android/gms/tasks/CancellationTokenSource";
"com/google/android/gms/tasks/CancellationTokenSource";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this note for your review to ensure this change was intended and proguard isn't required anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, PROGUARD_KEEP_CLASS is only Proguarding classes referenced by our SDK, not by the testapp itself. I moved those to the proguard.pro in the testapp.

#include "firebase/firestore/firestore_errors.h"
#include "app_framework.h"
#include "firebase_test_framework.h"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: shouldn't these includes be alphabetized?

#include "android/firestore_integration_test_android.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "firebase_test_framework.h"
Copy link
Contributor

@DellaBitta DellaBitta Mar 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: and alphabetize here.

Edit: Oh, are these additions we're making or changes we're inheriting from the Firestore repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

firebase_test_framework and app_framework are additions (so that we can run their tests in our own test framework). All other includes are inherited. I'll hold off on alphabetizing these files until we can set up code formatting and alphabetize all.

@entitlement_path = entitlement_path
end
opts.on('-i', '--XCodeCPP.include [include_path]',
'Path to additional header search files (optional)') do |include_path|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this is confusing. Should it be like above, "Path to additional include files (optional)" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@jonsimantov jonsimantov requested a review from DellaBitta March 24, 2021 18:23
@jonsimantov jonsimantov added the tests-requested: quick Trigger a quick set of integration tests. label Mar 24, 2021
@jonsimantov jonsimantov enabled auto-merge (squash) March 24, 2021 18:25
@github-actions github-actions bot added tests: in-progress This PR's integration tests are in progress. and removed tests-requested: quick Trigger a quick set of integration tests. tests: failed This PR's integration tests failed. labels Mar 24, 2021
@github-actions
Copy link

github-actions bot commented Mar 24, 2021

❌  Integration test FAILED

Requested by @jonsimantov on commit 2015cd6
Last updated: Wed Mar 24 14:05:17 PDT 2021
View integration test results

Platform Build failures Test failures
MacOS iOS auth
Ubuntu Desktop OpenSSL firestore
Windows Android database, firestore
Windows Desktop OpenSSL firestore

@github-actions github-actions bot added the tests: failed This PR's integration tests failed. label Mar 24, 2021
@jonsimantov jonsimantov removed tests: failed This PR's integration tests failed. tests: in-progress This PR's integration tests are in progress. labels Mar 24, 2021
@jonsimantov jonsimantov merged commit 9ec22a9 into main Mar 24, 2021
@github-actions github-actions bot added the tests: failed This PR's integration tests failed. label Mar 24, 2021
@jonsimantov jonsimantov deleted the feature/merge-firestore-test-trigger branch March 30, 2021 20:10
@firebase firebase locked and limited conversation to collaborators Apr 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes tests: failed This PR's integration tests failed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants