Skip to content

Conversation

@AliSoftware
Copy link
Contributor

@AliSoftware AliSoftware commented Aug 18, 2022

Why?

After migrating the code able to trigger Firebase Test Lab from CircleCI and our related CircleCI orb to move it to a fastlane action in release-toolkit during the Buildkite migration, we forgot to add an option to filter the test targets, like we had and used to use in e.g. WordPress Android to exclude screenshots from the instrumented/connected tests

How

Add an optional test_targets parameter (aka ConfigItem) to the android_firebase_test action which is then passed to the invocation of gcloud

To test

The unit tests (spec/firebase_test_runner_spec.rb) have been updated to cover for cases with or without a test_targets parameter being provided, and for testing the proper escaping of the filter if one is provided.
So if CI is green, it should be all good to go.

What's next

To workaround the fact that we couldn't filter the test targets during instrumented tests, @pachlava had to temporarily @Ignore the Screenshot tests in WordPress Android (wordpress-mobile/WordPress-Android#16970).

Once this lands, we should then:

@AliSoftware AliSoftware self-assigned this Aug 18, 2022
@AliSoftware AliSoftware marked this pull request as ready for review August 18, 2022 17:22
@AliSoftware AliSoftware requested review from a team, jkmassel and pachlava August 18, 2022 17:22
Copy link
Contributor

@spencertransier spencertransier left a comment

Choose a reason for hiding this comment

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

Approved with just a curious question from me about one of the changes 🙂

Comment on lines +36 to +37
}.compact.flat_map { |k, v| ["--#{k}", v] }
command = Shellwords.join(['gcloud', 'firebase', 'test', 'android', 'run', *params])
Copy link
Contributor

Choose a reason for hiding this comment

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

@AliSoftware Can you explain the benefits of switching to this syntax from the previous syntax? I'm not questioning it, just curious 😃

Copy link
Contributor Author

@AliSoftware AliSoftware Aug 18, 2022

Choose a reason for hiding this comment

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

This syntax allowed me to inject the compact call on the Hash before transforming it into an array of key-value-pairs.

The effect of that .compact is to remove any entry from the Hash with a nil value, which was necessary to completely remove --test-targets <value> from the params if the user didn't provide any value for it. Otherwise we'd be passing --test-targets "" (or actually even worse, just --test-targets without a corresponding value next to it) to the gcloud command, instead of skipping that param entirely when it's not provided by the user.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense, thank you for explaining!

@pachlava
Copy link

Thank you for this PR @AliSoftware! ⭐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants