| 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 one jobs
|
|---|
| 16 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/JobAdder 127.0.0.1 $CONTROLLERPORT 1], 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 | # check number of done jobs
|
|---|
| 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])
|
|---|
| 25 |
|
|---|
| 26 | # shutdown controller socket
|
|---|
| 27 | AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Shutdowner 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [kill $server_pid])
|
|---|
| 28 |
|
|---|
| 29 | # check that server is truely down
|
|---|
| 30 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
|
|---|
| 31 | AT_CHECK([kill $server_pid], 1, [ignore], [ignore])
|
|---|
| 32 |
|
|---|
| 33 | AT_CLEANUP
|
|---|