Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
remyhaemmerle-da committed Mar 30, 2023
1 parent dbc5e0c commit bb4791e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ trait CantonFixture extends SuiteResource[Vector[Port]] with AkkaBeforeAndAfterA
|""".stripMargin
)

private val tmpDir = Files.createTempDirectory("CantonFixture")
private val cantonConfigFile = tmpDir.resolve("participant.config")
private val cantonLogFile = tmpDir.resolve("canton.log")
private val portFile = tmpDir.resolve("portfile")
protected val tmpDir = Files.createTempDirectory("CantonFixture")
protected val cantonConfigFile = tmpDir.resolve("participant.config")
protected val cantonLogFile = tmpDir.resolve("canton.log")
protected val portFile = tmpDir.resolve("portfile")

private val files = List(cantonConfigFile, portFile, cantonLogFile)

Expand Down Expand Up @@ -168,7 +168,10 @@ trait CantonFixture extends SuiteResource[Vector[Port]] with AkkaBeforeAndAfterA
| ${tslConfig}
| }
| storage.type = memory
| parameters.dev-version-support = ${devMode}
| parameters = {
| enable-engine-stack-traces = true
| dev-version-support = ${devMode}
| }
| ${timeType.fold("")(x => "testing-time.type = " + x)}
| }""".stripMargin
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import org.scalatest.Suite
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

import java.nio.file.Files

class DamlScriptTestRunner
extends AnyWordSpec
with CantonFixture
Expand All @@ -26,6 +28,8 @@ class DamlScriptTestRunner
override protected def timeProviderType = TimeProviderType.Static
override protected def tlsEnable = false

override protected val cantonFixtureDebugMode = true

private val exe = if (sys.props("os.name").toLowerCase.contains("windows")) ".exe" else ""
val scriptPath = BazelRunfiles.rlocation("daml-script/runner/daml-script-binary" + exe)
val darPath = BazelRunfiles.rlocation("daml-script/test/script-test.dar")
Expand All @@ -41,12 +45,12 @@ class DamlScriptTestRunner
|ScriptExample:initializeUser SUCCESS
|ScriptExample:test SUCCESS
|ScriptTest:clearUsers SUCCESS
|ScriptTest:failingTest FAILURE (com.daml.lf.engine.script.ScriptF$FailedCmd: Command submit failed: FAILED_PRECONDITION: DAML_INTERPRETATION_ERROR(9,XXXXXXXX): Interpretation error: Error: Unhandled Daml exception: DA.Exception.AssertionFailed:AssertionFailed@3f4deaf1{ message = "Assertion failed" }. Details: Last location: [unknown source], partial transaction: ...
|ScriptTest:failingTest FAILURE (com.daml.lf.engine.script.ScriptF$FailedCmd: Command submit failed: FAILED_PRECONDITION: DAML_INTERPRETATION_ERROR(9,XXXXXXXX): Interpretation error: Error: Unhandled Daml exception: DA.Exception.AssertionFailed:AssertionFailed@3f4deaf1{ message = "Assertion failed" }. Details: Last location: [DA.Internal.Exception:168], partial transaction: ...
|ScriptTest:listKnownPartiesTest SUCCESS
|ScriptTest:multiPartySubmission SUCCESS
|ScriptTest:partyIdHintTest SUCCESS
|ScriptTest:sleepTest SUCCESS
|ScriptTest:stackTrace FAILURE (com.daml.lf.engine.script.ScriptF$FailedCmd: Command submit failed: FAILED_PRECONDITION: DAML_INTERPRETATION_ERROR(9,XXXXXXXX): Interpretation error: Error: Unhandled Daml exception: DA.Exception.AssertionFailed:AssertionFailed@3f4deaf1{ message = "Assertion failed" }. Details: Last location: [unknown source], partial transaction: ...
|ScriptTest:stackTrace FAILURE (com.daml.lf.engine.script.ScriptF$FailedCmd: Command submit failed: FAILED_PRECONDITION: DAML_INTERPRETATION_ERROR(9,XXXXXXXX): Interpretation error: Error: Unhandled Daml exception: DA.Exception.AssertionFailed:AssertionFailed@3f4deaf1{ message = "Assertion failed" }. Details: Last location: [DA.Internal.Exception:168], partial transaction: ...
|ScriptTest:test0 SUCCESS
|ScriptTest:test1 SUCCESS
|ScriptTest:test3 SUCCESS
Expand Down Expand Up @@ -102,6 +106,11 @@ class DamlScriptTestRunner
"DAML_INTERPRETATION_ERROR($1,XXXXXXXX)",
)

if (cantonFixtureDebugMode) {
Files.writeString(tmpDir.resolve(getClass.getSimpleName + ".expected"), expected)
Files.writeString(tmpDir.resolve(getClass.getSimpleName + ".actual"), actual)
}

actual shouldBe expected
}
}
Expand Down

0 comments on commit bb4791e

Please sign in to comment.