-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathe2e-websockets.bash
executable file
·64 lines (49 loc) · 1.05 KB
/
e2e-websockets.bash
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
#!/bin/bash
set -eu
set -o pipefail
set -o posix
killkill() {
pkill -P $$
}
d=$(mktemp -d)
trap 'killkill || true; rm -r "$d"' EXIT
mkdir $d/server
mkdir $d/client
cat > $d/server/config.yaml <<EOF
host: 127.0.0.1
domain-suffix: ""
listen: 127.0.0.1:18087
trust-x-forwarded-for: false
enable-tcp-forwading: false
account: $d/server/account.yaml
tls-cert: ""
tls-key: ""
EOF
cat > $d/server/account.yaml <<EOF
e2e: SSsecret
EOF
cat > $d/client/config.yaml <<EOF
kish-url: ws://127.0.0.1:18087/
key: e2e/SSsecret
restriction:
ip:
- 127.0.0.1/32
EOF
go build -o $d/kish-server cmd/kish-server/*.go
go build -o $d/kish cmd/kish/*.go
$d/kish-server --config $d/server/config.yaml &
python e2e-websockets/echo.py 18765 &
sleep 1
$d/kish --config=$d/client/config.yaml --no-enable-tui --hostname=localhost http 18765 &
sleep 1
output=$(python e2e-websockets/hello.py ws://localhost:18087)
killkill
errors=0
set -x
[[ $output = 'Received: Hello world!' ]] || errors=$(($errors+1))
echo errors=$errors
if [[ $errors -eq 0 ]]; then
exit 0
else
exit 1
fi