Skip to content

Commit 09de6cf

Browse files
committed
test:Tests for using the default script.
1 parent a7c6ad6 commit 09de6cf

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

t/10-default-script.rakutest

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
use v6.d;
2+
use Test;
3+
use CortexJS::ComputeEngine;
4+
5+
sub can-run-node() {
6+
my $proc = try run 'node', '--version', :out, :err;
7+
return False unless $proc.defined;
8+
$proc.exitcode == 0;
9+
}
10+
11+
unless can-run-node() {
12+
plan 1;
13+
skip 'node is not installed in this environment', 1;
14+
exit 0;
15+
}
16+
17+
my $ce;
18+
my $startup-error = '';
19+
try {
20+
$ce = CortexJS::ComputeEngine.new();
21+
CATCH {
22+
default {
23+
$startup-error = .Str;
24+
}
25+
}
26+
}
27+
28+
unless $ce.defined {
29+
plan 1;
30+
skip "backend did not start with default script: {$startup-error}", 1;
31+
exit 0;
32+
}
33+
34+
LEAVE { try $ce.close if $ce.defined; }
35+
36+
my %ping = $ce.ping.Hash;
37+
is %ping<pong>, True, 'default script startup supports ping';
38+
39+
done-testing;

0 commit comments

Comments
 (0)