Skip to content

Commit fb257be

Browse files
authored
Merge pull request #11 from ksurl/nftables-testing
add testing for nftables
2 parents 0882afb + e51a538 commit fb257be

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

test/containers/trafficjam_test/entrypoint.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
#!/usr/bin/env bash
2+
3+
#Check for nftables testing
4+
if [[ -n "$NFTABLES" ]]; then
5+
ln -s /sbin/xtables-nft-multi /sbin/iptables -f
6+
fi
27
/usr/local/bin/dockerd-entrypoint.sh dockerd &
38
#Wait for docker startup for 60s
49
while ! docker ps; do
@@ -10,4 +15,4 @@ while ! docker ps; do
1015
done
1116
docker build -t trafficjam /opt/trafficjam || exit 1;
1217
docker build -t whoami /opt/trafficjam/test/containers/whoami || exit 1;
13-
sleep infinity
18+
sleep infinity

test/docker-compose-nftables.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: '3.8'
2+
services:
3+
trafficjam_test:
4+
image: trafficjam_test
5+
container_name: trafficjam_test_nftables
6+
environment:
7+
NFTABLES: "true"
8+
privileged: true

test/test.bats

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
docker exec trafficjam_test bats /opt/trafficjam/test/test-dind.bats
2020
}
2121

22+
@test "Deploy the non-swarm environment with nftables" {
23+
docker-compose -f "$BATS_TEST_DIRNAME"/docker-compose-nftables.yml up -d
24+
}
25+
26+
@test "Test the non-swarm environment with nftables" {
27+
docker exec trafficjam_test_nftables bats /opt/trafficjam/test/test-dind.bats
28+
}
29+
2230
@test "Deploy the swarm environment" {
2331
docker-compose -f "$BATS_TEST_DIRNAME"/docker-compose-swarm.yml up -d
2432
docker exec swarm-manager docker swarm init
@@ -36,6 +44,7 @@
3644

3745
function teardown_file() {
3846
docker-compose -f "$BATS_TEST_DIRNAME"/docker-compose.yml down
47+
docker-compose -f "$BATS_TEST_DIRNAME"/docker-compose-nftables.yml down
3948
docker-compose -f "$BATS_TEST_DIRNAME"/docker-compose-swarm.yml down
4049
docker image rm --force trafficjam_bats trafficjam_test
4150
}

0 commit comments

Comments
 (0)