Skip to content
New issue

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

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

Already on GitHub? # to your account

feat: Implement custom sharding -- iOS #1779

Merged
merged 5 commits into from
Apr 8, 2021

Conversation

pawelpasterz
Copy link
Contributor

Fixes #1665

Detailed documentation

This is the first implementation of the custom sharding feature, below assumptions were made:

  1. flank does not validate provided json -- we trust the user that he/she knows what is doing
  2. sharding-json is the source of truth -- no smart sharding applied
  3. dump shards structure was required to be updated

Test Plan

How do we know the code works?

V1

  1. build flank ./gradlew flankFullRun
  2. create config yml
    gcloud:
      test: [PATH]/EarlGreyExample.zip
      xctestrun-file: [PATH]/EarlGreyExampleSwiftTests.xctestrun
    flank:
      max-test-shards: 2
      disable-results-upload: true
      disable-usage-statistics: true
    
  3. run flank firebase test ios run -c=[YOUR CONFIG] --dump-shards
  4. copy ios_shards.json, rename it and play around with shards, example: add another shard, move tests etc
  5. add sharding-json: [PATH TO YOUR CUSTOM SHARDING JSON] to your config yaml
  6. run flank firebase test ios run -c=[YOUR CONFIG] --dump-shards
  7. observe new sharding in ios_shards.json
  8. run flank firebase test ios run -c=[YOUR CONFIG]
  9. test run should proceed and end normally with sharding that you created

V2

  1. build flank ./gradlew flankFullRun
  2. create config yml
    gcloud:
      test: [PATH]/FlankTestPlansExample.zip
      xctestrun-file: [PATH]/FlankTestPlansExample/AllTests.xctestrun
    flank:
      max-test-shards: 2
      disable-results-upload: true
      disable-usage-statistics: true
    
  3. run flank firebase test ios run -c=[YOUR CONFIG] --dump-shards
  4. copy ios_shards.json, rename it and play around with shards, example: add another shard, move tests etc
  5. add sharding-json: [PATH TO YOUR CUSTOM SHARDING JSON] to your config yaml
  6. run flank firebase test ios run -c=[YOUR CONFIG] --dump-shards
  7. observe new sharding in ios_shards.json
  8. run flank firebase test ios run -c=[YOUR CONFIG]
  9. test run should proceed and end normally with sharding that you created

Checklist

  • Documented
  • Unit tested

@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 2021

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@pawelpasterz
Copy link
Contributor Author

For reference: #1736

@github-actions github-actions bot added Feature New Option Used to track PR with new configuration option (useful when updating fladle) Tiger 🐯 labels Apr 6, 2021
@pawelpasterz pawelpasterz changed the title feat: Implement custom sharding for iOS feat: Implement custom sharding -- iOS Apr 6, 2021
@pawelpasterz pawelpasterz marked this pull request as ready for review April 6, 2021 14:28
@pawelpasterz pawelpasterz requested a review from zuziaka April 6, 2021 14:29
@pawelpasterz pawelpasterz enabled auto-merge (squash) April 6, 2021 14:29
@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 2021

Timestamp: 2021-04-08 15:52:21
Buildscan url for ubuntu-workflow run 730109605

@piotradamczyk5 piotradamczyk5 self-requested a review April 6, 2021 17:26
Copy link
Contributor

@Sloox Sloox left a comment

Choose a reason for hiding this comment

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

minor wording change

@pawelpasterz pawelpasterz force-pushed the 1665-implement-custom-sharding-ios branch from c51e3f0 to 3d8811c Compare April 8, 2021 05:27
@pawelpasterz pawelpasterz requested review from Sloox and zuziaka April 8, 2021 05:30
@bootstraponline bootstraponline force-pushed the 1665-implement-custom-sharding-ios branch from a5003d2 to bbec741 Compare April 8, 2021 14:11
Copy link
Contributor

@Sloox Sloox left a comment

Choose a reason for hiding this comment

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

Minor changes.

@@ -19,7 +19,7 @@ val obfuscatePrettyPrinter = GsonBuilder()
internal object ListOfStringTypeToken : TypeToken<List<String>>()

@VisibleForTesting
internal object ListOfStringListTypeToken : TypeToken<ShardChunks>()
internal object ListOfStringListTypeToken : TypeToken<List<Map<String, List<String>>>>()
Copy link
Contributor

Choose a reason for hiding this comment

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

This change from ShardChunks to List<Map<...>> looks crazy. Is it worth not having another alias here like before?
maybe CustomShardChunks?
WDYT? Worth it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why not! 👍🏻
Personally, I don't like type aliases used as cover for data structures but I think I'm in the minority

@pawelpasterz pawelpasterz requested a review from Sloox April 8, 2021 15:14
@bootstraponline bootstraponline force-pushed the 1665-implement-custom-sharding-ios branch from 17802e6 to c8aa7bd Compare April 8, 2021 15:47
@pawelpasterz pawelpasterz merged commit 18a682f into master Apr 8, 2021
@pawelpasterz pawelpasterz deleted the 1665-implement-custom-sharding-ios branch April 8, 2021 17:23
@github-actions github-actions bot locked and limited conversation to collaborators Apr 8, 2021
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Feature New Option Used to track PR with new configuration option (useful when updating fladle) Tiger 🐯
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom sharding JSON
4 participants