| 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 | 
|---|
| 11 | ${AUTOTEST_PATH}/Server --workerport $WORKERPORT --controllerport $CONTROLLERPORT & | 
|---|
| 12 | server_pid=$! | 
|---|
| 13 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid]) | 
|---|
| 14 |  | 
|---|
| 15 | # check help of poolworker | 
|---|
| 16 | AT_CHECK([${AUTOTEST_PATH}/PoolWorker -h], 1, [ignore], [ignore], [kill $server_pid]) | 
|---|
| 17 |  | 
|---|
| 18 | # let worker enroll in pool | 
|---|
| 19 | ${AUTOTEST_PATH}/PoolWorker -v 5 --signal 2 --server 127.0.0.1:${WORKERPORT} --hostname 127.0.0.1 --listen $WORKERLISTENPORT & | 
|---|
| 20 | worker_pid=$! | 
|---|
| 21 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid]) | 
|---|
| 22 |  | 
|---|
| 23 | # add one jobs via JobAdder | 
|---|
| 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]) | 
|---|
| 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 |  | 
|---|
| 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]) | 
|---|
| 30 |  | 
|---|
| 31 | # shutdown server as well | 
|---|
| 32 | AT_CHECK([${AUTOTEST_PATH}/Controller --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [ignore], [ignore], [kill $server_pid $worker_pid]) | 
|---|
| 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 | 
|---|