[404d2b] | 1 | ### fragment the molecule and check the number of configs
|
---|
| 2 |
|
---|
| 3 | AT_SETUP([Fragmentation - Automation: Dead Worker is removed])
|
---|
| 4 | AT_KEYWORDS([fragmentation automation controller poolworker server checkalive])
|
---|
| 5 |
|
---|
[51a013] | 6 | WORKERPORT=11075
|
---|
| 7 | CONTROLLERPORT=11076
|
---|
| 8 | WORKERLISTENPORT=11077
|
---|
[404d2b] | 9 |
|
---|
| 10 | TIMEOUT=3
|
---|
| 11 |
|
---|
| 12 | # start service in background
|
---|
| 13 | ${AUTOTEST_PATH}/JobMarketServer -v 5 --workerport $WORKERPORT --controllerport $CONTROLLERPORT --timeout $TIMEOUT &
|
---|
| 14 | server_pid=$!
|
---|
| 15 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
|
---|
| 16 |
|
---|
| 17 | # let worker enroll in pool
|
---|
| 18 | ${AUTOTEST_PATH}/JobMarketPoolWorker -v 5 --signal 2 --server 127.0.0.1:${WORKERPORT} --hostname 127.0.0.1 --listen $WORKERLISTENPORT &
|
---|
| 19 | worker_pid=$!
|
---|
| 20 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
| 21 |
|
---|
| 22 | # create script to call
|
---|
| 23 | AT_DATA([sleep.sh], [#!/bin/bash
|
---|
| 24 | sleep `cat <$1`
|
---|
| 25 | ])
|
---|
| 26 | AT_CHECK([chmod +x sleep.sh], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
| 27 | # add one jobs via JobAdder that needs at least TIMEOUT time
|
---|
| 28 | AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command createjobs --executable "./sleep.sh" --jobcommand "3"], 0, [stdout], [ignore], [kill $server_pid])
|
---|
| 29 | AT_CHECK([fgrep "Sending 1 jobs ..." stdout], 0, [ignore], [ignore], [kill $server_pid])
|
---|
| 30 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
| 31 |
|
---|
| 32 | # send kill signal to worker such that it shuts down _not_ properly
|
---|
| 33 | AT_CHECK([kill -9 $worker_pid], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
|
---|
| 34 |
|
---|
| 35 | # let more than timeout time pass
|
---|
| 36 | let timetopass=2*$TIMEOUT
|
---|
| 37 | AT_CHECK([sleep $timetopass], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
| 38 |
|
---|
| 39 | # clear resubmit job from queue
|
---|
| 40 | AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command removealljobs], 0, [stdout], [ignore], [kill $server_pid])
|
---|
| 41 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
|
---|
| 42 |
|
---|
| 43 | # shutdown server, should be without glitch as no worker is left
|
---|
| 44 | AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
| 45 |
|
---|
| 46 | # check that Server is truely down
|
---|
| 47 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
| 48 | AT_CHECK([kill $server_pid $worker_pid], 1, [ignore], [ignore])
|
---|
| 49 |
|
---|
| 50 | AT_CLEANUP
|
---|