Skip to content
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

Validate Spoon Task Inputs #82

Open
ZakTaccardi opened this issue Apr 23, 2020 · 1 comment
Open

Validate Spoon Task Inputs #82

ZakTaccardi opened this issue Apr 23, 2020 · 1 comment

Comments

@ZakTaccardi
Copy link

I have the following code:

spoon {
  // The number of separate shards to create.
  if (project.hasProperty('spoonNumShards')) {
    numShards = project.spoonNumShards
  }
  // The shardIndex option to specify which shard to run.
  if (project.hasProperty('spoonShardIndex')) {
    shardIndex = project.spoonShardIndex
  }
}

I ran the following command

./gradlew :app:spoonDebugAndroidTest -PspoonNumShards=4 -PspoonShardIndex=0

Expected output:

I/RemoteAndroidTest: Running am instrument -w -r   -e shardIndex 0 -e numShards 4 -e log true

Actual output:

I/RemoteAndroidTest: Running am instrument -w -r   -e  shardIndex 48 -e numShards 52 -e log true

To fix this, Integer.valueOf(..) is needed.

spoon {
  // The number of separate shards to create.
  if (project.hasProperty('spoonNumShards')) {
    numShards = Integer.valueOf(project.spoonNumShards)
  }
  // The shardIndex option to specify which shard to run.
  if (project.hasProperty('spoonShardIndex')) {
    shardIndex = Integer.valueOf(project.spoonShardIndex)
  }
}

Ask:
Avoid this issue by having the spoon gradle plugin validate its input and throw an exception when numShards/shardIndex, are not integers.

Thanks!

@jaredsburrows
Copy link
Owner

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

No branches or pull requests

2 participants