mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-09 15:37:05 +03:00
Sandbox Classic dependency removal from daml-script integration test (#14128)
* Sandbox Classic dependency removal from daml-script integration test CHANGELOG_BEGIN CHANGELOG_END Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
This commit is contained in:
parent
fc47a8995c
commit
1afd0bf479
@ -50,12 +50,10 @@ client_server_build(
|
||||
client_files = ["//daml-script/test:script-test.dar"],
|
||||
data = ["//daml-script/test:script-test.dar"],
|
||||
output_env = "EXPORT_OUT",
|
||||
server = "//ledger/sandbox-classic:sandbox-classic-ephemeral-postgresql",
|
||||
server = "//ledger/sandbox-on-x:sandbox-on-x-ephemeral-postgresql",
|
||||
server_args = [
|
||||
"--port=0",
|
||||
"--port-file=%PORT_FILE%",
|
||||
" --participant=participant-id=example,port=0,port-file=%PORT_FILE%",
|
||||
],
|
||||
server_files = ["//daml-script/test:script-test.dar"],
|
||||
) if not is_windows else None
|
||||
# Disabled on Windows since postgres gets unhappy in client_server_build.
|
||||
|
||||
|
@ -6,6 +6,7 @@ package com.daml.lf.engine.script
|
||||
import akka.actor.ActorSystem
|
||||
import akka.http.scaladsl.Http
|
||||
import akka.stream._
|
||||
|
||||
import java.nio.file.Files
|
||||
import scala.jdk.CollectionConverters._
|
||||
import scala.concurrent.{Await, ExecutionContext, Future}
|
||||
@ -21,6 +22,14 @@ import com.daml.lf.iface.reader.InterfaceReader
|
||||
import com.daml.lf.language.Ast.Package
|
||||
import com.daml.grpc.adapter.{AkkaExecutionSequencerPool, ExecutionSequencerFactory}
|
||||
import com.daml.auth.TokenHolder
|
||||
import com.daml.ledger.client.configuration.{
|
||||
CommandClientConfiguration,
|
||||
LedgerClientChannelConfiguration,
|
||||
LedgerClientConfiguration,
|
||||
LedgerIdRequirement,
|
||||
}
|
||||
import com.daml.ledger.client.withoutledgerid.LedgerClient
|
||||
import com.google.protobuf.ByteString
|
||||
|
||||
object RunnerMain {
|
||||
|
||||
@ -46,6 +55,7 @@ object RunnerMain {
|
||||
fileContent.parseJson
|
||||
})
|
||||
|
||||
val token = config.accessTokenFile.map(new TokenHolder(_)).flatMap(_.token)
|
||||
val participantParams = config.participantConfig match {
|
||||
case Some(file) => {
|
||||
// We allow specifying --access-token-file/--application-id together with
|
||||
@ -59,7 +69,6 @@ object RunnerMain {
|
||||
source.close
|
||||
}
|
||||
val jsVal = fileContent.parseJson
|
||||
val token = config.accessTokenFile.map(new TokenHolder(_)).flatMap(_.token)
|
||||
import ParticipantsJsonProtocol._
|
||||
jsVal
|
||||
.convertTo[Participants[ApiParameters]]
|
||||
@ -71,13 +80,12 @@ object RunnerMain {
|
||||
)
|
||||
}
|
||||
case None =>
|
||||
val tokenHolder = config.accessTokenFile.map(new TokenHolder(_))
|
||||
Participants(
|
||||
default_participant = Some(
|
||||
ApiParameters(
|
||||
config.ledgerHost.get,
|
||||
config.ledgerPort.get,
|
||||
tokenHolder.flatMap(_.token),
|
||||
token,
|
||||
config.applicationId,
|
||||
)
|
||||
),
|
||||
@ -96,6 +104,20 @@ object RunnerMain {
|
||||
} else {
|
||||
Runner.connect(participantParams, config.tlsConfig, config.maxInboundMessageSize)
|
||||
}
|
||||
adminClient = LedgerClient.singleHost(
|
||||
hostIp = config.ledgerHost.get,
|
||||
port = config.ledgerPort.get,
|
||||
configuration = LedgerClientConfiguration(
|
||||
applicationId = "admin-client",
|
||||
ledgerIdRequirement = LedgerIdRequirement.none,
|
||||
commandClient = CommandClientConfiguration.default,
|
||||
token = token,
|
||||
),
|
||||
channelConfig = LedgerClientChannelConfiguration(None),
|
||||
)
|
||||
_ <- adminClient.packageManagementClient.uploadDarFile(
|
||||
ByteString.copyFrom(Files.readAllBytes(config.darPath.toPath))
|
||||
)
|
||||
result <- Runner.run(dar, scriptId, inputValue, clients, config.timeMode)
|
||||
_ <- Future {
|
||||
config.outputFile.foreach { outputFile =>
|
||||
|
Loading…
Reference in New Issue
Block a user