-
Notifications
You must be signed in to change notification settings - Fork 624
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
Add new smoke tests #296
Conversation
This commit adds the first batch of new tests. These tests replace the test apps for Database, Firestore, and Storage.
TaskChannel<Foo> channel = new TaskChannel<>(); | ||
MainThread.run(() -> test_foo(channel)); | ||
|
||
Foo foo = channel.waitForSuccess(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this 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" |
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
smoke-tests/src/androidTest/java/com/google/firebase/testing/common/TaskChannel.java
Show resolved
Hide resolved
smoke-tests/src/androidTest/java/com/google/firebase/testing/common/AbstractChannel.java
Outdated
Show resolved
Hide resolved
smoke-tests/src/androidTest/java/com/google/firebase/testing/common/AbstractChannel.java
Outdated
Show resolved
Hide resolved
smoke-tests/src/androidTestDatabase/java/com/google/firebase/testing/database/DatabaseTest.java
Show resolved
Hide resolved
@allisonbm92: The following test failed, say
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 |
There was a problem hiding this comment.
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.
smoke-tests/src/androidTest/java/com/google/firebase/testing/common/TaskChannel.java
Show resolved
Hide resolved
} | ||
|
||
private void test_ListenForUpdate(DatabaseChannel channel) { | ||
FirebaseAuth auth = FirebaseAuth.getInstance(); |
There was a problem hiding this comment.
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
- The colocation of test code and code to be tested.
- The ability to run part of this in the main thread.
- 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
}
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.