daml icon indicating copy to clipboard operation
daml copied to clipboard

Pass project name and version from `daml.yaml` to `daml test` when not using `--files`

Open akrmn opened this issue 1 year ago • 2 comments

The core of the change here is that we set optMbPackage{Name,Version} in the cliOptions passed to execTest to the values from daml.yaml, but only when running daml test in "project" mode (i.e. when not using --files). I also took the freedom to refactor this a bit, since I had a hard time following the logic as it was.

Status: a bunch of tests are failing with errors like the one below, which points to the scenario service not expecting the package name to be present. I'm making this a draft PR until I have time to fix that.

Script execution failed:
  CRASH: Unexpected conversion exception: Unknown package <package-name>-0.0.1

akrmn avatar Feb 20 '24 10:02 akrmn

This is a right pain to debug, as stack traces are thrown away in several places, but I've tracked it down to: com.daml.lf.engine.script.Converter:311, when trying to create a stack trace. This happens because the unit id of the package sent to the scenario service when a test runs default to "main" when no package name is set, and as such, is resolved to this -homePackageId- which exists in the map. The knownPackages map does not contain the full package name that we now know - the <package-name>-<version> that is reported missing. It does however also contain -dummy-package-name--0.0.0 -> -homePackageId-, so maybe this could be altered to match your unit id, or you could find a way to send up the "main" dummy id without losing the package id on the values.

samuel-williams-da avatar Feb 21 '24 17:02 samuel-williams-da

@remyhaemmerle-da, I think you had requested this, do we still need it?

moisesackerman-da avatar Mar 27 '24 09:03 moisesackerman-da