| 1 | ### fragment the molecule and check the number of configs | 
|---|
| 2 |  | 
|---|
| 3 | AT_SETUP([Fragmentation - Automation]) | 
|---|
| 4 | AT_KEYWORDS([fragmentation automation worker]) | 
|---|
| 5 |  | 
|---|
| 6 | WORKERPORT=1025 | 
|---|
| 7 | CONTROLLERPORT=1026 | 
|---|
| 8 |  | 
|---|
| 9 | # start service in background | 
|---|
| 10 | ${AUTOTEST_PATH}/Fragmentation/Automation/Server $WORKERPORT $CONTROLLERPORT & | 
|---|
| 11 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [pkill Server]) | 
|---|
| 12 |  | 
|---|
| 13 | # add a job | 
|---|
| 14 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/JobAdder 127.0.0.1 $CONTROLLERPORT 1], 0, [stdout], [ignore], [pkill Server]) | 
|---|
| 15 | # first worker has a job | 
|---|
| 16 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Worker 127.0.0.1 $WORKERPORT], 0, [stdout], [ignore], [pkill Server]) | 
|---|
| 17 | AT_CHECK([fgrep "Job id: 1" stdout], 0, [ignore], [ignore], [pkill Server]) | 
|---|
| 18 |  | 
|---|
| 19 | # check number of done jobs | 
|---|
| 20 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/ResultChecker 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [pkill Server]) | 
|---|
| 21 | AT_CHECK([fgrep "1 jobs are calculated so far" stdout], 0, [ignore], [ignore], [pkill Server]) | 
|---|
| 22 |  | 
|---|
| 23 | # add no job to shutdown socket | 
|---|
| 24 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/JobAdder 127.0.0.1 $CONTROLLERPORT 0], 0, [stdout], [ignore], [pkill Server]) | 
|---|
| 25 | # third job has none | 
|---|
| 26 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Worker 127.0.0.1 $WORKERPORT], 1, [stdout], [ignore], [pkill Server]) | 
|---|
| 27 | AT_CHECK([fgrep "The server has no job for me" stdout], 0, [ignore], [ignore], [pkill Server]) | 
|---|
| 28 |  | 
|---|
| 29 | # check that server is truely down | 
|---|
| 30 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [pkill Server]) | 
|---|
| 31 | AT_CHECK([pkill Server], 1, [ignore], [ignore]) | 
|---|
| 32 |  | 
|---|
| 33 | AT_CLEANUP | 
|---|