Fix runtime dataflow error tests (#8273)

@radeusgd pointed out that tests are checking that the engine does not send updates when the dataflow error changes. In the end, it turned out that those tests were not checking what they said, and the engine sent the proper updates.
This commit is contained in:
Dmitry Bushev 2023-11-10 14:41:32 +00:00 committed by GitHub
parent 148f34f778
commit 18c7135769
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 60 additions and 9 deletions

View File

@ -969,7 +969,7 @@ class RuntimeErrorsTest
context.consumeOut shouldEqual List("499999999999")
}
it should "not send updates when dataflow error changes in expression" in {
it should "send updates when dataflow error changes in expression" in {
val contextId = UUID.randomUUID()
val requestId = UUID.randomUUID()
val moduleName = "Enso_Test.Test.Main"
@ -1061,15 +1061,41 @@ class RuntimeErrorsTest
)
)
)
context.receiveNIgnoreExpressionUpdates(
1
context.receiveNIgnorePendingExpressionUpdates(
4
) should contain theSameElementsAs Seq(
TestMessages.error(
contextId,
xId,
Api.MethodCall(
Api.MethodPointer(
"Standard.Base.Error",
"Standard.Base.Error.Error",
"throw"
)
),
fromCache = false,
typeChanged = false,
Api.ExpressionUpdate.Payload.DataflowError(Seq(xId))
),
TestMessages.error(
contextId,
yId,
Api.ExpressionUpdate.Payload.DataflowError(Seq(xId)),
typeChanged = false
),
TestMessages.update(
contextId,
mainResId,
ConstantsGen.NOTHING,
typeChanged = false
),
context.executionComplete(contextId)
)
context.consumeOut shouldEqual List("(Error: MyError2)")
}
it should "not send updates when dataflow error changes in method" in {
it should "send updates when dataflow error changes in method" in {
val contextId = UUID.randomUUID()
val requestId = UUID.randomUUID()
val moduleName = "Enso_Test.Test.Main"
@ -1159,9 +1185,29 @@ class RuntimeErrorsTest
)
)
)
context.receiveNIgnoreExpressionUpdates(
1
context.receiveNIgnorePendingExpressionUpdates(
4
) should contain theSameElementsAs Seq(
TestMessages.error(
contextId,
xId,
Api.MethodCall(Api.MethodPointer(moduleName, moduleName, "foo")),
fromCache = false,
typeChanged = false,
Api.ExpressionUpdate.Payload.DataflowError(Seq(fooThrowId, xId))
),
TestMessages.error(
contextId,
yId,
Api.ExpressionUpdate.Payload.DataflowError(Seq(fooThrowId, xId)),
typeChanged = false
),
TestMessages.update(
contextId,
mainResId,
ConstantsGen.NOTHING,
typeChanged = false
),
context.executionComplete(contextId)
)
context.consumeOut shouldEqual List("(Error: MyError2)")

View File

@ -158,19 +158,24 @@ object TestMessages {
* @param contextId an identifier of the context
* @param expressionId an identifier of the expression
* @param payload the error payload
* @param fromCache whether or not the value for this expression came
* from the cache
* @param typeChanged a flag indicating whether the the type of expression has changed
* @return the expression update response
*/
def error(
contextId: UUID,
expressionId: UUID,
payload: Api.ExpressionUpdate.Payload
payload: Api.ExpressionUpdate.Payload,
fromCache: Boolean = false,
typeChanged: Boolean = true
): Api.Response =
errorBuilder(
contextId,
expressionId,
None,
false,
true,
fromCache,
typeChanged,
payload
)