| [a06358c] | 1 | ### fragment the molecule and check the number of configs
 | 
|---|
 | 2 | 
 | 
|---|
 | 3 | AT_SETUP([Fragmentation - Automation: Worker enrolls in pool])
 | 
|---|
 | 4 | AT_KEYWORDS([fragmentation automation controller poolworker server shutdown])
 | 
|---|
 | 5 | 
 | 
|---|
 | 6 | WORKERPORT=1055
 | 
|---|
 | 7 | CONTROLLERPORT=1056
 | 
|---|
 | 8 | WORKERLISTENPORT=1057
 | 
|---|
 | 9 | 
 | 
|---|
 | 10 | # start service in background
 | 
|---|
| [cc5db5] | 11 | ${AUTOTEST_PATH}/Server --workerport $WORKERPORT --controllerport $CONTROLLERPORT &
 | 
|---|
| [a06358c] | 12 | server_pid=$!
 | 
|---|
 | 13 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
 | 
|---|
 | 14 | 
 | 
|---|
| [5ac92e] | 15 | # check help of poolworker
 | 
|---|
| [cc5db5] | 16 | AT_CHECK([${AUTOTEST_PATH}/PoolWorker -h], 1, [ignore], [ignore], [kill $server_pid])
 | 
|---|
| [5ac92e] | 17 | 
 | 
|---|
| [a06358c] | 18 | # let worker enroll in pool
 | 
|---|
| [cc5db5] | 19 | ${AUTOTEST_PATH}/PoolWorker -v 5 --signal 2 --server 127.0.0.1:${WORKERPORT} --hostname 127.0.0.1 --listen $WORKERLISTENPORT &
 | 
|---|
| [a06358c] | 20 | worker_pid=$!
 | 
|---|
 | 21 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
 | 
|---|
 | 22 | 
 | 
|---|
| [469f53] | 23 | # add one jobs via JobAdder
 | 
|---|
| [cc5db5] | 24 | AT_CHECK([${AUTOTEST_PATH}/Controller --server 127.0.0.1:$CONTROLLERPORT --command createjobs --executable "cat" --jobcommand "Nothing"], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
 | 
|---|
| [469f53] | 25 | AT_CHECK([fgrep "Sending 1 jobs ..." stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
 | 
|---|
 | 26 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
 | 
|---|
 | 27 | 
 | 
|---|
| [5ac92e] | 28 | # send kill signal to worker such that it shuts down properly
 | 
|---|
 | 29 | AT_CHECK([kill -2 $worker_pid], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
 | 
|---|
| [a06358c] | 30 | 
 | 
|---|
 | 31 | # shutdown server as well
 | 
|---|
| [cc5db5] | 32 | AT_CHECK([${AUTOTEST_PATH}/Controller --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
 | 
|---|
| [a06358c] | 33 | 
 | 
|---|
 | 34 | # check that Server is truely down
 | 
|---|
 | 35 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
 | 
|---|
 | 36 | AT_CHECK([kill $server_pid $worker_pid], 1, [ignore], [ignore])
 | 
|---|
 | 37 | 
 | 
|---|
 | 38 | AT_CLEANUP
 | 
|---|