Skip to content

Commit 08c7b66

Browse files
committed
dns_test: Added setup.sh which sets up env for dns test
1 parent d03392b commit 08c7b66

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

test/net/integration/dns/setup.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
# Sets up the environment needed for running the DNS test
4+
OUTWARD_FACING_INTERFACE=ens3
5+
BRIDGE_INTERFACE=bridge43
6+
7+
# Enable ip forwarding
8+
sudo sysctl -w net.ipv4.ip_forward=1
9+
10+
# Create iptables rules for NATing all DNS requests
11+
12+
# Masks the source address
13+
sudo iptables -t nat -A POSTROUTING -o $OUTWARD_FACING_INTERFACE -j MASQUERADE
14+
15+
# Udp packets coming from bridge43 should be natted
16+
sudo iptables -t nat -A PREROUTING -i $BRIDGE_INTERFACE -p udp -m udp

test/net/integration/dns/test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import sys
44
import os
5+
import subprocess
56

67
includeos_src = os.environ.get('INCLUDEOS_SRC',
78
os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))).split('/test')[0])
@@ -10,6 +11,9 @@
1011
from vmrunner import vmrunner
1112
from vmrunner.prettify import color
1213

14+
# Install build dependencies, ip forwarding
15+
subprocess.call(["bash", "setup.sh"])
16+
1317
# Get an auto-created VM from the vmrunner
1418
vm = vmrunner.vms[0]
1519

test/net/integration/dns/vm.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"image" : "test_dns.img",
33
"net" : [{"device" : "virtio", "mac" : "c0:01:0a:00:00:2a"}],
4-
"mem" : 128
4+
"mem" : 128,
5+
"intrusive" : "True"
56
}

0 commit comments

Comments
 (0)