mirror of
https://github.com/fluencelabs/aqua-playground
synced 2025-04-25 06:42:36 +00:00
topology bug integration test
This commit is contained in:
parent
784efebc46
commit
3d3280d2e7
@ -6,6 +6,9 @@ service Testo("testo"):
|
||||
service LocalPrint("lp"):
|
||||
print: string -> ()
|
||||
|
||||
service Opop("op"):
|
||||
identity(s: string) -> string
|
||||
|
||||
|
||||
func topologyTest(me: string, myRelay: string, friend: string, friendRelay: string) -> string:
|
||||
on friend via friendRelay:
|
||||
@ -39,3 +42,12 @@ func topologyBug394(peer: string, peer2: string, peer3: string) -> string:
|
||||
|
||||
-- send the result to the initiator
|
||||
<- comp
|
||||
|
||||
func topologyBug427(peers: []string) -> []string:
|
||||
results: *string
|
||||
for peer <- peers par:
|
||||
on peer:
|
||||
results <- Opop.identity("some string")
|
||||
|
||||
join results[1]
|
||||
<- results
|
14
package-lock.json
generated
14
package-lock.json
generated
@ -19,7 +19,7 @@
|
||||
"fldist": "dist/index.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fluencelabs/aqua": "0.6.0-263",
|
||||
"@fluencelabs/aqua": "0.6.0-272",
|
||||
"@fluencelabs/aqua-dht": "0.2.4",
|
||||
"@fluencelabs/aqua-lib": "0.3.2",
|
||||
"@types/jest": "^27.0.2",
|
||||
@ -697,9 +697,9 @@
|
||||
"integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg=="
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua": {
|
||||
"version": "0.6.0-263",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.6.0-263.tgz",
|
||||
"integrity": "sha512-E9ynPrkboKgyYEE6M+WDyroFJ0k0FTs1w9Gu/hOqFYnE63106VNZz/RrKtjK0o202MqhCpoOlSG0HsV3B5CzVA==",
|
||||
"version": "0.6.0-272",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.6.0-272.tgz",
|
||||
"integrity": "sha512-4BogO/mYzrLceTLb3GlSRtCxzl+aD5dU/Ky5XjhD5eFAFf23NhW5L2aDou1DN8cVEdzKIz7Y5Nmmul6Lc2LMIA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua-ipfs": "0.5.2",
|
||||
@ -9462,9 +9462,9 @@
|
||||
}
|
||||
},
|
||||
"@fluencelabs/aqua": {
|
||||
"version": "0.6.0-263",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.6.0-263.tgz",
|
||||
"integrity": "sha512-E9ynPrkboKgyYEE6M+WDyroFJ0k0FTs1w9Gu/hOqFYnE63106VNZz/RrKtjK0o202MqhCpoOlSG0HsV3B5CzVA==",
|
||||
"version": "0.6.0-272",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.6.0-272.tgz",
|
||||
"integrity": "sha512-4BogO/mYzrLceTLb3GlSRtCxzl+aD5dU/Ky5XjhD5eFAFf23NhW5L2aDou1DN8cVEdzKIz7Y5Nmmul6Lc2LMIA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@fluencelabs/aqua-ipfs": "0.5.2",
|
||||
|
@ -25,10 +25,11 @@
|
||||
"compile-aqua": "aqua -i ./aqua/ -o ./src/compiled",
|
||||
"compile-aqua:air": "aqua -i ./aqua/ -o ./compiled-air -a",
|
||||
"prettify-compiled": "prettier --write src/compiled",
|
||||
"aqua": "aqua"
|
||||
"aqua": "aqua",
|
||||
"do": "aqua dist deploy --addr /dns4/kras-04.fluence.dev/tcp/19001/wss/p2p/12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi --data-path deploy.json --service tsOracle"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fluencelabs/aqua": "0.6.0-263",
|
||||
"@fluencelabs/aqua": "0.6.0-272",
|
||||
"@fluencelabs/aqua-dht": "0.2.4",
|
||||
"@fluencelabs/aqua-lib": "0.3.2",
|
||||
"@types/jest": "^27.0.2",
|
||||
|
@ -11,7 +11,7 @@ import { parCall } from '../examples/parCall';
|
||||
import { complexCall } from '../examples/complex';
|
||||
import { constantsCall } from '../examples/constantsCall';
|
||||
import { returnNilCall, returnNoneCall, streamCall } from '../examples/streamCall';
|
||||
import {topologyBug205Call, topologyBug394Call, topologyCall} from '../examples/topologyCall';
|
||||
import {topologyBug205Call, topologyBug394Call, topologyBug427Call, topologyCall} from '../examples/topologyCall';
|
||||
import { foldJoinCall } from '../examples/foldJoinCall';
|
||||
import { registerHandlers, returnNull, returnOptionalCall, useOptionalCall } from '../examples/useOptionalCall';
|
||||
import { viaCall } from '../examples/viaCall';
|
||||
@ -34,6 +34,7 @@ import {streamCanCall} from "../examples/streamCan";
|
||||
import {streamCallbackCall} from "../examples/streamCallback";
|
||||
import {streamResCall} from "../examples/streamRestrictionsCall";
|
||||
import {joinIdxCall, joinIdxLocalCall, joinIdxRelayCall} from "../examples/joinCall";
|
||||
import {topologyBug427} from "../compiled/examples/topology";
|
||||
|
||||
var selfPeerId: string;
|
||||
var peer2: FluencePeer;
|
||||
@ -171,6 +172,12 @@ describe('Testing examples', () => {
|
||||
expect(topologyResult).toEqual(res);
|
||||
});
|
||||
|
||||
it('topology.aqua bug 427', async () => {
|
||||
let topologyResult = await topologyBug427Call(peer2);
|
||||
|
||||
expect(topologyResult).toEqual(["some string", "some string"]);
|
||||
});
|
||||
|
||||
it('topology.aqua bug 394', async () => {
|
||||
let topologyResult = await topologyBug394Call(peer2);
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.6.0-263
|
||||
* Aqua version: 0.6.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
@ -52,6 +52,42 @@ export function registerIOp(...args: any) {
|
||||
|
||||
|
||||
|
||||
export interface OpopDef {
|
||||
identity: (s: string, callParams: CallParams<'s'>) => string | Promise<string>;
|
||||
}
|
||||
export function registerOpop(service: OpopDef): void;
|
||||
export function registerOpop(serviceId: string, service: OpopDef): void;
|
||||
export function registerOpop(peer: FluencePeer, service: OpopDef): void;
|
||||
export function registerOpop(peer: FluencePeer, serviceId: string, service: OpopDef): void;
|
||||
|
||||
|
||||
export function registerOpop(...args: any) {
|
||||
registerService(
|
||||
args,
|
||||
{
|
||||
"defaultServiceId" : "op",
|
||||
"functions" : [
|
||||
{
|
||||
"functionName" : "identity",
|
||||
"argDefs" : [
|
||||
{
|
||||
"name" : "s",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
}
|
||||
],
|
||||
"returnType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
export interface TestoDef {
|
||||
getString: (arg0: string, callParams: CallParams<'arg0'>) => string | Promise<string>;
|
||||
}
|
||||
@ -125,6 +161,96 @@ export function registerLocalPrint(...args: any) {
|
||||
// Functions
|
||||
|
||||
|
||||
export function topologyBug427(
|
||||
peers: string[],
|
||||
config?: {ttl?: number}
|
||||
): Promise<string[]>;
|
||||
|
||||
export function topologyBug427(
|
||||
peer: FluencePeer,
|
||||
peers: string[],
|
||||
config?: {ttl?: number}
|
||||
): Promise<string[]>;
|
||||
|
||||
export function topologyBug427(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "peers") [] peers)
|
||||
)
|
||||
(new $results
|
||||
(seq
|
||||
(seq
|
||||
(par
|
||||
(fold peers peer
|
||||
(par
|
||||
(seq
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(xor
|
||||
(call peer ("op" "identity") ["some string"] $results)
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("op" "noop") [])
|
||||
)
|
||||
(next peer)
|
||||
)
|
||||
)
|
||||
(null)
|
||||
)
|
||||
(call %init_peer_id% ("op" "noop") [$results.$.[1]!])
|
||||
)
|
||||
(call %init_peer_id% ("op" "identity") [$results] results-fix)
|
||||
)
|
||||
)
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "response") [results-fix])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
|
||||
)
|
||||
`
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
"functionName" : "topologyBug427",
|
||||
"returnType" : {
|
||||
"tag" : "primitive"
|
||||
},
|
||||
"argDefs" : [
|
||||
{
|
||||
"name" : "peers",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
}
|
||||
],
|
||||
"names" : {
|
||||
"relay" : "-relay-",
|
||||
"getDataSrv" : "getDataSrv",
|
||||
"callbackSrv" : "callbackSrv",
|
||||
"responseSrv" : "callbackSrv",
|
||||
"responseFnName" : "response",
|
||||
"errorHandlingSrv" : "errorHandlingSrv",
|
||||
"errorFnName" : "error"
|
||||
}
|
||||
},
|
||||
script
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function topologyBug205(
|
||||
node_id: string,
|
||||
n2: string | null,
|
||||
|
@ -4,7 +4,7 @@ import {
|
||||
registerTesto,
|
||||
registerLocalPrint,
|
||||
topologyBug205,
|
||||
topologyBug394
|
||||
topologyBug394, topologyBug427
|
||||
} from '../compiled/examples/topology';
|
||||
|
||||
export async function topologyBug394Call(peer2: FluencePeer): Promise<string> {
|
||||
@ -27,6 +27,14 @@ export async function topologyBug205Call(peer2: FluencePeer): Promise<string[]>
|
||||
return topologyBug205(relayPeerId, relayPeerId2)
|
||||
}
|
||||
|
||||
export async function topologyBug427Call(peer2: FluencePeer): Promise<string[]> {
|
||||
const relayPeerId = Fluence.getPeer().getStatus().relayPeerId;
|
||||
|
||||
const relayPeerId2 = peer2.getStatus().relayPeerId;
|
||||
|
||||
return topologyBug427([relayPeerId, relayPeerId2])
|
||||
}
|
||||
|
||||
export async function topologyCall(peer2: FluencePeer): Promise<string> {
|
||||
const relayPeerId = Fluence.getPeer().getStatus().relayPeerId;
|
||||
const selfPeerId = Fluence.getPeer().getStatus().peerId;
|
||||
|
Loading…
x
Reference in New Issue
Block a user