Skip to content

Commit acee70b

Browse files
authored
Merge pull request #1070 from marquiz/release-0.8
[release-0.8] backport e2e test fixes from master
2 parents 246d9f1 + 130ab68 commit acee70b

File tree

42 files changed

+242
-220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+242
-220
lines changed

Makefile

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -472,23 +472,7 @@ e2e-tests: build-static
472472
fi
473473

474474
packaging-tests: cross-packages
475-
$(Q)for dir in test/e2e/packages.test-suite/*; do \
476-
cleanup=1 omit_agent=1 $(E2E_RUN) $$dir; \
477-
echo "--------------------------------------"; \
478-
for r in $(find $$dir -name summary.txt); do \
479-
t="$${r#*.test-suite/}"; t="$${t%/output/summary.txt}"; \
480-
echo "$$t:"; \
481-
cat $$r | sed 's/^/ /g'; \
482-
done; \
483-
echo "======================================"; \
484-
done; \
485-
for dir in test/e2e/packages.test-suite/*; do \
486-
for r in $(find $$dir -name summary.txt); do \
487-
t="$${r#*.test-suite/}"; t="$${t%/output/summary.txt}"; \
488-
echo "$$t:"; \
489-
cat $$r | sed 's/^/ /g'; \
490-
done; \
491-
done;
475+
$(Q)cleanup=1 omit_agent=1 $(E2E_RUN) test/e2e/packages.test-suite
492476

493477
#
494478
# Rules for building distro packages.

demo/lib/distro.bash

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ ubuntu-22_04-image-url() {
130130
}
131131

132132
debian-10-image-url() {
133-
echo "https://cloud.debian.org/images/cloud/buster/20200803-347/debian-10-generic-amd64-20200803-347.qcow2"
133+
echo "https://cloud.debian.org/images/cloud/buster/latest/debian-10-generic-amd64.qcow2"
134134
}
135135

136136
debian-11-image-url() {
@@ -381,21 +381,17 @@ centos-8-install-containerd-pre() {
381381
distro-install-repo https://download.docker.com/linux/centos/docker-ce.repo
382382
}
383383

384-
centos-7-k8s-cni() {
385-
echo "weavenet"
386-
}
387-
388384
centos-install-golang() {
389385
distro-install-pkg wget tar gzip git-core
390386
from-tarball-install-golang
391387
}
392388

393389
fedora-image-url() {
394-
fedora-36-image-url
390+
fedora-38-image-url
395391
}
396392

397-
fedora-36-image-url() {
398-
echo "https://mirrors.xtom.de/fedora/releases/36/Cloud/x86_64/images/Fedora-Cloud-Base-36-1.5.x86_64.qcow2"
393+
fedora-38-image-url() {
394+
echo "https://mirrors.xtom.de/fedora/releases/38/Cloud/x86_64/images/Fedora-Cloud-Base-38-1.6.x86_64.qcow2"
399395
}
400396

401397
fedora-35-image-url() {
@@ -686,7 +682,11 @@ opensuse-image-url() {
686682
}
687683

688684
opensuse-15_4-image-url() {
689-
echo "https://download.opensuse.org/pub/opensuse/distribution/leap/15.4/appliances/openSUSE-Leap-15.4-JeOS.x86_64-15.4-OpenStack-Cloud-Current.qcow2"
685+
echo "https://download.opensuse.org/pub/opensuse/distribution/leap/15.4/appliances/openSUSE-Leap-15.4-Minimal-VM.x86_64-OpenStack-Cloud.qcow2"
686+
}
687+
688+
opensuse-15_5-image-url() {
689+
echo "https://download.opensuse.org/pub/opensuse/distribution/leap/15.5/appliances/openSUSE-Leap-15.5-Minimal-VM.x86_64-Cloud.qcow2"
690690
}
691691

692692
opensuse-tumbleweed-image-url() {
@@ -781,7 +781,9 @@ opensuse-wait-for-zypper() {
781781
opensuse-require-repo-virtualization-containers() {
782782
vm-command "zypper ls"
783783
if ! grep -q Virtualization_containers <<< "$COMMAND_OUTPUT"; then
784-
opensuse-install-repo https://download.opensuse.org/repositories/Virtualization:containers/15.4/Virtualization:containers.repo
784+
vm-command 'source /etc/os-release; echo $VERSION'
785+
local opensuse_version=$COMMAND_OUTPUT
786+
opensuse-install-repo https://download.opensuse.org/repositories/Virtualization:containers/${opensuse_version}/Virtualization:containers.repo
785787
opensuse-refresh-pkg-db
786788
fi
787789
}
@@ -1053,7 +1055,7 @@ default-install-utils() {
10531055
}
10541056

10551057
default-k8s-cni() {
1056-
echo ${k8scni:-cilium}
1058+
echo ${k8scni:-bridge}
10571059
}
10581060

10591061
default-k8s-cni-subnet() {

demo/lib/topology.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
_bash_topology_dump = """for cpu in /sys/devices/system/cpu/cpu[0-9]*; do cpu_id=${cpu#/sys/devices/system/cpu/cpu}; echo "cpu p:$(< ${cpu}/topology/physical_package_id) d:$(< ${cpu}/topology/die_id) n:$(basename ${cpu}/node* | sed 's:node::g') c:$(< ${cpu}/topology/core_id) t:$(< ${cpu}/topology/thread_siblings) cpu:${cpu_id}" ; done; for node in /sys/devices/system/node/node[0-9]*; do node_id=${node#/sys/devices/system/node/node}; echo "dist n:$node_id d:$(< $node/distance)"; echo "mem n:$node_id s:$(awk '/MemTotal/{print $4/1024}' < $node/meminfo)"; done"""
5656

57-
_bash_res_allowed = r"""for process in '%s'; do for pid in $(pgrep -f "$process"); do name=$(cat /proc/$pid/cmdline | tr '\0 ' '\n' | grep -E "^$process" | head -n 1); [ -n "$name" ] && [ "$pid" != "$$" ] && [ "$pid" != "$PPID" ] && echo "${name}/${pid} $(awk '/Cpus_allowed:/{c=$2}/Mems_allowed:/{m=$2}END{print "c:"c" m:"m}' < /proc/$pid/status)"; done; done"""
57+
_bash_res_allowed = r"""for process in '%s'; do for pid in $(pgrep -f "$process"); do proc_pid_cmdline=$(< /proc/$pid/cmdline) || continue; proc_pid_status=$(< /proc/$pid/status) || continue; name=$(echo "$proc_pid_cmdline" | tr '\0 ' '\n' | grep -E "^$process" | head -n 1); [ -n "$name" ] && [ "$pid" != "$$" ] && [ "$pid" != "$PPID" ] && echo "${name}/${pid} $(awk '/Cpus_allowed:/{c=$2}/Mems_allowed:/{m=$2}END{print "c:"c" m:"m}' <<< "$proc_pid_status")"; done 2>/dev/null; done"""
5858

5959
def error(msg, exit_status=1):
6060
"""Print error message and exit."""

demo/lib/vm.bash

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -616,25 +616,10 @@ vm-reboot() { # script API
616616
# Reboots the virtual machine and waits that the ssh server starts
617617
# responding again.
618618
vm-command "reboot"
619-
sleep 5
620-
host-wait-vm-ssh-server
621-
}
622-
623-
vm-force-restart() { # script API
624-
# Usage: vm-force-restart
625-
#
626-
# Give the virtual machine a chance to shut itself down, then
627-
# forcibly restart it using govm stop/start. Wait for the ssh
628-
# server to start responding again after restarting. If VM_NAME
629-
# is not set assume the target machine to not be govm-managed
630-
# and fall back to vm-reboot instead.
631-
if vm-is-govm; then
632-
vm-command "shutdown -h now"
633-
sleep 10
619+
sleep 10
620+
if ! host-wait-vm-ssh-server; then
634621
vm-monitor system_reset
635622
host-wait-vm-ssh-server
636-
else
637-
vm-reboot
638623
fi
639624
}
640625

@@ -1024,6 +1009,7 @@ vm-create-singlenode-cluster() {
10241009
if ! vm-command "kubectl wait --for=condition=Ready node/\$(hostname) --timeout=240s"; then
10251010
command-error "kubectl waiting for node readiness timed out"
10261011
fi
1012+
vm-run-until --timeout 30 "kubectl get sa default > /dev/null" || error "serviceaccount 'default' not found"
10271013
}
10281014

10291015
vm-create-cluster() {
@@ -1046,6 +1032,25 @@ vm-destroy-cluster() {
10461032
vm-command "yes | kubeadm reset; rm -f ~$user/.kube/config ~root/.kube/config /etc/kubernetes"
10471033
}
10481034

1035+
vm-install-cni-bridge() {
1036+
vm-command "rm -rf /etc/cni/net.d/* && mkdir -p /etc/cni/net.d && cat > /etc/cni/net.d/10-bridge.conf <<EOF
1037+
{
1038+
\"cniVersion\": \"0.4.0\",
1039+
\"name\": \"demonet\",
1040+
\"type\": \"bridge\",
1041+
\"isGateway\": true,
1042+
\"ipMasq\": true,
1043+
\"ipam\": {
1044+
\"type\": \"host-local\",
1045+
\"subnet\": \"$CNI_SUBNET\",
1046+
\"routes\": [
1047+
{ \"dst\": \"0.0.0.0/0\" }
1048+
]
1049+
}
1050+
}
1051+
EOF"
1052+
}
1053+
10491054
vm-install-cni-cilium() {
10501055
if ! vm-command "curl -L --remote-name-all https://github.com/cilium/cilium-cli/releases/latest/download/cilium-linux-amd64.tar.gz && tar xzvfC cilium-linux-amd64.tar.gz /usr/local/bin && cilium install && rm -f cilium-linux-amd64.tar.gz"; then
10511056
command-error "installing cilium CNI to Kubernetes failed"

test/e2e/policies.test-suite/balloons/n4c16/test01-basic-placement/code.var.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# reserved and shared CPUs.
33

44
cleanup() {
5-
vm-command "kubectl delete pods -n kube-system pod0; kubectl delete pods -n three --all --now; kubectl delete pods --all --now; kubectl delete namespace three"
5+
vm-command "kubectl delete pods -n kube-system pod0; kubectl delete pods --all --now --wait; kubectl delete namespace three --now --wait --ignore-not-found"
66
return 0
77
}
88

test/e2e/policies.test-suite/balloons/n4c16/test02-prometheus-metrics/code.var.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This test verifies prometheus metrics from the balloons policy.
22

33
cleanup() {
4-
vm-command "kubectl delete pods --all --now"
4+
vm-command "kubectl delete pods --all --now --wait"
55
return 0
66
}
77

@@ -55,17 +55,17 @@ verify-metrics-has-line 'balloon_type="flex"'
5555
verify-metrics-has-line 'balloon_type="flex".* 5'
5656

5757
# check deflating a balloon in metrics
58-
kubectl delete pods --now pod3
58+
kubectl delete pods --now --wait --ignore-not-found pod3
5959
verify-metrics-has-line 'balloon_type="flex"'
6060
verify-metrics-has-line 'balloon_type="flex".* 2'
6161

62-
kubectl delete pods --now pod4
62+
kubectl delete pods --now --wait --ignore-not-found pod4
6363
sleep 5
6464
# check popping a balloon from metrics
6565
verify-metrics-has-no-line 'balloon_type="flex"'
6666

6767
# pop fast-dualcore[0], keep fast-dualcore[1]
68-
kubectl delete pods --now pod1
68+
kubectl delete pods --now --wait --ignore-not-found pod1
6969
verify-metrics-has-line 'balloon="fast-dualcore\[1\]"'
7070
sleep 5
7171
verify-metrics-has-no-line 'balloon="fast-dualcore\[0\]"'

test/e2e/policies.test-suite/balloons/n4c16/test03-reserved/code.var.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ cri_resmgr_cfg=${TEST_DIR}/balloons-reserved.cfg launch cri-resmgr
33

44
cleanup() {
55
vm-command \
6-
"kubectl delete pod -n kube-system --now pod0
7-
kubectl delete pod -n monitor-mypods --now pod1
8-
kubectl delete pod -n system-logs --now pod2
9-
kubectl delete pod -n kube-system --now pod3
10-
kubectl delete pods --now pod4 pod5 pod6
11-
kubectl delete pod -n kube-system --now pod7
12-
kubectl delete namespace monitor-mypods
13-
kubectl delete namespace system-logs
14-
kubectl delete namespace my-exact-name"
6+
"kubectl delete pod -n kube-system --now --wait --ignore-not-found pod0
7+
kubectl delete pod -n monitor-mypods --now --wait --ignore-not-found pod1
8+
kubectl delete pod -n system-logs --now --wait --ignore-not-found pod2
9+
kubectl delete pod -n kube-system --now --wait --ignore-not-found pod3
10+
kubectl delete pods --now --wait --ignore-not-found pod4 pod5 pod6
11+
kubectl delete pod -n kube-system --now --wait --ignore-not-found pod7
12+
kubectl delete namespace monitor-mypods --wait --ignore-not-found
13+
kubectl delete namespace system-logs --wait --ignore-not-found
14+
kubectl delete namespace my-exact-name --wait --ignore-not-found"
1515
return 0
1616
}
1717

test/e2e/policies.test-suite/balloons/n4c16/test05-namespace/code.var.sh

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@ cri_resmgr_cfg=${TEST_DIR}/balloons-namespace.cfg launch cri-resmgr
33

44
cleanup() {
55
vm-command \
6-
"kubectl delete pods -n e2e-a --all --now
7-
kubectl delete pods -n e2e-b --all --now
8-
kubectl delete pods -n e2e-c --all --now
9-
kubectl delete pods -n e2e-d --all --now
10-
kubectl delete pods --all --now
11-
kubectl delete namespace e2e-a
12-
kubectl delete namespace e2e-b
13-
kubectl delete namespace e2e-c
14-
kubectl delete namespace e2e-d"
6+
"kubectl delete pods --all --now --wait
7+
kubectl delete namespace e2e-a --wait --ignore-not-found
8+
kubectl delete namespace e2e-b --wait --ignore-not-found
9+
kubectl delete namespace e2e-c --wait --ignore-not-found
10+
kubectl delete namespace e2e-d --wait --ignore-not-found"
1511
return 0
1612
}
1713
cleanup

test/e2e/policies.test-suite/balloons/n4c16/test06-update-configmap/code.var.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
testns=e2e-balloons-test06
55

66
cleanup() {
7-
vm-command "kubectl delete pods --all --now; \
8-
kubectl delete pods -n $testns --all --now; \
9-
kubectl delete pods -n btype1ns0 --all --now; \
10-
kubectl delete namespace $testns || :; \
11-
kubectl delete namespace btype1ns0 || :"
7+
vm-command "kubectl delete pods --all --now --wait; \
8+
kubectl delete namespace $testns --now --wait --ignore-not-found || :; \
9+
kubectl delete namespace btype1ns0 --now --wait --ignore-not-found || :"
1210
terminate cri-resmgr
1311
terminate cri-resmgr-agent
1412
vm-command "cri-resmgr -reset-policy; cri-resmgr -reset-config"

test/e2e/policies.test-suite/balloons/n4c16/test07-maxballoons/code.var.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cleanup() {
2-
vm-command "kubectl delete pods --all --now"
2+
vm-command "kubectl delete pods --all --now --wait"
33
return 0
44
}
55

@@ -30,7 +30,7 @@ vm-command "kubectl describe pod pod2"
3030
if ! grep -q 'no suitable balloon instance available' <<< "$COMMAND_OUTPUT"; then
3131
error "could not find 'no suitable balloon instance available' in pod2 description"
3232
fi
33-
vm-command "kubectl delete pod pod2 --now"
33+
vm-command "kubectl delete pod pod2 --now --wait --ignore-not-found"
3434

3535
# pod2: create dynamically the first dynamictwo balloon
3636
CPUREQ="800m" CPULIM="800m"
@@ -59,7 +59,7 @@ vm-command "kubectl describe pod pod5"
5959
if ! grep -q 'no suitable balloon instance available' <<< "$COMMAND_OUTPUT"; then
6060
error "could not find 'no suitable balloon instance available' in pod6 description"
6161
fi
62-
vm-command "kubectl delete pod pod5 --now"
62+
vm-command "kubectl delete pod pod5 --now --wait --ignore-not-found"
6363

6464
cleanup
6565

0 commit comments

Comments
 (0)