Skip to content

Commit cb58979

Browse files
committed
misc: assert gradle task fails
1 parent b411d82 commit cb58979

File tree

1 file changed

+7
-1
lines changed
  • tests/codegen/smoke-tests/src/test/kotlin/aws/sdk/kotlin/test/codegen/smoketest

1 file changed

+7
-1
lines changed

tests/codegen/smoke-tests/src/test/kotlin/aws/sdk/kotlin/test/codegen/smoketest/SmokeTestE2ETest.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import aws.smithy.kotlin.runtime.util.PlatformProvider
1212
import java.io.File
1313
import kotlin.test.Test
1414
import kotlin.test.assertContains
15+
import kotlin.test.assertTrue
1516

1617
class SmokeTestE2ETest {
1718
@Test
@@ -31,7 +32,7 @@ class SmokeTestE2ETest {
3132

3233
@Test
3334
fun exceptionService() {
34-
val smokeTestRunnerOutput = runSmokeTests("exceptionService")
35+
val smokeTestRunnerOutput = runSmokeTests("exceptionService", expectingFailure = true)
3536

3637
assertContains(smokeTestRunnerOutput, "not ok ExceptionService ExceptionTest - no error expected from service")
3738
assertContains(smokeTestRunnerOutput, "#aws.smithy.kotlin.runtime.http.interceptors.SmokeTestsFailureException: Smoke test failed with HTTP status code: 400")
@@ -59,6 +60,7 @@ class SmokeTestE2ETest {
5960
private fun runSmokeTests(
6061
service: String,
6162
envVars: Map<String, String> = emptyMap(),
63+
expectingFailure: Boolean = false,
6264
): String {
6365
val sdkRootDir = System.getProperty("user.dir") + "/../../../"
6466
val processBuilder =
@@ -78,6 +80,10 @@ private fun runSmokeTests(
7880
val process = processBuilder.start()
7981
val output = process.inputStream.bufferedReader().use { it.readText() }
8082

83+
if (expectingFailure) {
84+
assertTrue(process.exitValue() != 0)
85+
}
86+
8187
return output
8288
}
8389

0 commit comments

Comments
 (0)