[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 |
|
---|
[03195a] | 6 | # check that ports are unique over all tests such that they may run in parallel
|
---|
[db03d9] | 7 | WORKERPORT=1025
|
---|
| 8 | CONTROLLERPORT=1026
|
---|
[0bdd51b] | 9 |
|
---|
| 10 | # start service in background
|
---|
[db03d9] | 11 | ${AUTOTEST_PATH}/Fragmentation/Automation/Server $WORKERPORT $CONTROLLERPORT &
|
---|
[03195a] | 12 | server_pid=$!
|
---|
| 13 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
|
---|
[0bdd51b] | 14 |
|
---|
[778abb] | 15 | # add two jobs
|
---|
[03195a] | 16 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/JobAdder 127.0.0.1 $CONTROLLERPORT 2], 0, [ignore], [ignore], [kill $server_pid])
|
---|
[778abb] | 17 |
|
---|
[db03d9] | 18 | # first worker has a job
|
---|
[03195a] | 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])
|
---|
[db03d9] | 21 |
|
---|
[3c4a5e] | 22 | # check number of done jobs
|
---|
[03195a] | 23 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/ResultChecker 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [kill $server_pid])
|
---|
| 24 | AT_CHECK([fgrep "1 jobs are calculated so far" stdout], 0, [ignore], [ignore], [kill $server_pid])
|
---|
[3c4a5e] | 25 |
|
---|
[778abb] | 26 | # second worker has a job, but then there are no more, hence socket powered down
|
---|
[03195a] | 27 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Worker 127.0.0.1 $WORKERPORT], 0, [stdout], [ignore], [kill $server_pid])
|
---|
| 28 | AT_CHECK([fgrep "Job id: 2" stdout], 0, [ignore], [ignore], [kill $server_pid])
|
---|
[0bdd51b] | 29 |
|
---|
[c837ad0] | 30 | # get results
|
---|
| 31 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/ResultGetter 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [pkill Server])
|
---|
| 32 | AT_CHECK([fgrep "Received 2 results" stdout], 0, [ignore], [ignore], [pkill Server])
|
---|
| 33 |
|
---|
[0196c6] | 34 | # shutdown controller socket
|
---|
[03195a] | 35 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Shutdowner 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [kill $server_pid])
|
---|
[0196c6] | 36 |
|
---|
[0bdd51b] | 37 | # check that server is truely down
|
---|
[03195a] | 38 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
|
---|
| 39 | AT_CHECK([kill $server_pid], 1, [ignore], [ignore])
|
---|
[0bdd51b] | 40 |
|
---|
| 41 | AT_CLEANUP
|
---|