Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ We use [semantic versioning](http://semver.org/):
- PATCH version when you make backwards compatible bug fixes.

# Next version
- [fix] _agent_: Bad request error when starting a test run in some cases

# 35.2.0
- [feature] _agent_: Access token can be passed via environment variable `TEAMSCALE_ACCESS_TOKEN`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void testStart(String uniformPath) {
if (availableTests.stream().noneMatch(test -> test.uniformPath.equals(uniformPath))) {
// ensure that we can at least generate a report for the tests that were actually run,
// even if the caller did not provide a list of tests up-front in testRunStart
availableTests.add(new ClusteredTestDetails(uniformPath, uniformPath, null, null, null));
availableTests.add(new ClusteredTestDetails(uniformPath, uniformPath, null, null, agentOptions.getTeamscaleServerOptions().partition));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ class ImpactedTestEngine : TestEngine {
if (!engineOptions.enabled) {
return EngineDescriptor(uniqueId, ENGINE_NAME)
}
if (engineOptions.partition == null) {
throw AssertionError("Agent option partition is undefined, but it's a mandatory parameter when executing impacted tests.")
}
Comment thread
DreierF marked this conversation as resolved.
Outdated

val configuration = engineOptions.testEngineConfiguration
val engine = InternalImpactedTestEngine(configuration, engineOptions.partition)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import org.junit.platform.engine.support.descriptor.EngineDescriptor
*/
internal class InternalImpactedTestEngine(
configuration: ImpactedTestEngineConfiguration,
private val partition: String?
private val partition: String
) {
private val testEngineRegistry = configuration.testEngineRegistry
private val testSorter = configuration.testSorter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ object TestDescriptorUtils {
/** Returns the [AvailableTests] contained within the root [TestDescriptor]. */
fun getAvailableTests(
rootTestDescriptor: TestDescriptor,
partition: String?
partition: String
): AvailableTests {
val availableTests = AvailableTests()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CustomTestFramework(private val agentPort: Int) {
val agent = TiaAgent(false, "http://localhost:$agentPort".toHttpUrl())
val testRun = agent.startTestRun(
allTests.keys
.map { name -> ClusteredTestDetails(name, name, null, null, null) }
.map { name -> ClusteredTestDetails(name, name, null, null, "test-partition") }
)

testRun.prioritizedClusters?.forEach { cluster ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ class ClusteredTestDetails @JsonCreator constructor(
*/
@param:JsonProperty(
"partition"
) var partition: String?
) var partition: String
) : TestDetails(uniformPath, sourcePath, content)

Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class TestWithClusterId @JsonCreator constructor(
/**
* The partition of the test.
*/
@param:JsonProperty("partition") val partition: String?,
@param:JsonProperty("partition") val partition: String,
/**
* A unique identifier for the cluster this test should be prioritized within. May not be null.
*/
@param:JsonProperty("clusterId") val clusterId: String?
@param:JsonProperty("clusterId") val clusterId: String
) {
companion object {
/**
Expand All @@ -31,7 +31,7 @@ class TestWithClusterId @JsonCreator constructor(
fun fromClusteredTestDetails(clusteredTestDetails: ClusteredTestDetails) =
TestWithClusterId(
clusteredTestDetails.uniformPath, clusteredTestDetails.content,
clusteredTestDetails.partition, clusteredTestDetails.clusterId
clusteredTestDetails.partition, clusteredTestDetails.clusterId ?: clusteredTestDetails.uniformPath
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ class TestImpactConfigurationAction(
writeProperty("server.userAccessToken", pluginExtension.server.userAccessToken.get())
writeProperty("baseline", combinedBaseline.orNull?.timestamp)
writeProperty("baselineRevision", combinedBaseline.orNull?.revision)
writeProperty("partition", extension.partition.get())
writeProperty("endCommit", combinedCommit.get().commit)
writeProperty("endRevision", combinedCommit.get().revision)
writeProperty("repository", pluginExtension.repository.orNull)
Expand All @@ -92,6 +91,7 @@ class TestImpactConfigurationAction(
writeProperty("runAllTests", extension.runAllTests.get())
writeProperty("includeAddedTests", extension.includeAddedTests.get())
writeProperty("includeFailedAndSkipped", extension.includeFailedAndSkipped.get())
writeProperty("partition", extension.partition.get())
Comment thread
snowbagoly marked this conversation as resolved.
Outdated
}
}

Loading