Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
test a bit more involved
Browse files Browse the repository at this point in the history
  • Loading branch information
eladb committed Nov 3, 2023
1 parent 3f8d5be commit 0f93676
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 34 deletions.
48 changes: 24 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"cdk8s-plus-27": "^2.7.33",
"cdktf": "^0.18.2",
"glob": "^10.3.10",
"winglang": "^0.44.2"
"winglang": "^0.44.3"
}
}
24 changes: 15 additions & 9 deletions test/containers.test.w
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let hello = new containers.Workload(
public: true,
) as "hello";

new containers.Workload(
let echo = new containers.Workload(
name: "http-echo",
image: "hashicorp/http-echo",
port: 5678,
Expand All @@ -25,14 +25,20 @@ new containers.Workload(
args: ["-text=hello1234"],
) as "http-echo";

let tryGetBody = inflight (): str? => {
let httpGet = inflight (url: str?): str => {
if let url = url {
if let body = http.get(url).body {
return body;
}
}

throw "no body";
};

test "ping" {
if let url = hello.publicUrl {
let body = http.get(url).body;
assert(body?.contains(message) ?? false);
} else {
assert(false);
}
test "access public url" {
let helloBody = httpGet(hello.publicUrl);
assert(helloBody.contains(message));

let echoBody = httpGet(echo.publicUrl);
assert(echoBody.contains("hello1234"));
}

0 comments on commit 0f93676

Please sign in to comment.