mirror of
https://github.com/fluencelabs/aqua-playground
synced 2025-04-25 15:02:32 +00:00
test timeout spec
This commit is contained in:
parent
2b576c75c1
commit
30d892d775
@ -11,3 +11,24 @@ func parFunc( node: string, c: Info -> () ):
|
|||||||
t <- Peer.identify()
|
t <- Peer.identify()
|
||||||
c(t)
|
c(t)
|
||||||
par x <- ParService.call()
|
par x <- ParService.call()
|
||||||
|
|
||||||
|
func testTimeout(nodes: []string) -> string:
|
||||||
|
on HOST_PEER_ID:
|
||||||
|
|
||||||
|
results: *Info
|
||||||
|
|
||||||
|
for node <- nodes par:
|
||||||
|
on node:
|
||||||
|
results <- Peer.identify()
|
||||||
|
|
||||||
|
timeout: *string
|
||||||
|
join results[999]
|
||||||
|
par timeout <- Peer.timeout(400, "timeout")
|
||||||
|
|
||||||
|
status: *string
|
||||||
|
if timeout == nil:
|
||||||
|
status <<- "ok"
|
||||||
|
else:
|
||||||
|
status <<- timeout!
|
||||||
|
|
||||||
|
<- status!
|
||||||
|
@ -7,7 +7,7 @@ import { funcCall } from '../examples/funcCall';
|
|||||||
import { helloWorldCall } from '../examples/helloWorldCall';
|
import { helloWorldCall } from '../examples/helloWorldCall';
|
||||||
import { foldCall } from '../examples/foldCall';
|
import { foldCall } from '../examples/foldCall';
|
||||||
import {ifCall, ifWrapCall} from '../examples/if';
|
import {ifCall, ifWrapCall} from '../examples/if';
|
||||||
import { parCall } from '../examples/parCall';
|
import {parCall, testTimeoutCall} from '../examples/parCall';
|
||||||
import { complexCall } from '../examples/complex';
|
import { complexCall } from '../examples/complex';
|
||||||
import { constantsCall } from '../examples/constantsCall';
|
import { constantsCall } from '../examples/constantsCall';
|
||||||
import { returnNilCall, returnNoneCall, streamCall } from '../examples/streamCall';
|
import { returnNilCall, returnNoneCall, streamCall } from '../examples/streamCall';
|
||||||
@ -109,6 +109,11 @@ describe('Testing examples', () => {
|
|||||||
expect(parCallResult).toBe('hello');
|
expect(parCallResult).toBe('hello');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it(' par.aqua testTimeout', async () => {
|
||||||
|
let testTimeoutResult = await testTimeoutCall();
|
||||||
|
expect(testTimeoutResult).toBe('timeout');
|
||||||
|
});
|
||||||
|
|
||||||
it('helloWorld.aqua', async () => {
|
it('helloWorld.aqua', async () => {
|
||||||
let helloWorldResult = await helloWorldCall();
|
let helloWorldResult = await helloWorldCall();
|
||||||
expect(helloWorldResult).toBe('Hello, NAME!');
|
expect(helloWorldResult).toBe('Hello, NAME!');
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Fluence } from '@fluencelabs/fluence';
|
import { Fluence } from '@fluencelabs/fluence';
|
||||||
import { parFunc, registerParService } from '../compiled/examples/par';
|
import {parFunc, registerParService, testTimeout} from '../compiled/examples/par';
|
||||||
|
import {config} from "../config";
|
||||||
|
|
||||||
export async function parCall() {
|
export async function parCall() {
|
||||||
const relayPeerId = Fluence.getPeer().getStatus().relayPeerId;
|
const relayPeerId = Fluence.getPeer().getStatus().relayPeerId;
|
||||||
@ -21,3 +22,9 @@ export async function parCall() {
|
|||||||
|
|
||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const relays = config.relays
|
||||||
|
|
||||||
|
export async function testTimeoutCall() {
|
||||||
|
return testTimeout([relays[3].peerId, relays[4].peerId])
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user