Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #36 This is the first test to establish the testing framework: a script in ran before the tests to ensure that the SDK 0.12.16 is installed and run a sandbox with testing packages. The LedgerIdentityClient is tested as a proof of concept before applying this approach to other clients. gRPC reflection service is also introduced for future use (feature discovery to target multiple versions of the ledger).
- Loading branch information
1 parent
05b18d3
commit 192179e
Showing
9 changed files
with
142 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
const dummy = require('net').createServer(_socket => {}); | ||
|
||
dummy.listen(0, () => { | ||
console.log(dummy.address().port); | ||
dummy.close(_error => {}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -euxo pipefail | ||
|
||
cd "$(dirname "${0}")" | ||
DAML_SRC=test/integration/src | ||
|
||
(cd "$DAML_SRC" && "$HOME"/.daml/bin/daml build) | ||
PORT=$(node reserve-port) | ||
echo "$PORT" > sandbox.port | ||
(cd "$DAML_SRC" && "$HOME"/.daml/bin/daml sandbox -p "$PORT" dist/*.dar >sandbox.out 2>sandbox.err &) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import {expect} from 'chai'; | ||
import {LedgerIdentityClient} from "../../src/client/LedgerIdentityClient"; | ||
import {LedgerIdentityServiceClient as GrpcLedgerIdentityClient} from "../../src/generated/com/digitalasset/ledger/api/v1/ledger_identity_service_grpc_pb"; | ||
import {credentials} from "grpc"; | ||
|
||
describe("LedgerIdentityClient", () => { | ||
|
||
const grpcClient = new GrpcLedgerIdentityClient(`127.0.0.1:${process.env['DAML_SANDBOX_PORT']}`, credentials.createInsecure()); | ||
const client = new LedgerIdentityClient(grpcClient); | ||
|
||
it("should successfully contact the server and get back a ledger identifier", (done) => { | ||
client.getLedgerIdentity((error, response) => { | ||
expect(error).to.be.null; | ||
expect(response).to.not.be.null; | ||
if (response) { | ||
expect(response).to.haveOwnProperty('ledgerId'); | ||
expect(response.ledgerId).to.be.a('string'); | ||
} | ||
done(); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
sdk-version: 0.12.16 | ||
name: IntegrationTests | ||
source: daml/IntegrationTests.daml | ||
parties: | ||
- Alice | ||
- Bob | ||
exposed-modules: | ||
- PingPong | ||
version: '0.0.0' | ||
dependencies: | ||
- daml-prim | ||
- daml-stdlib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
-- Copyright (c) 2019, Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
-- SPDX-License-Identifier: Apache-2.0 | ||
|
||
daml 1.2 | ||
module IntegrationTests where | ||
|
||
template Ping | ||
with | ||
sender: Party | ||
receiver: Party | ||
count: Int | ||
where | ||
signatory sender | ||
observer receiver | ||
|
||
controller receiver can | ||
ReplyPong : () | ||
do | ||
if count >= 3 then return () | ||
else do | ||
create Pong with sender = receiver; receiver = sender; count = count + 1 | ||
return () | ||
|
||
template Pong | ||
with | ||
sender: Party | ||
receiver: Party | ||
count: Int | ||
where | ||
signatory sender | ||
observer receiver | ||
|
||
controller receiver can | ||
ReplyPing : () | ||
do | ||
if count >= 3 then return () | ||
else do | ||
create Ping with sender = receiver; receiver = sender; count = count + 1 | ||
return () |