Problem
How do I run a modular test when the value of $ACS_INSTANCE is not known until run-time?
Solution
This FAQ section explains in detail how to configure tat modular tests to run dynamically ensuring that managers, containers, and clients all agree on port numbers.
Q: How do I setup modular tests to run independent of any specific value of $ACS_INSTANCE?
This is a common problem because the acsStart script is "intelligent" enough to pick another port to run ACS under (if 0 has already been taken), but this information is not communicated to containers or clients.
A: ACS provides a few $ACS_INSTANCE aware scripts designed to be used in modular tests
With the release of ACS 3.1, three new scripts have been provided which have been made tat friendly so to speak. In short, you should not cut and paste code from these scripts but instead use them directly. acsutilTATPrologue is a substitute for acsStart and acsutilTATEpilogue is to be used instead of acsStop. acsutilTATTestRunner does not replace any old command, but instead should be prepended to old commands (if this is confusing see the examples below). More detailed descriptions of the new scripts are as follows:
- acsutilTATPrologue - runs acsStart command and saves the $ACS_INSTANCE to a file in $ACS_TMP/. Developers must ensure $ACS_TMP is unique by setting this environment variable using the SOURCE directive in their TestList.lite file. Pass the
-loption to force the storage of all logs to$ACS_TMP/all_logs.xml - acsutilTATTestRunner - runs any command(s) specified as parameters to this script, but first exports the $ACS_INSTANCE found in $ACS_TMP. Sample usage could be "acsutilTATTestRunner acsStartContainer -java frodoContainer"
- acsutilTATEpilogue - runs acsStop using the $ACS_INSTANCE found in $ACS_TMP
- acsutilAwaitContainerStart - runs a container as a background process (using acsutilTATTestRunner) only returning control after the container has activated any immortal components it's responsible for. Executed with the same parameters as acsStartContainer. Please take special note that for C++ containers standard error must be sent to /dev/null or standard out (see example below)!
An example of a TestList.lite utilizing these scripts:
SOURCE acsncTATEnvironment PROLOGUE acsutilTATPrologue MyTestScript EPILOGUE acsutilTATEpilogue
An example implementation of acsncTATEnvironment specified in the TestList.lite above:
set ACS_TMP $env(PWD)/tmp set env(ACS_TMP) $ACS_TMP
An example implementation of MyTestScript specified in the TestList.lite above:
#! /bin/bash acsutilAwaitContainerStart -cpp bilboContainer 2>1 #"2>1" is necessary for C++ containers only acsutilAwaitContainerStart -java frodoContainer acsutilAwaitContainerStart -py aragornContainer acsutilTATTestRunner acsexmplClient acsutilTATTestRunner acsStopContainer bilboContainer