Skip to content

Add new smoke tests #296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed

Add new smoke tests #296

wants to merge 4 commits into from

Conversation

allisonbm92
Copy link
Contributor

This pull request adds the first batch of new tests. These tests replace the test apps for Database, Firestore, and Storage.

The README briefly outlines how these tests are intended to function. A few more tests will be added in the next few weeks.

These tests currently only support previously released versions of Firebase. This will change when we add our artifact repository.

This commit adds the first batch of new tests. These tests replace the
test apps for Database, Firestore, and Storage.
@googlebot googlebot added the cla: yes Override cla label Mar 20, 2019
@allisonbm92 allisonbm92 requested a review from yifanyang March 20, 2019 19:59
@allisonbm92 allisonbm92 changed the title Allison smoke tests Add new smoke tests Mar 20, 2019
TaskChannel<Foo> channel = new TaskChannel<>();
MainThread.run(() -> test_foo(channel));

Foo foo = channel.waitForSuccess();
Copy link
Contributor

Choose a reason for hiding this comment

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

With this model, the bytecode to be run in the test channel is still going to be in the test APK and (hence) not traditionally proguarded. How do we overcome this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm thinking we probably need to move this to the app APK. I can do this in a follow-up PR.

Copy link
Contributor

@ashwinraghav ashwinraghav left a comment

Choose a reason for hiding this comment

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

Let's chat more in person if the comments do not entirely make sense

// dependencies on the "app" variants.

// Common
implementation "com.android.support.test:runner:1.0.2"
Copy link
Contributor

Choose a reason for hiding this comment

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

Chatted with Allison. We need to understand why these need to be in the implementation configuration

* blocking. Tests may send multiple errors that will then be thrown on the test thread. However, a
* test may only send success once. After this is done, nothing else can be sent.
*/
public abstract class AbstractChannel<T> {
Copy link
Contributor

Choose a reason for hiding this comment

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

The semantics of this seem similar to a Future that resolves either to a value or a failure. Can we reuse?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've rewritten AbstractChannel to be an abstraction over TaskCompletionSource and Task.

@google-oss-bot
Copy link
Contributor

@allisonbm92: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
connected-check-changed 370f2a5 link /test connected-check-changed

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

compileSdkVersion 24

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Copy link
Contributor

Choose a reason for hiding this comment

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

Part of what we need to test is whether our products work with Java7 source compatibility.

}

private void test_ListenForUpdate(DatabaseChannel channel) {
FirebaseAuth auth = FirebaseAuth.getInstance();
Copy link
Contributor

Choose a reason for hiding this comment

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

Continuing from above.
I think the things that we have going for us are

  1. The colocation of test code and code to be tested.
  2. The ability to run part of this in the main thread.
  3. The ability to treat listeners and tasks uniformly.

I feel like the channel abstraction hierarchy forces teams to "learn" an API and can be avoided entirely.
I feel like we should start with verbosity and wait to a pattern to emerge before justifying an API that needs to be learned.
The code below is incomplete (in many ways) and we can talk through whether/if the channel abstraction can be removed.

MainThread.run(new Runnable() {
FirebaseDatabase database = FirebaseDatabase.getInstance();
    database.setPersistenceEnabled(false);
    auth.signOut();
    DatabaseReference baadal = database.getReference("restaurants").child("Baadal");
    setListener(baadal).continueWith(new.....(){
    auth.signInWithEmailAndPassword("[email protected]", "password")
                      baadal.child("location").setValue("Google SVL");
             })
});

Task setListener(query) {
//Some how convert the lister to a Task I can wait on
}

@allisonbm92 allisonbm92 closed this Apr 2, 2019
@allisonbm92 allisonbm92 deleted the allison-smoke-tests branch April 2, 2019 21:27
@firebase firebase locked and limited conversation to collaborators Oct 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants