forked from codegangsta/caddy-nats
-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
dev.sh
executable file
·62 lines (46 loc) · 1.74 KB
/
dev.sh
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
#!/bin/bash
############################## DEV_SCRIPT_MARKER ##############################
# This script is used to document and run recurring tasks in development. #
# #
# You can run your tasks using the script `./dev some-task`. #
# You can install the Sandstorm Dev Script Runner and run your tasks from any #
# nested folder using `dev some-task`. #
# https://github.com/sandstorm/Sandstorm.DevScriptRunner #
###############################################################################
set -e
######### TASKS #########
function run-tests() {
go mod tidy
# we cannot run in parallel right now, because the tests all boot up caddy servers and NATS servers on fixed ports.
go test -count=1 -p 1 -v github.com/sandstorm/caddy-nats-bridge/...
}
function run-example() {
# currently deactivated. we might need it later sometime.
exit 1
killall nats || true
killall caddyexample || true
nats subscribe '>' &
./caddyexample run --config Caddyfile &
sleep 1
# curl -H "Foo: bar" https://localhost/test/foo?x=b
#mkfile -n 2m temp_2m_file
mkfile -n 500k temp_500k_file
#curl -F data=@temp_2m_file https://localhost/test/foo?x=b
#curl -H "Transfer-Encoding: chunked" -F data=@temp_2m_file https://localhost/test/foo?x=b
#curl -F "data=@temp_500k_file" https://localhost/test/foo?x=b
killall nats
killall caddyexample
}
####### Utilities #######
_log_success() {
printf "\033[0;32m%s\033[0m\n" "${1}"
}
_log_warning() {
printf "\033[1;33m%s\033[0m\n" "${1}"
}
_log_error() {
printf "\033[0;31m%s\033[0m\n" "${1}"
}
# THIS NEEDS TO BE LAST!!!
# this will run your tasks
"$@"