StackStorm / st2-docker

StackStorm docker-compose deployment
https://docs.stackstorm.com/install/docker.html
Apache License 2.0
188 stars 158 forks source link

Add BATS testing #228

Closed minsis closed 3 years ago

minsis commented 3 years ago

Adds a basic BATS smoke test to verify the st2-docker stack is functional.

Closes #197

minsis commented 3 years ago

https://github.com/StackStorm/st2-docker/blob/a6aa05c890005eb2ddc87253c2ac42a62a078469/.circleci/config.yml#L29-L39

I guess I should've read this a bit closer for the circleci stuff. I'm assuming the above only needs to be replaced with something as simple as

command: docker-compose -f tests/st2tests.yaml

The only thing I'm not sure about is this container does an exit code. I'm not sure how circleci handles that? I'm guessing it passes on == 0 and fails on != 0

arm4b commented 3 years ago

That's correct. Non-zero exit code should indicate a failure in CircleCI.

Let's see what CircleCI says after running the tests there.

minsis commented 3 years ago

Tests failed because docker-compose by default uses the top-level directory name for creating its namespace. In the circle ci config its set to ~/docker.

docker-compose up --detach
Creating network "docker_private" with driver "bridge"
Creating network "docker_public" with driver "bridge"
docker-compose -f tests/st2tests.yaml up
Creating network "tests_default" with the default driver
ERROR: Network st2-docker_private declared as external, but could not be found. Please create the network manually using `docker network create st2-docker_private` and try again.

So a couple of things:

  1. We can rename ~/docker to ~/st2-docker
  2. I can try and play around with the $CIRCLE_WORKING_DIRECTORY environment variable . It would be adding it the network naming scheme inside the compose file and I dont know if that can be done. - This option doesn't work

Step 1 is easiest way to deal with this unless there was some specific reason the working directory needed to be called docker

minsis commented 3 years ago

Step 2 above fails.

networks:
   ${CIRCLE_WORKING_DIRECTORY:-st2-docker_private}:
    external: true
WARNING: Some networks were defined but are not used by any service: ${CIRCLE_WORKING_DIRECTORY:-st2-docker_private}
ERROR: Service "st2test" uses an undefined network "st2-docker_private"
minsis commented 3 years ago

I changed the working dir name to ~/st2-docker and build is passing now.

closes #197