build-and-lint-test removal dependency to sandbox-classic (#14120)

CHANGELOG_BEGIN
CHANGELOG_END
This commit is contained in:
Sergey Kisel 2022-06-09 16:57:13 +02:00 committed by GitHub
parent 16f91190f8
commit 5a63ed85ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 15 deletions

View File

@ -78,7 +78,7 @@ sh_test(
"$(location //:java)",
"$(location //:yarn)",
"$(location //:daml2js)",
"$(location //ledger/sandbox-classic:sandbox-classic-binary_deploy.jar)",
"$(location //ledger/sandbox-on-x:app_deploy.jar)",
"$(location //ledger-service/http-json:http-json-binary_deploy.jar)",
"$(location :build-and-lint.dar)",
"$(location ts/package.json)",
@ -92,7 +92,7 @@ sh_test(
"//:java",
"//:yarn",
"//:daml2js",
"//ledger/sandbox-classic:sandbox-classic-binary_deploy.jar",
"//ledger/sandbox-on-x:app_deploy.jar",
"//ledger-service/http-json:http-json-binary_deploy.jar",
":build-and-lint.dar",
"//ledger/test-common:model-tests-default.dar",

View File

@ -44,6 +44,17 @@ const computeUserToken = (name: string) =>
"HS256",
);
const ADMIN_TOKEN = encode(
{
"https://daml.com/ledger-api": {
ledgerId: LEDGER_ID,
applicationId: APPLICATION_ID,
admin: true,
},
},
SECRET_KEY,
"HS256",
);
const ALICE_PARTY = "Alice";
const ALICE_TOKEN = computeToken(ALICE_PARTY);
const BOB_PARTY = "Bob";
@ -82,20 +93,13 @@ const spawnJvm = (
beforeAll(async () => {
console.log("build-and-lint-1.0.0 (" + buildAndLint.packageId + ") loaded");
const darPath = getEnv("DAR");
sandboxProcess = spawnJvm(getEnv("SANDBOX"), [
"--dev-mode-unsafe",
"--contract-id-seeding",
"testing-weak",
"--port",
"0",
"--port-file",
SANDBOX_PORT_FILE,
"--ledgerid",
LEDGER_ID,
"--wall-clock-time",
"--log-level=INFO",
darPath,
"--daml-lf-dev-mode-unsafe",
"--contract-id-seeding=testing-weak",
"--enable-user-management=true",
"--participant=participant-id=example,port=0,port-file=" +
SANDBOX_PORT_FILE,
"--ledger-id=" + LEDGER_ID,
]);
await waitOn({ resources: [`file:${SANDBOX_PORT_FILE}`] });
const sandboxPortData = await fs.readFile(SANDBOX_PORT_FILE, {
@ -126,6 +130,25 @@ beforeAll(async () => {
encoding: "utf8",
});
jsonApiPort = parseInt(jsonApiPortData);
console.log("Uploading required dar files ..." + getEnv("DAR"));
const ledger = new Ledger({ token: ADMIN_TOKEN, httpBaseUrl: httpBaseUrl() });
const upDar = await fs.readFile(getEnv("DAR"));
await ledger.uploadDarFile(upDar);
console.log("Explicitly allocating parties");
await ledger.allocateParty({
identifierHint: ALICE_PARTY,
displayName: ALICE_PARTY,
});
await ledger.allocateParty({
identifierHint: BOB_PARTY,
displayName: BOB_PARTY,
});
await ledger.allocateParty({
identifierHint: CHARLIE_PARTY,
displayName: CHARLIE_PARTY,
});
console.log("JSON API listening on port " + jsonApiPort.toString());
}, 300_000);
@ -902,6 +925,7 @@ test("party API", async () => {
expect(_.sortBy(allParties, [(p: PartyInfo) => p.identifier])).toEqual([
p("Alice"),
p("Bob"),
p("Charlie"),
]);
const newParty1 = await ledger.allocateParty({});
@ -916,6 +940,7 @@ test("party API", async () => {
_.sortBy([
"Alice",
"Bob",
"Charlie",
"Dave",
newParty1.identifier,
newParty2.identifier,