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

docs: Added documentation about handling #1374 issue #1380

Merged
merged 1 commit into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions docs/bugs/1374_invalid_class

This file was deleted.

75 changes: 75 additions & 0 deletions docs/bugs/1374_invalid_class.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# [Parametrized tests] #1374 - java.lang.ClassNotFoundException: Invalid name:

## Bug description

Test code with parametrized code and custom name

```kotlin
@RunWith(Parameterized::class)
class BrokenTestName2(private val testCase: TestCase) {

@Test fun test() {
val expectedRemainder = if (testCase.odd) 1 else 0
for (value in testCase.values) {
assertEquals(expectedRemainder, abs(value % 2))
}
}

data class TestCase(
val values: List<Int>,
val odd: Boolean,
)

companion object {

@[JvmStatic Parameterized.Parameters(name = "{0}")]
fun parameters(): List<TestCase> = listOf(
TestCase(listOf(-4, -2, 0, 2, 4), odd = false),
TestCase(listOf(-3, -5, -1, 1, 3, 5), odd = true),
)
}
}
```

Will produce failures such as:
```
java.lang.ClassNotFoundException: Invalid name: 3
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at androidx.test.internal.runner.TestLoader.doCreateRunner(TestLoader.java:72)
at androidx.test.internal.runner.TestLoader.getRunnersFor(TestLoader.java:105)
at androidx.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:804)
at androidx.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:575)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:393)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1879)
```

and similar failures for other values interspersed with commas, e.g. `java.lang.ClassNotFoundException: Invalid name: -2`, etc.

Such failures appear like this in the FTL UI:

![image](https://user-images.githubusercontent.com/2455337/101087202-bedca680-3566-11eb-918a-c34b123e803d.png)

## Test details

No matter if sharding is disabled or not, tests will always fail both on GCloud and Flank

## Solution

Disable test orchestrator with yaml option:
```yaml
gcloud:
...
use-orchestrator: false
...
flank:
...
```
or CLI command:
```
--no-use-orchestrator
```

## More info

Please take a look at [documentation about sharding](https://github.com/Flank/flank/blob/master/docs/test_sharding.md#parameterized-tests) for more info