From da57f04b3f937d4ce1b739afb191bbaa593f9fac Mon Sep 17 00:00:00 2001 From: InversionSpaces Date: Mon, 16 Oct 2023 15:53:40 +0000 Subject: [PATCH] Add integration test --- integration-tests/aqua/examples/topology.aqua | 25 ++++++++++++++++++- .../src/__test__/examples.spec.ts | 6 +++++ .../src/examples/topologyCall.ts | 7 ++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/integration-tests/aqua/examples/topology.aqua b/integration-tests/aqua/examples/topology.aqua index 90af31919..b210be691 100644 --- a/integration-tests/aqua/examples/topology.aqua +++ b/integration-tests/aqua/examples/topology.aqua @@ -1,3 +1,7 @@ +aqua Toplogy + +export Testo, LocalPrint, topologyTest, topologyBug205, topologyBug394, topologyBug427, topologyBug257 + import "@fluencelabs/aqua-lib/builtin.aqua" service Testo("testo"): @@ -50,4 +54,23 @@ func topologyBug427(peers: []string) -> []string: results <- Opop.identity("some string") join results[1] - <- results \ No newline at end of file + <- results + +service StrOp("op"): + identity(str: string) -> string + +func idOnPeer(friend: string, friendRelay: string, str: string) -> string: + on friend via friendRelay: + result <- StrOp.identity(str) + + <- result + +func topologyBug257(friend: string, friendRelay: string) -> []string: + result: *string + + on HOST_PEER_ID: + result <- StrOp.identity("host") + result <- idOnPeer(friend, friendRelay, "friend") + result <- idOnPeer(INIT_PEER_ID, HOST_PEER_ID, "init") + + <- result \ No newline at end of file diff --git a/integration-tests/src/__test__/examples.spec.ts b/integration-tests/src/__test__/examples.spec.ts index d30037ff4..8e1abbd2d 100644 --- a/integration-tests/src/__test__/examples.spec.ts +++ b/integration-tests/src/__test__/examples.spec.ts @@ -51,6 +51,7 @@ import { topologyBug205Call, topologyBug394Call, topologyBug427Call, + topologyBug257Call, topologyCall, } from "../examples/topologyCall.js"; import { foldJoinCall } from "../examples/foldJoinCall.js"; @@ -896,6 +897,11 @@ describe("Testing examples", () => { expect(topologyResult).toEqual(selfPeerId); }); + it("topology.aqua bug 257", async () => { + let result = await topologyBug257Call(peer2); + expect(result).toEqual(["host", "friend", "init"]); + }); + it("foldJoin.aqua", async () => { let foldJoinResult = await foldJoinCall(relayPeerId1); expect(foldJoinResult.length).toBeGreaterThanOrEqual(3); diff --git a/integration-tests/src/examples/topologyCall.ts b/integration-tests/src/examples/topologyCall.ts index e7707f704..f61657fec 100644 --- a/integration-tests/src/examples/topologyCall.ts +++ b/integration-tests/src/examples/topologyCall.ts @@ -6,6 +6,7 @@ import { topologyBug205, topologyBug394, topologyBug427, + topologyBug257, } from "../compiled/examples/topology.js"; export async function topologyBug394Call( @@ -66,3 +67,9 @@ export async function topologyCall( }, ); } + +export async function topologyBug257Call( + peer2: IFluenceClient, +): Promise { + return await topologyBug257(peer2.getPeerId(), peer2.getRelayPeerId()); +}