4. How to execute tests in ArmoniK.Core?
4.1. Unit tests independent of deployment
ArmoniK.Core employs the Nunit framework for all its unit tests. A first option is to execute them directly in an IDE compatible with the framework. The second option is to open a terminal, navigate to the folder where the test project is located and do:
dotnet test
4.2. Unit tests that need partial deployment
Before test execution, you need a partial deployment that sets up the container running the service that the test aims to target. For example, for the case of ArmoniK.Core.Adapters.RabbitMQ.Tests, execute:
just queue=rabbitmq deployTargetQueue
For ArmoniK.Core.Adapters.LocalStorage.Tests deploy with local object storage:
just object=local deployTargetObject
And so you can execute the corresponding tests:
via your code editor
or in your command line, navigate to the folder where the test project is located and do:
dotnet test
4.3. Integration tests
HtcMock, Stream and Bench are integration tests that require a full deployment. To be able to run these tests, you need first to deploy ArmoniK.Core with the appropriate values for the parameter worker: htcmock, stream or bench. If you don’t specify any value for this parameter, it’s set to htcmock by default.
4.3.1. Htcmock
The default deployment is done with htcmock worker:
just build-deploy
After this deployment, there is a just recipe that allows to build the docker image to test htcmock worker, you can use this recipe to build the image:
just tag=<tag> buildHtcmockClient
The tag parameter is the tag of the image to be built. If you don’t specify any tag, the tag will be 0.0.0.0-local. You can choose the tag of an image that exists locally, or an image of another version.
Finally execute the test using:
docker run --net armonik_network --rm \
-e HtcMock__NTasks=100 \
-e HtcMock__TotalCalculationTime=00:00:00.100 \
-e HtcMock__DataSize=1 \
-e HtcMock__MemorySize=1 \
-e HtcMock__EnableFastCompute=true \
-e HtcMock__SubTasksLevels=1 \
-e HtcMock__Partition=TestPartition0 \
-e GrpcClient__Endpoint=http://armonik.control.submitter:1080 \
dockerhubaneo/armonik_core_htcmock_test_client:TAG
You will need to replace TAG by the tag of the image armonik_core_htcmock_test_client you want to test.
4.3.2. Stream
Deploy using stream worker:
just worker=stream build-deploy
Now, you can execute the tests using your code editor, or via the command line. In the latter case, go to the folder where the tests are located and type:
dotnet test
Another option is to use the recipe to build the docker image for stream worker:
just tag=<tag> buildStreamClient
Then:
docker run --net armonik_network --rm \
-e Partition=TestPartition0 \
-e GrpcClient__Endpoint=http://armonik.control.submitter:1080 \
dockerhubaneo/armonik_core_stream_test_client:TAG
Don’t forget to replace TAG by the tag of your image armonik_core_stream_test_client.
4.3.3. Bench
Deploy using bench worker:
just worker=bench build-deploy
Build the docker image:
just <tag=tag> buildBenchClient
Execute the tests using:
docker run --net armonik_network --rm \
-e BenchOptions__NTasks=200 \
-e BenchOptions__TaskDurationMs=100 \
-e GrpcClient__Endpoint=http://armonik.control.submitter:1080 \
dockerhubaneo/armonik_core_bench_test_client:TAG
Consider replacing TAG by the tag of your image armonik_core_bench_test_client.