Skip to content

Add support for -DexclusiveSpecTest=<TestName> to SpecTestCase. #1367

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

Merged
merged 2 commits into from
Mar 19, 2020

Conversation

dconeybe
Copy link
Contributor

No description provided.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Mar 18, 2020

Binary Size Report

Affected SDKs

SDKTypeBase (b58e788)Head (81f3bb7)Diff
firebase-inappmessagingapk (release)?3256660.00? (?)
aar?467661.00? (?)
apk (aggressive)?601315.00? (?)
firebase-common:ktxaar?5965.00? (?)
protolite-well-known-typesapk (release)?561089.00? (?)
aar?1203203.00? (?)
apk (aggressive)?122378.00? (?)
firebase-inappmessaging:ktxaar?5003.00? (?)
firebase-segmentationapk (release)?1667839.00? (?)
aar?35427.00? (?)
apk (aggressive)?1017145.00? (?)
firebase-database:ktxaar?6706.00? (?)
firebase-functions:ktxaar?5844.00? (?)
firebase-storageapk (release)?976604.00? (?)
aar?119257.00? (?)
apk (aggressive)?325620.00? (?)
firebase-commonapk (release)?646638.00? (?)
aar?34517.00? (?)
apk (aggressive)?82949.00? (?)
encoders:firebase-encoders-jsonaar?15334.00? (?)
firebase-firestore:ktxaar?7093.00? (?)
firebase-crashlytics-ndkapk (release)?1931147.00? (?)
aar?598746.00? (?)
apk (aggressive)?1166948.00? (?)
transport:transport-apiaar?6439.00? (?)
transport:transport-backend-cctaar?38343.00? (?)
firebase-inappmessaging-display:ktxaar?22190.00? (?)
firebase-databaseapk (release)?1101570.00? (?)
aar?480458.00? (?)
apk (aggressive)?325609.00? (?)
encoders:firebase-encoders-reflectiveaar?7650.00? (?)
firebase-crashlyticsapk (release)?1348662.00? (?)
aar?378438.00? (?)
apk (aggressive)?580727.00? (?)
transport:transport-runtimeaar?122725.00? (?)
firebase-installationsapk (release)?665533.00? (?)
aar?55060.00? (?)
apk (aggressive)?84597.00? (?)
firebase-config:ktxaar?6162.00? (?)
firebase-dynamic-linksapk (release)?951227.00? (?)
aar?51149.00? (?)
apk (aggressive)?327459.00? (?)
firebase-storage:ktxaar?6143.00? (?)
firebase-installations-interopapk (release)?616109.00? (?)
aar?7509.00? (?)
apk (aggressive)?61714.00? (?)
firebase-componentsapk (release)?25749.00? (?)
aar?34495.00? (?)
apk (aggressive)?10962.00? (?)
firebase-abtapk (release)?746406.00? (?)
aar?35383.00? (?)
apk (aggressive)?85702.00? (?)
firebase-configapk (release)?1143995.00? (?)
aar?214548.00? (?)
apk (aggressive)?395834.00? (?)
firebase-datatransportapk (release)?711399.00? (?)
aar?5041.00? (?)
apk (aggressive)?116358.00? (?)
firebase-dynamic-links:ktxaar?7877.00? (?)
firebase-inappmessaging-displayapk (release)?4520177.00? (?)
aar?165930.00? (?)
apk (aggressive)?1603060.00? (?)
firebase-functionsapk (release)?1178560.00? (?)
aar?25859.00? (?)
apk (aggressive)?393472.00? (?)
firebase-database-collectionapk (release)?912665.00? (?)
aar?34214.00? (?)
apk (aggressive)?313622.00? (?)
firebase-firestoreapk (release)?3140031.00? (?)
aar?1067197.00? (?)
apk (aggressive)?443184.00? (?)
baseapk (release)?8754.00? (?)
apk (aggressive)?10678.00? (?)
Metric Unit: byte

Test Logs

@codecov
Copy link

codecov bot commented Mar 18, 2020

Codecov Report

Merging #1367 into master will decrease coverage by 11.51%.
The diff coverage is n/a.

Flag Coverage Δ Complexity Δ
#Encoders_FirebaseEncodersJson ? ?
#Encoders_FirebaseEncodersProcessor ? ?
#Encoders_FirebaseEncodersReflective ? ?
#FirebaseAbt ? ?
#FirebaseCommon ? ?
#FirebaseCommon_DataCollectionTests ? ?
#FirebaseCommon_Ktx ? ?
#FirebaseComponents ? ?
#FirebaseConfig ? ?
#FirebaseConfig_Ktx ? ?
#FirebaseCrashlytics ? ?
#FirebaseDatabase ? ?
#FirebaseDatabaseCollection ? ?
#FirebaseDatabase_Ktx ? ?
#FirebaseDatatransport ? ?
#FirebaseDynamicLinks ? ?
#FirebaseDynamicLinks_Ktx ? ?
#FirebaseFirestore ? ?
#FirebaseFirestore_Ktx 41.17% <ø> (ø) 0 <ø> (ø) ⬇️
#FirebaseFunctions ? ?
#FirebaseFunctions_Ktx ? ?
#FirebaseInappmessaging ? ?
#FirebaseInappmessagingDisplay ? ?
#FirebaseInappmessagingDisplay_Ktx ? ?
#FirebaseInappmessaging_Ktx ? ?
#FirebaseInstallations ? ?
#FirebaseSegmentation ? ?
#FirebaseStorage ? ?
#FirebaseStorage_Ktx ? ?
#Tools_Errorprone ? ?
#Tools_Lint ? ?
#Transport_TransportBackendCct ? ?
#Transport_TransportRuntime ? ?

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 84ab316...81f3bb7. Read the comment docs.

// -DexclusiveSpecTest=<TestName> to the Java runtime, replacing <TestName> with the name of the
// test to execute exclusively. The <TestName> value is the result of appending the "itName" of
// the test to its "describeName", separated by a space character.
private static final String EXCLUSIVE_PROPERTY = "exclusiveSpecTest";
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think of making this a filter and allowing Regular Expressions? It should maybe add one or two lines to this PR, but make this feature much easier to use (we don't have to specify the full test name) and more flexible (we could run a group of tests).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SGTM. I'll make this change.

@@ -1097,6 +1106,12 @@ public void testSpecTests() throws Exception {
parsedSpecFiles.add(new Pair<>(f.getName(), fileJSON));
}

String exclusiveTestNameFromSystemProperty =
emptyToNull(System.getProperty(EXCLUSIVE_PROPERTY));
Copy link
Contributor

Choose a reason for hiding this comment

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

If you go with regular expression approach, this could be System.getProperty(EXCLUSIVE_PROPERTY, ".*"), in which case you can always apply the filter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This won't work though because I need to be able to distinguish between the property being set or not being set. The reason is that if it is set then exclusiveMode must be set to true and if it is not then it must be left alone. By using a default value I cannot know if .* was specified explicitly or was the default value.

@@ -14,6 +14,7 @@

package com.google.firebase.firestore.spec;

import static com.google.common.base.Strings.emptyToNull;
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian Mar 18, 2020

Choose a reason for hiding this comment

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

We should try not to import more Guava dependencies, unless we want to make an exception for tests (cc @wu-hui).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my opinion, and exception for tests makes a lot of sense since there are no downstream dependencies on the test artifacts that could result in dependency mismatch conflicts. Moreover, this class already imports com.google.common.collect.Sets from guava, so this is not a net new dependency on guava.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am OK to import Guava in tests.

And thanks for adding this, will be really handy to try to debug a specific test.

@google-oss-bot
Copy link
Contributor

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

Test name Commit Details Rerun command
check-changed 81f3bb7 link /test 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.

Copy link
Contributor

@schmidt-sebastian schmidt-sebastian left a comment

Choose a reason for hiding this comment

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

LGTM. If you feel like it, I think we

} else if (tags.contains(EXCLUSIVE_TAG)) {
runTest = true;
} else if (testNameFilter != null) {
runTest = testNameFilter.matcher(name).find();
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian Mar 18, 2020

Choose a reason for hiding this comment

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

Optional: This could just be

} else {
 runTest = testNameMatcher.matches(find);
}

@@ -1097,6 +1109,16 @@ public void testSpecTests() throws Exception {
parsedSpecFiles.add(new Pair<>(f.getName(), fileJSON));
}

String testNameFilterFromSystemProperty =
emptyToNull(System.getProperty(TEST_FILTER_PROPERTY));
Pattern testNameFilter;
Copy link
Contributor

Choose a reason for hiding this comment

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

You should turn this into a Matcher right away, like such:

 if (testNameFilterFromSystemProperty == null) {
      testNameFilterFromSystemProperty = ".*";
 } else {
      exclusiveMode = true;
 }
 Matcher testNameMatcher = Pattern.compile(testNameFilterFromSystemProperty).matcher();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A Matcher object must be created with a string against which to match. So we must create a new Matcher object for each test name.
https://developer.android.com/reference/java/util/regex/Pattern#matcher(java.lang.CharSequence)

@dconeybe dconeybe merged commit f79cf6b into master Mar 19, 2020
@dconeybe dconeybe deleted the dconeybe/SpecExclusiveFlag branch March 19, 2020 13:55
@dconeybe
Copy link
Contributor Author

Thank you for the review, @schmidt-sebastian!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Override cla size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants