-
Notifications
You must be signed in to change notification settings - Fork 5
/
world.wit
69 lines (60 loc) · 2.2 KB
/
world.wit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package fermyon:spin-test;
/// All the imports supplied to a `spin-test` compliant test
world test-imports {
import fermyon:spin-test-virt/key-value;
import fermyon:spin-test-virt/sqlite;
import fermyon:spin-test-virt/variables;
import fermyon:spin-wasi-virt/http-handler;
import wasi:http/[email protected];
import http-helper;
}
/// A `spin-test` compliant test
world test {
include test-imports;
export list-tests: func() -> list<string>;
export run: func(name: string);
}
/// A test runner where the "run" function(s) are not known until runtime
world dynamic-runner {
/// Supply the `spin.toml` manifest
import get-manifest: func() -> string;
/// Control the filesystem
export fermyon:spin-wasi-virt/fs-handler;
}
world virtualized-app {
import get-manifest: func() -> string;
export wasi:clocks/[email protected];
export wasi:io/[email protected];
export wasi:io/[email protected];
export wasi:io/[email protected];
export wasi:http/[email protected];
export wasi:http/[email protected];
export fermyon:spin-wasi-virt/http-helper;
export fermyon:spin-wasi-virt/http-handler;
}
/// A test runner that can run a `spin-test` test composition
world runner {
/// Include all dynamic runner items
include dynamic-runner;
/// Run the test
export run: func(name: string);
}
/// Helpers for overcoming the limitations of `wasi:[email protected]`
interface http-helper {
use wasi:http/[email protected].{
incoming-request, incoming-response, outgoing-response,
outgoing-request, response-outparam, future-incoming-response,
incoming-body
};
/// A receiver of an `incoming-response`
resource response-receiver {
get: func() -> option<incoming-response>;
}
/// Create an `incoming-request` from an `outgoing-request`
///
/// An optional `incoming-body` can also be supplied which will be
/// used instead of the body of the `outgoing-request`.
new-request: func(request: outgoing-request, incoming-body: option<incoming-body>) -> incoming-request;
/// Get a pair of a `response-outparam` and a `response-receiver`
new-response: func() -> tuple<response-outparam, response-receiver>;
}