# Works in simple mode when single --alertmanager.uri flag is passed

exec bash -x ./test.sh &
exec karma --pid-file=karma.pid --alertmanager.uri=http://127.0.0.1:7035 --listen.address=127.0.0.1 --listen.port=8035 --log.requests
! stdout .
stderr 'level=INFO msg="Request completed" address=127.0.0.1 path=/alerts.json duration=.+ method=POST code=200 bytes=[0-9]+'
stderr 'level=INFO msg="Request completed" address=127.0.0.1 path=/alerts.json duration=.+ method=POST code=200 bytes=[0-9]+'
wait

-- test.sh --
while [ ! -f karma.pid ]; do sleep 1 ; done
sleep 1
curl -XPOST -d @request.json -so /dev/null http://127.0.0.1:8035/alerts.json
curl -XPOST -d @request.json -so /dev/null http://127.0.0.1:8035/alerts.json
cat karma.pid | xargs kill

-- request.json --
{
    "filters": [],
    "gridLabel": "@auto",
    "gridSortReverse": false,
    "gridLimits": {},
    "sortOrder": "",
    "sortLabel": "",
    "sortReverse": false
}
