Skip to content

Commit

Permalink
Merge pull request #11 from ksurl/nftables-testing
Browse files Browse the repository at this point in the history
add testing for nftables
  • Loading branch information
kaysond authored Dec 4, 2021
2 parents 0882afb + e51a538 commit fb257be
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/containers/trafficjam_test/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
sleep infinity
8 changes: 8 additions & 0 deletions test/docker-compose-nftables.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3.8'
services:
trafficjam_test:
image: trafficjam_test
container_name: trafficjam_test_nftables
environment:
NFTABLES: "true"
privileged: true
9 changes: 9 additions & 0 deletions test/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

0 comments on commit fb257be

Please sign in to comment.