Skip to content

Commit 7ecc4a2

Browse files
committed
test/system: Remove slirp
Signed-off-by: Lokesh Mandvekar <[email protected]>
1 parent 3e97e2d commit 7ecc4a2

File tree

4 files changed

+2
-105
lines changed

4 files changed

+2
-105
lines changed

test/system/005-info.bats

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ store.configFile | $expr_path
5252
store.graphDriverName | [a-z0-9]\\\+\\\$
5353
store.graphRoot | $expr_path
5454
store.imageStore.number | 1
55-
host.slirp4netns.executable | $expr_path
5655
"
5756

5857
defer-assertion-failures

test/system/500-networking.bats

Lines changed: 2 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,8 @@ load helpers.network
122122
# force bridge networking also for rootless
123123
# this ensures that rootless + bridge + userns + ports works
124124
network_arg="--network bridge"
125-
elif has_slirp4netns; then
126-
# Issue #9828 make sure a custom slirp4netns cidr also works
127-
network_arg="--network slirp4netns:cidr=$cidr"
128-
# slirp4netns interface ip is always .100
129-
match="${cidr%.*}.100"
130125
else
131-
echo "# [skipping subtest of $cidr - slirp4netns unavailable]" >&3
126+
echo "# [skipping subtest of $cidr]" >&3
132127
continue
133128
fi
134129

@@ -208,57 +203,6 @@ load helpers.network
208203
is "$output" "$pid" "Only ID in output (no extra errors)"
209204
}
210205

211-
# FIXME: random_rfc1918_subnet is not parallel-safe
212-
@test "podman run with slirp4ns assigns correct addresses to /etc/hosts" {
213-
has_slirp4netns || skip "slirp4netns unavailable"
214-
215-
CIDR="$(random_rfc1918_subnet)"
216-
IP=$(hostname -I | cut -f 1 -d " ")
217-
local conname=con-$(safename)
218-
run_podman run --rm --network slirp4netns:cidr="${CIDR}.0/24" \
219-
--name $conname --hostname $conname $IMAGE cat /etc/hosts
220-
is "$output" ".*${IP} host.containers.internal" "host.containers.internal should be host address"
221-
is "$output" ".*${CIDR}.100 $conname $conname" "$conname should be the cidr+100 address"
222-
223-
if is_rootless; then
224-
# check the slirp ip also works correct with userns
225-
run_podman run --rm --userns keep-id --network slirp4netns:cidr="${CIDR}.0/24" \
226-
--name $conname --hostname $conname $IMAGE cat /etc/hosts
227-
is "$output" ".*${IP} host.containers.internal" "host.containers.internal should be host address"
228-
is "$output" ".*${CIDR}.100 $conname $conname" "$conname should be the cidr+100 address"
229-
fi
230-
}
231-
232-
# FIXME: random_rfc1918_subnet is not parallel-safe
233-
@test "podman run with slirp4ns adds correct dns address to resolv.conf" {
234-
has_slirp4netns || skip "slirp4netns unavailable"
235-
236-
CIDR="$(random_rfc1918_subnet)"
237-
run_podman run --rm --network slirp4netns:cidr="${CIDR}.0/24" \
238-
$IMAGE cat /etc/resolv.conf
239-
assert "$output" =~ "nameserver ${CIDR}.3" "resolv.conf should have slirp4netns cidr+3 as first nameserver"
240-
no_userns_out="$output"
241-
242-
if is_rootless; then
243-
# check the slirp ip also works correct with userns
244-
run_podman run --rm --userns keep-id --network slirp4netns:cidr="${CIDR}.0/24" \
245-
$IMAGE cat /etc/resolv.conf
246-
assert "$output" =~ "nameserver ${CIDR}.3" "resolv.conf should have slirp4netns cidr+3 as first nameserver with userns"
247-
assert "$output" == "$no_userns_out" "resolv.conf should look the same for userns"
248-
fi
249-
250-
}
251-
252-
# FIXME: random_rfc1918_subnet is not parallel-safe
253-
@test "podman run with slirp4ns assigns correct ip address container" {
254-
has_slirp4netns || skip "slirp4netns unavailable"
255-
256-
CIDR="$(random_rfc1918_subnet)"
257-
run_podman run --rm --network slirp4netns:cidr="${CIDR}.0/24" \
258-
$IMAGE sh -c "ip address | grep ${CIDR}"
259-
is "$output" ".*inet ${CIDR}.100/24 \+" "container should have slirp4netns cidr+100 assigned to interface"
260-
}
261-
262206
# "network create" now works rootless, with the help of a special container
263207
# FIXME: random_rfc1918_subnet is not parallel-safe
264208
@test "podman network create" {
@@ -466,16 +410,6 @@ load helpers.network
466410
skip "This test needs an ipv6 nameserver in $resolve_file"
467411
fi
468412

469-
if has_slirp4netns; then
470-
# ipv4 slirp
471-
run_podman run --rm --network slirp4netns:enable_ipv6=false $IMAGE cat /etc/resolv.conf
472-
assert "$output" !~ "$ipv6_regex" "resolv.conf should not contain ipv6 nameserver"
473-
474-
# ipv6 slirp
475-
run_podman run --rm --network slirp4netns:enable_ipv6=true $IMAGE cat /etc/resolv.conf
476-
assert "$output" =~ "$ipv6_regex" "resolv.conf should contain ipv6 nameserver"
477-
fi
478-
479413
# ipv4 cni
480414
local mysubnet=$(random_rfc1918_subnet)
481415
local netname=testnet1-$(safename)
@@ -641,9 +575,6 @@ load helpers.network
641575
is "$output" "$netname" "output of 'network create'"
642576

643577
local -a networks=("$netname")
644-
if has_slirp4netns; then
645-
networks+=("slirp4netns")
646-
fi
647578
for network in "${networks[@]}"; do
648579
# Start container with the restart always policy
649580
local cname=c-$(safename)
@@ -782,10 +713,6 @@ nameserver 8.8.8.8" "nameserver order is correct"
782713
defer-assertion-failures
783714

784715
local -a netmodes=("bridge")
785-
# As of podman 5.0, slirp4netns is optional
786-
if has_slirp4netns; then
787-
netmodes+=("slirp4netns:port_handler=slirp4netns" "slirp4netns:port_handler=rootlesskit")
788-
fi
789716
# pasta only works rootless
790717
if is_rootless; then
791718
netmodes+=("pasta")
@@ -1012,16 +939,9 @@ EOF
1012939
# Now make sure we can still run a container with free ips.
1013940
run_podman run --rm --network $net1 $IMAGE true
1014941

1015-
# And now because of all the fun we have to check the same with slirp4netns and pasta because
942+
# And now because of all the fun we have to check the same with pasta because
1016943
# that uses slightly different code paths. Note this would deadlock before the fix.
1017944
# https://github.com/containers/podman/issues/21477
1018-
if has_slirp4netns; then
1019-
cname2=con2-$(safename)
1020-
run_podman 1 run --name $cname2 --network slirp4netns --restart on-failure:2 --userns keep-id $IMAGE false
1021-
wait_for_restart_count $cname2 2 "slirp4netns"
1022-
run_podman wait $cname2
1023-
fi
1024-
1025945
if is_rootless; then
1026946
# pasta can only run rootless
1027947
cname3=con3-$(safename)

test/system/700-play.bats

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,6 @@ RELABEL="system_u:object_r:container_file_t:s0"
226226
is "$output" "true" ".InfraConfig.HostNetwork"
227227
run_podman pod rm -t 0 -f $PODNAME
228228

229-
if has_slirp4netns; then
230-
run_podman kube play --network slirp4netns:port_handler=slirp4netns $TESTYAML
231-
run_podman pod inspect --format {{.InfraContainerID}} "${lines[1]}"
232-
infraID="$output"
233-
run_podman container inspect --format "{{.HostConfig.NetworkMode}}" $infraID
234-
is "$output" "slirp4netns" "network mode slirp4netns is set for the container"
235-
fi
236-
237229
run_podman pod rm -t 0 -f $PODNAME
238230

239231
run_podman kube play --network none $TESTYAML

test/system/helpers.network.bash

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# -*- bash -*-
22

3-
_cached_has_slirp4netns=
4-
53
### Feature Checks #############################################################
64

75
# has_ipv4() - Check if one default route is available for IPv4
@@ -32,18 +30,6 @@ function skip_if_no_ipv6() {
3230
fi
3331
}
3432

35-
# has_slirp4netns - Check if the slirp4netns(1) command is available
36-
function has_slirp4netns() {
37-
if [[ -z "$_cached_has_slirp4netns" ]]; then
38-
_cached_has_slirp4netns=n
39-
run_podman info --format '{{.Host.Slirp4NetNS.Executable}}'
40-
if [[ -n "$output" ]]; then
41-
_cached_has_slirp4netns=y
42-
fi
43-
fi
44-
test "$_cached_has_slirp4netns" = "y"
45-
}
46-
4733
### procfs access ##############################################################
4834

4935
# ipv6_to_procfs() - RFC 5952 IPv6 address text representation to procfs format

0 commit comments

Comments
 (0)