| 1 | ### fragment the molecule and check the number of configs | 
|---|
| 2 |  | 
|---|
| 3 | AT_SETUP([Fragmentation - Automation: Server/Worker]) | 
|---|
| 4 | AT_KEYWORDS([fragmentation automation server worker]) | 
|---|
| 5 |  | 
|---|
| 6 | # check that ports are unique over all tests such that they may run in parallel | 
|---|
| 7 | WORKERPORT=1025 | 
|---|
| 8 | CONTROLLERPORT=1026 | 
|---|
| 9 |  | 
|---|
| 10 | # start service in background | 
|---|
| 11 | ${AUTOTEST_PATH}/Fragmentation/Automation/Server $WORKERPORT $CONTROLLERPORT & | 
|---|
| 12 | server_pid=$! | 
|---|
| 13 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid]) | 
|---|
| 14 |  | 
|---|
| 15 | # add two jobs | 
|---|
| 16 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT createjobs], 0, [ignore], [ignore], [kill $server_pid]) | 
|---|
| 17 |  | 
|---|
| 18 | # first worker has a job | 
|---|
| 19 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Worker 127.0.0.1 $WORKERPORT], 0, [stdout], [ignore], [kill $server_pid]) | 
|---|
| 20 | AT_CHECK([fgrep "Job id: 1" stdout], 0, [ignore], [ignore], [kill $server_pid]) | 
|---|
| 21 |  | 
|---|
| 22 | # second worker has a job | 
|---|
| 23 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Worker 127.0.0.1 $WORKERPORT], 0, [stdout], [ignore], [kill $server_pid]) | 
|---|
| 24 | AT_CHECK([fgrep "Job id: 2" stdout], 0, [ignore], [ignore], [kill $server_pid]) | 
|---|
| 25 |  | 
|---|
| 26 | # check number of done jobs | 
|---|
| 27 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT checkresults], 0, [stdout], [ignore], [kill $server_pid]) | 
|---|
| 28 | AT_CHECK([fgrep "2 jobs are calculated so far" stdout], 0, [ignore], [ignore], [kill $server_pid]) | 
|---|
| 29 |  | 
|---|
| 30 | # shutdown controller socket | 
|---|
| 31 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT shutdown], 0, [stdout], [ignore], [kill $server_pid]) | 
|---|
| 32 |  | 
|---|
| 33 | # check that server is truely down | 
|---|
| 34 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid]) | 
|---|
| 35 | AT_CHECK([kill $server_pid], 1, [ignore], [ignore]) | 
|---|
| 36 |  | 
|---|
| 37 | AT_CLEANUP | 
|---|