From 005682a0cc3f85fef084e310b571ba9b036abcea Mon Sep 17 00:00:00 2001 From: Ranie Jade Ramiso Date: Sun, 19 Apr 2020 13:13:24 +1000 Subject: [PATCH] Disable timeouts by default (#882) --- .../kotlin/org/spekframework/spek2/TimeoutTest.kt | 12 ++++++------ .../testData/timeoutTest/DefaultTimeoutTest.kt | 6 +++--- .../kotlin/testData/timeoutTest/GlobalTimeoutTest.kt | 2 +- .../org/spekframework/spek2/runtime/SpekRuntime.kt | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/integration-test/src/jvmTest/kotlin/org/spekframework/spek2/TimeoutTest.kt b/integration-test/src/jvmTest/kotlin/org/spekframework/spek2/TimeoutTest.kt index bacd2cf17..e10381a19 100644 --- a/integration-test/src/jvmTest/kotlin/org/spekframework/spek2/TimeoutTest.kt +++ b/integration-test/src/jvmTest/kotlin/org/spekframework/spek2/TimeoutTest.kt @@ -4,20 +4,20 @@ import org.spekframework.spek2.style.specification.describe object TimeoutTest: AbstractSpekTest({ helper -> describe("test timeouts") { - it("should timeout using default settings", timeout = 0) { + it("should not timeout using default settings", timeout = 0) { val recorder = helper.executeTest(testData.timeoutTest.DefaultTimeoutTest) helper.assertExecutionEquals( recorder.events() ) { group("DefaultTimeoutTest") { - test("should timeout", false) + test("should not timeout") group("timeout specification style") { - test("should timeout", false) + test("should not timeout") } group("Feature: timeout gherkin style") { group("Scenario: some scenario") { - test("Then: should timeout", false) + test("Then: should not timeout") } } } @@ -49,14 +49,14 @@ object TimeoutTest: AbstractSpekTest({ helper -> describe("global timeouts") { it("should use specified global timeout", timeout = 0) { - System.setProperty("SPEK_TIMEOUT", 15000L.toString()) + System.setProperty("SPEK_TIMEOUT", 8000L.toString()) val recorder = helper.executeTest(testData.timeoutTest.GlobalTimeoutTest) helper.assertExecutionEquals( recorder.events() ) { group("GlobalTimeoutTest") { - test("this should run for 10 seconds and pass since global timeout is 20") + test("this should run for 10 seconds and but fail since global timeout is 8 seconds", false) } } System.clearProperty("SPEK_TIMEOUT") diff --git a/integration-test/src/jvmTest/kotlin/testData/timeoutTest/DefaultTimeoutTest.kt b/integration-test/src/jvmTest/kotlin/testData/timeoutTest/DefaultTimeoutTest.kt index 4b43c6177..c63253dd1 100644 --- a/integration-test/src/jvmTest/kotlin/testData/timeoutTest/DefaultTimeoutTest.kt +++ b/integration-test/src/jvmTest/kotlin/testData/timeoutTest/DefaultTimeoutTest.kt @@ -5,19 +5,19 @@ import org.spekframework.spek2.style.gherkin.Feature import org.spekframework.spek2.style.specification.describe object DefaultTimeoutTest: Spek({ - test("should timeout") { + test("should not timeout") { sleep(13000) } describe("timeout specification style") { - it("should timeout") { + it("should not timeout") { sleep(13000) } } Feature("timeout gherkin style") { Scenario("some scenario") { - Then("should timeout") { + Then("should not timeout") { sleep(13000) } } diff --git a/integration-test/src/jvmTest/kotlin/testData/timeoutTest/GlobalTimeoutTest.kt b/integration-test/src/jvmTest/kotlin/testData/timeoutTest/GlobalTimeoutTest.kt index 92c573381..d6ffe2381 100644 --- a/integration-test/src/jvmTest/kotlin/testData/timeoutTest/GlobalTimeoutTest.kt +++ b/integration-test/src/jvmTest/kotlin/testData/timeoutTest/GlobalTimeoutTest.kt @@ -3,7 +3,7 @@ package testData.timeoutTest import org.spekframework.spek2.Spek object GlobalTimeoutTest : Spek({ - test("this should run for 10 seconds and pass since global timeout is 20") { + test("this should run for 10 seconds and but fail since global timeout is 8 seconds") { sleep(10000) } }) \ No newline at end of file diff --git a/spek-runtime/src/commonMain/kotlin/org/spekframework/spek2/runtime/SpekRuntime.kt b/spek-runtime/src/commonMain/kotlin/org/spekframework/spek2/runtime/SpekRuntime.kt index 48229756d..54b9da25c 100644 --- a/spek-runtime/src/commonMain/kotlin/org/spekframework/spek2/runtime/SpekRuntime.kt +++ b/spek-runtime/src/commonMain/kotlin/org/spekframework/spek2/runtime/SpekRuntime.kt @@ -65,7 +65,7 @@ class SpekRuntime { } companion object { - private const val DEFAULT_TIMEOUT = 10000L + private const val DEFAULT_TIMEOUT = 0L } }