Restore string cancellation test

The cancel on-going task with string id test was failing in CI because
of a race condition involving server log messages. We need to wait for a
notification that the project has been compiled before we wait for the
"Waiting for" message, otherwise we might pick up the "Waiting for"
message from the previous test case and try to cancel the task before it
has been created.
This commit is contained in:
Ethan Atkins 2020-09-27 10:12:49 -07:00
parent 90f6d77d59
commit 5fee13ad5a
1 changed files with 6 additions and 2 deletions

View File

@ -54,6 +54,9 @@ object EventsTest extends AbstractServerTest {
svr.sendJsonRpc( svr.sendJsonRpc(
s"""{ "jsonrpc": "2.0", "id":$id, "method": "sbt/exec", "params": { "commandLine": "run" } }""" s"""{ "jsonrpc": "2.0", "id":$id, "method": "sbt/exec", "params": { "commandLine": "run" } }"""
) )
assert(svr.waitForString(10.seconds) { s =>
s contains "Compiled events"
})
assert(svr.waitForString(10.seconds) { s => assert(svr.waitForString(10.seconds) { s =>
s contains "Waiting for" s contains "Waiting for"
}) })
@ -66,13 +69,15 @@ object EventsTest extends AbstractServerTest {
}) })
} }
/* This test is timing out.
test("cancel on-going task with string id") { _ => test("cancel on-going task with string id") { _ =>
import sbt.Exec import sbt.Exec
val id = Exec.newExecId val id = Exec.newExecId
svr.sendJsonRpc( svr.sendJsonRpc(
s"""{ "jsonrpc": "2.0", "id": "$id", "method": "sbt/exec", "params": { "commandLine": "run" } }""" s"""{ "jsonrpc": "2.0", "id": "$id", "method": "sbt/exec", "params": { "commandLine": "run" } }"""
) )
assert(svr.waitForString(10.seconds) { s =>
s contains "Compiled events"
})
assert(svr.waitForString(10.seconds) { s => assert(svr.waitForString(10.seconds) { s =>
s contains "Waiting for" s contains "Waiting for"
}) })
@ -84,5 +89,4 @@ object EventsTest extends AbstractServerTest {
s contains """"result":{"status":"Task cancelled"""" s contains """"result":{"status":"Task cancelled""""
}) })
} }
*/
} }