diff --git a/test/containers/trafficjam_test/entrypoint.sh b/test/containers/trafficjam_test/entrypoint.sh index 33589fe..86d1562 100755 --- a/test/containers/trafficjam_test/entrypoint.sh +++ b/test/containers/trafficjam_test/entrypoint.sh @@ -1,4 +1,9 @@ #!/usr/bin/env bash + +#Check for nftables testing +if [[ -n "$NFTABLES" ]]; then + ln -s /sbin/xtables-nft-multi /sbin/iptables -f +fi /usr/local/bin/dockerd-entrypoint.sh dockerd & #Wait for docker startup for 60s while ! docker ps; do @@ -10,4 +15,4 @@ while ! docker ps; do done docker build -t trafficjam /opt/trafficjam || exit 1; docker build -t whoami /opt/trafficjam/test/containers/whoami || exit 1; -sleep infinity \ No newline at end of file +sleep infinity diff --git a/test/docker-compose-nftables.yml b/test/docker-compose-nftables.yml new file mode 100644 index 0000000..0020da4 --- /dev/null +++ b/test/docker-compose-nftables.yml @@ -0,0 +1,8 @@ +version: '3.8' +services: + trafficjam_test: + image: trafficjam_test + container_name: trafficjam_test_nftables + environment: + NFTABLES: "true" + privileged: true \ No newline at end of file diff --git a/test/test.bats b/test/test.bats index 93e8e9f..a68cf46 100644 --- a/test/test.bats +++ b/test/test.bats @@ -19,6 +19,14 @@ docker exec trafficjam_test bats /opt/trafficjam/test/test-dind.bats } +@test "Deploy the non-swarm environment with nftables" { + docker-compose -f "$BATS_TEST_DIRNAME"/docker-compose-nftables.yml up -d +} + +@test "Test the non-swarm environment with nftables" { + docker exec trafficjam_test_nftables bats /opt/trafficjam/test/test-dind.bats +} + @test "Deploy the swarm environment" { docker-compose -f "$BATS_TEST_DIRNAME"/docker-compose-swarm.yml up -d docker exec swarm-manager docker swarm init @@ -36,6 +44,7 @@ function teardown_file() { docker-compose -f "$BATS_TEST_DIRNAME"/docker-compose.yml down + docker-compose -f "$BATS_TEST_DIRNAME"/docker-compose-nftables.yml down docker-compose -f "$BATS_TEST_DIRNAME"/docker-compose-swarm.yml down docker image rm --force trafficjam_bats trafficjam_test }