| [404d2b] | 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 |  | 
|---|
| [51a013] | 6 | WORKERPORT=11055 | 
|---|
|  | 7 | CONTROLLERPORT=11056 | 
|---|
|  | 8 | WORKERLISTENPORT=11057 | 
|---|
| [404d2b] | 9 |  | 
|---|
|  | 10 | # start service in background | 
|---|
|  | 11 | ${AUTOTEST_PATH}/JobMarketServer --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}/JobMarketPoolWorker -h], 1, [ignore], [ignore], [kill $server_pid]) | 
|---|
|  | 17 |  | 
|---|
|  | 18 | # let worker enroll in pool | 
|---|
|  | 19 | ${AUTOTEST_PATH}/JobMarketPoolWorker -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}/JobMarketController --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}/JobMarketController --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 | 
|---|