| 1 | ### fragment the molecule and check the number of configs | 
|---|
| 2 |  | 
|---|
| 3 | AT_SETUP([Fragmentation - Automation: Worker sets false hostname]) | 
|---|
| 4 | AT_KEYWORDS([fragmentation automation controller poolworker server falsehost]) | 
|---|
| 5 |  | 
|---|
| 6 | WORKERPORT=11080 | 
|---|
| 7 | CONTROLLERPORT=11081 | 
|---|
| 8 | WORKERLISTENPORT=11082 | 
|---|
| 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 falsehost --listen $WORKERLISTENPORT & | 
|---|
| 19 | worker_pid=$! | 
|---|
| 20 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid]) | 
|---|
| 21 |  | 
|---|
| 22 | # remove worker: server will fail to resolve hostname and remove address from  pool | 
|---|
| 23 | AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command removeall], 0, [ignore], [ignore], [kill $server_pid $worker_pid]) | 
|---|
| 24 | AT_CHECK([sleep 4], 0, [ignore], [ignore], [kill $server_pid $worker_pid]) | 
|---|
| 25 | AT_CHECK([kill -s 0 $server_pid], 0, [ignore], [ignore], [kill $server_pid $worker_pid]) | 
|---|
| 26 | AT_CHECK([kill -s 0 $worker_pid], 0, [ignore], [ignore], [kill $server_pid $worker_pid]) | 
|---|
| 27 |  | 
|---|
| 28 | # shutdown server, should terminate as no workers are left | 
|---|
| 29 | AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [ignore], [ignore], [kill $server_pid $worker_pid]) | 
|---|
| 30 |  | 
|---|
| 31 | # we have to kill worker as he cannot know that Server is gone | 
|---|
| 32 | AT_CHECK([kill $worker_pid], 0, [ignore], [ignore], [kill $server_pid $worker_pid]) | 
|---|
| 33 |  | 
|---|
| 34 | # check that Server is truly down | 
|---|
| 35 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid]) | 
|---|
| 36 | AT_CHECK([kill $server_pid], 1, [ignore], [ignore], [kill $worker_pid]) | 
|---|
| 37 | AT_CHECK([kill $worker_pid], 1, [ignore], [ignore]) | 
|---|
| 38 |  | 
|---|
| 39 | AT_CLEANUP | 
|---|