Skip to content

Commit

Permalink
Try speeding up testscript tests
Browse files Browse the repository at this point in the history
  • Loading branch information
prymitive committed Mar 3, 2022
1 parent 5262c2e commit c6c9b5b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions cmd/pint/tests/0041_watch.txt
@@ -1,11 +1,11 @@
exec bash -x ./test.sh &

pint.ok --no-color -l debug watch --interval=10s --listen=:6041 --pidfile=pint.pid rules
pint.ok --no-color -l debug watch --interval=5s --listen=:6041 --pidfile=pint.pid rules
! stdout .

stderr 'level=info msg="Pidfile created" path=pint.pid'
stderr 'level=info msg="Started HTTP server" address=:6041'
stderr 'level=info msg="Will continuously run checks until terminated" interval=10s'
stderr 'level=info msg="Will continuously run checks until terminated" interval=5s'
stderr 'level=debug msg="Clearing cache"'
stderr 'level=debug msg="Running checks"'
stderr 'level=error msg="Got an error when running checks" error="no matching files"'
Expand All @@ -20,6 +20,7 @@ stderr 'level=info msg="Pidfile removed" path=pint.pid'
grep '^pint_check_iterations_total 2$' curl.txt

-- test.sh --
sleep 15
sleep 7
curl -so curl.txt http://127.0.0.1:6041/metrics
grep -E '^pint_check_iterations_total ' curl.txt
cat pint.pid | xargs kill
2 changes: 1 addition & 1 deletion cmd/pint/tests/0042_watch_metrics.txt
Expand Up @@ -4,7 +4,7 @@ pint.ok watch --listen=:6042 --pidfile=pint.pid rules
cmp curl.txt metrics.txt

-- test.sh --
sleep 5
sleep 3
curl -s http://127.0.0.1:6042/metrics | grep -vE 'process_|go_info' | perl -pe "s/^([a-zA-Z].+)[ ]([0-9\.\-\+eE]+)$/\1/g" > curl.txt
cat pint.pid | xargs kill

Expand Down
4 changes: 2 additions & 2 deletions cmd/pint/tests/0043_watch_cancel.txt
Expand Up @@ -12,7 +12,7 @@ stderr 'level=info msg="Waiting for all background tasks to finish"'
stderr 'level=info msg="Background worker finished"'

-- test.sh --
sleep 5
sleep 3
cat pint.pid | xargs kill
cat prometheus.pid | xargs kill

Expand Down Expand Up @@ -76,7 +76,7 @@ func main() {
stop <- syscall.SIGTERM
}()
<-stop
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
server.Shutdown(ctx)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/pint/tests/0054_watch_metrics_prometheus.txt
Expand Up @@ -7,7 +7,7 @@ pint.ok watch --listen=:6054 --pidfile=pint.pid rules
cmp curl.txt metrics.txt

-- test.sh --
sleep 15
sleep 3
curl -s http://127.0.0.1:6054/metrics | grep 'pint_' | perl -pe "s/^([a-zA-Z].+)[ ]([0-9\.\-\+eE]+)$/\1/g" > curl.txt
cat pint.pid | xargs kill
cat prometheus.pid | xargs kill
Expand Down
2 changes: 1 addition & 1 deletion cmd/pint/tests/0057_watch_metrics_prometheus_ignore.txt
Expand Up @@ -7,7 +7,7 @@ pint.ok watch --listen=:6057 --pidfile=pint.pid rules
cmp curl.txt metrics.txt

-- test.sh --
sleep 15
sleep 3
curl -s http://127.0.0.1:6057/metrics | grep 'pint_' | perl -pe "s/^([a-zA-Z].+)[ ]([0-9\.\-\+eE]+)$/\1/g" > curl.txt
cat pint.pid | xargs kill
cat prometheus.pid | xargs kill
Expand Down

0 comments on commit c6c9b5b

Please sign in to comment.