| 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 | 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 two jobs | 
|---|
| 14 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/JobAdder 127.0.0.1 $CONTROLLERPORT 2], 0, [ignore], [ignore], [pkill Server]) | 
|---|
| 15 |  | 
|---|
| 16 | # first worker has a job | 
|---|
| 17 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Worker 127.0.0.1 $WORKERPORT], 0, [stdout], [ignore], [pkill Server]) | 
|---|
| 18 | AT_CHECK([fgrep "Job id: 1" stdout], 0, [ignore], [ignore], [pkill Server]) | 
|---|
| 19 |  | 
|---|
| 20 | # check number of done jobs | 
|---|
| 21 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/ResultChecker 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [pkill Server]) | 
|---|
| 22 | AT_CHECK([fgrep "1 jobs are calculated so far" stdout], 0, [ignore], [ignore], [pkill Server]) | 
|---|
| 23 |  | 
|---|
| 24 | # second worker has a job, but then there are no more, hence socket powered down | 
|---|
| 25 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Worker 127.0.0.1 $WORKERPORT], 0, [stdout], [ignore], [pkill Server]) | 
|---|
| 26 | AT_CHECK([fgrep "Job id: 2" stdout], 0, [ignore], [ignore], [pkill Server]) | 
|---|
| 27 |  | 
|---|
| 28 | # shutdown controller socket | 
|---|
| 29 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Shutdowner 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [pkill Server]) | 
|---|
| 30 |  | 
|---|
| 31 | # check that server is truely down | 
|---|
| 32 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [pkill Server]) | 
|---|
| 33 | AT_CHECK([pkill Server], 1, [ignore], [ignore]) | 
|---|
| 34 |  | 
|---|
| 35 | AT_CLEANUP | 
|---|