| [0bdd51b] | 1 | ### fragment the molecule and check the number of configs | 
|---|
|  | 2 |  | 
|---|
| [e70b9d] | 3 | AT_SETUP([Fragmentation - Automation: Server/Worker]) | 
|---|
|  | 4 | AT_KEYWORDS([fragmentation automation server worker]) | 
|---|
| [0bdd51b] | 5 |  | 
|---|
| [db03d9] | 6 | WORKERPORT=1025 | 
|---|
|  | 7 | CONTROLLERPORT=1026 | 
|---|
| [0bdd51b] | 8 |  | 
|---|
|  | 9 | # start service in background | 
|---|
| [db03d9] | 10 | ${AUTOTEST_PATH}/Fragmentation/Automation/Server $WORKERPORT $CONTROLLERPORT & | 
|---|
| [0bdd51b] | 11 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [pkill Server]) | 
|---|
|  | 12 |  | 
|---|
| [778abb] | 13 | # add two jobs | 
|---|
|  | 14 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/JobAdder 127.0.0.1 $CONTROLLERPORT 2], 0, [ignore], [ignore], [pkill Server]) | 
|---|
|  | 15 |  | 
|---|
| [db03d9] | 16 | # first worker has a job | 
|---|
|  | 17 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Worker 127.0.0.1 $WORKERPORT], 0, [stdout], [ignore], [pkill Server]) | 
|---|
| [ef2767] | 18 | AT_CHECK([fgrep "Job id: 1" stdout], 0, [ignore], [ignore], [pkill Server]) | 
|---|
| [db03d9] | 19 |  | 
|---|
| [3c4a5e] | 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 |  | 
|---|
| [778abb] | 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]) | 
|---|
| [0bdd51b] | 27 |  | 
|---|
| [0196c6] | 28 | # shutdown controller socket | 
|---|
|  | 29 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Shutdowner 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [pkill Server]) | 
|---|
|  | 30 |  | 
|---|
| [0bdd51b] | 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 | 
|---|