Skip to content

Commit 25c4e93

Browse files
committed
test/system: Remove slirp
Signed-off-by: Lokesh Mandvekar <[email protected]>
1 parent 9ddb97f commit 25c4e93

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" {
@@ -463,16 +407,6 @@ load helpers.network
463407
skip "This test needs an ipv6 nameserver in $resolve_file"
464408
fi
465409

466-
if has_slirp4netns; then
467-
# ipv4 slirp
468-
run_podman run --rm --network slirp4netns:enable_ipv6=false $IMAGE cat /etc/resolv.conf
469-
assert "$output" !~ "$ipv6_regex" "resolv.conf should not contain ipv6 nameserver"
470-
471-
# ipv6 slirp
472-
run_podman run --rm --network slirp4netns:enable_ipv6=true $IMAGE cat /etc/resolv.conf
473-
assert "$output" =~ "$ipv6_regex" "resolv.conf should contain ipv6 nameserver"
474-
fi
475-
476410
# ipv4 cni
477411
local mysubnet=$(random_rfc1918_subnet)
478412
local netname=testnet1-$(safename)
@@ -638,9 +572,6 @@ load helpers.network
638572
is "$output" "$netname" "output of 'network create'"
639573

640574
local -a networks=("$netname")
641-
if has_slirp4netns; then
642-
networks+=("slirp4netns")
643-
fi
644575
for network in "${networks[@]}"; do
645576
# Start container with the restart always policy
646577
local cname=c-$(safename)
@@ -779,10 +710,6 @@ nameserver 8.8.8.8" "nameserver order is correct"
779710
defer-assertion-failures
780711

781712
local -a netmodes=("bridge")
782-
# As of podman 5.0, slirp4netns is optional
783-
if has_slirp4netns; then
784-
netmodes+=("slirp4netns:port_handler=slirp4netns" "slirp4netns:port_handler=rootlesskit")
785-
fi
786713
# pasta only works rootless
787714
if is_rootless; then
788715
netmodes+=("pasta")
@@ -1009,16 +936,9 @@ EOF
1009936
# Now make sure we can still run a container with free ips.
1010937
run_podman run --rm --network $net1 $IMAGE true
1011938

1012-
# And now because of all the fun we have to check the same with slirp4netns and pasta because
939+
# And now because of all the fun we have to check the same with pasta because
1013940
# that uses slightly different code paths. Note this would deadlock before the fix.
1014941
# https://github.com/containers/podman/issues/21477
1015-
if has_slirp4netns; then
1016-
cname2=con2-$(safename)
1017-
run_podman 1 run --name $cname2 --network slirp4netns --restart on-failure:2 --userns keep-id $IMAGE false
1018-
wait_for_restart_count $cname2 2 "slirp4netns"
1019-
run_podman wait $cname2
1020-
fi
1021-
1022942
if is_rootless; then
1023943
# pasta can only run rootless
1024944
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)