Fix json API options in compat tests (#6084)

--allow-insecure-tokens only exists in recent SDKs.

changelog_begin
changelog_end
This commit is contained in:
Moritz Kiefer 2020-05-23 22:48:27 +02:00 committed by GitHub
parent 2b1468e0e7
commit 5b19aafc18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,6 +21,7 @@ import waitOn from "wait-on";
import Ledger from "@daml/ledger";
import { User } from "@daml.js/create-daml-app";
import { computeCredentials } from "./Credentials";
import semver from "semver";
const DAR_PATH = ".daml/dist/create-daml-app-0.1.0.dar";
const SANDBOX_LEDGER_ID = "create-daml-app-sandbox";
@ -131,18 +132,27 @@ beforeAll(async () => {
const jsonApiOptions = [
"json-api",
"--allow-insecure-tokens",
"--ledger-host=localhost",
`--ledger-port=${sandboxPort}`,
`--http-port=${JSON_API_PORT}`,
`--port-file=${JSON_API_PORT_FILE_NAME}`,
];
jsonApi = spawn(process.env.DAML_JSON_API, jsonApiOptions, {
const extraJsonApiOptions = semver.gte(
process.env.JSON_API_VERSION,
"1.1.0-snapshot.20200430.4057.0.681c862d"
)
? ["--allow-insecure-tokens"]
: [];
jsonApi = spawn(
process.env.DAML_JSON_API,
jsonApiOptions.concat(extraJsonApiOptions),
{
cwd: "..",
stdio: "inherit",
detached: detached,
env: { ...process.env, DAML_SDK_VERSION: process.env.JSON_API_VERSION },
});
}
);
await waitOn({ resources: [`file:../${JSON_API_PORT_FILE_NAME}`] });
uiProc = spawn("yarn", ["start"], {