Skip to content

Commit 51fd64a

Browse files
Antonio Ojeaaojea
Antonio Ojea
authored andcommitted
fix tests
1 parent fe40c06 commit 51fd64a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/tests.bats

+5-3
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,16 @@ teardown() {
167167

168168
@test "TCP listen without iptables" {
169169
sudo ip netns exec SouthNS bash -c '../bin/netkat --listen 1.1.1.2 9090 > /tmp/test_output.log' 3>&- &
170+
sleep 1
170171
sudo ip netns exec NorthNS bash -c "cat ./test_short.log | nc 1.1.1.2 9090"
171172
run diff ./test_short.log /tmp/test_output.log
172173
[ "$status" -eq 0 ]
173174
}
174175

175176
@test "TCP listen without iptables long file" {
176177
sudo ip netns exec SouthNS bash -c '../bin/netkat --listen 1.1.1.2 9090 > /tmp/test_output.log' 3>&- &
177-
sudo ip netns exec NorthNS bash -c "cat ./test_long.log | nc 9090"
178+
sleep 1
179+
sudo ip netns exec NorthNS bash -c "cat ./test_long.log | nc 1.1.1.2 9090"
178180
run diff ./test_long.log /tmp/test_output.log
179181
[ "$status" -eq 0 ]
180182
}
@@ -206,7 +208,7 @@ teardown() {
206208

207209
@test "TCP listen with iptables in input" {
208210
# add iptables rule to block traffic
209-
sudo ip netns exec NorthNS bash -c "iptables -A INPUT -d 1.1.1.2 -j DROP"
211+
sudo ip netns exec SouthNS bash -c "iptables -A INPUT -d 1.1.1.2 -j DROP"
210212
# verify it actually drops traffic
211213
run sudo ip netns exec NorthNS ping -c 1 1.1.1.2
212214
[ "$status" -eq 1 ]
@@ -219,7 +221,7 @@ teardown() {
219221

220222
@test "TCP listen with iptables in input long file" {
221223
# add iptables rule to block traffic
222-
sudo ip netns exec NorthNS bash -c "iptables -A INPUT -d 1.1.1.2 -j DROP"
224+
sudo ip netns exec SouthNS bash -c "iptables -A INPUT -d 1.1.1.2 -j DROP"
223225
# verify it actually drops traffic
224226
run sudo ip netns exec NorthNS ping -c 1 1.1.1.2
225227
[ "$status" -eq 1 ]

0 commit comments

Comments
 (0)