Skip to content

Commit 05f5650

Browse files
Georgios Ntoutsoscmainas
authored andcommitted
Tests: Add test for static mode network
Signed-off-by: Georgios Ntoutsos <gntouts@nubificus.co.uk> Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk> Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk> PR: #30
1 parent 6e9d4c1 commit 05f5650

4 files changed

Lines changed: 180 additions & 1 deletion

File tree

cmd/urunc/utils.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ func fatalWithCode(err error, ret int) {
118118
}
119119

120120
// handleQueueProxy checks if the provided bundle contains a queue-proxy container
121-
// and adds a hardcoded IP to the process's environment
121+
// and adds a hardcoded IP to the process's environment.
122+
// Then, the container is identified as a non-bima container
123+
// is spawned using runc.
122124
func handleQueueProxy(context *cli.Context) error {
123125
logrus.Error("handleQueueProxy")
124126
containerID := context.Args().First()

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ module github.com/nubificus/urunc
33
go 1.18
44

55
require (
6+
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a
67
github.com/containerd/containerd v1.6.10
78
github.com/creack/pty v1.1.11
89
github.com/go-ping/ping v1.1.0
910
github.com/jackpal/gateway v1.0.10
1011
github.com/moby/sys/mount v0.3.3
1112
github.com/nubificus/hedge_cli v0.0.3
13+
github.com/opencontainers/runc v1.1.2
1214
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417
1315
github.com/rs/zerolog v1.31.0
1416
github.com/shirou/gopsutil v3.21.11+incompatible

go.sum

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF
7373
github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0=
7474
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
7575
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
76+
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA=
7677
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
7778
github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0=
7879
github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
@@ -96,6 +97,8 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf
9697
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
9798
github.com/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw=
9899
github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M=
100+
github.com/checkpoint-restore/go-criu/v5 v5.3.0 h1:wpFFOoomK3389ue2lAb0Boag6XPht5QYpipxmSNL4d8=
101+
github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E=
99102
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
100103
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
101104
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
@@ -236,6 +239,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
236239
github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw=
237240
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
238241
github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4=
242+
github.com/cyphar/filepath-securejoin v0.2.3 h1:YX6ebbZCZP7VkM3scTTokDgBL2TY741X51MTk3ycuNI=
243+
github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
239244
github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1SMSibvLzxjeJLnrYEVLULFNiHY9YfQ=
240245
github.com/d2g/dhcp4client v1.0.0/go.mod h1:j0hNfjhrt2SxUOw55nL0ATM/z4Yt3t2Kd1mW34z5W5s=
241246
github.com/d2g/dhcp4server v0.0.0-20181031114812-7d4a0a7f59a5/go.mod h1:Eo87+Kg/IX2hfWJfwxMzLyuSZyxSoAug2nGa1G2QAi8=
@@ -494,6 +499,7 @@ github.com/moby/sys/mount v0.3.3 h1:fX1SVkXFJ47XWDoeFW4Sq7PdQJnV2QIDZAqjNqgEjUs=
494499
github.com/moby/sys/mount v0.3.3/go.mod h1:PBaEorSNTLG5t/+4EgukEQVlAvVEc6ZjTySwKdqp5K0=
495500
github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A=
496501
github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A=
502+
github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU=
497503
github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78=
498504
github.com/moby/sys/mountinfo v0.6.2/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI=
499505
github.com/moby/sys/symlink v0.1.0/go.mod h1:GGDODQmbFOjFsXvfLVn3+ZRxkch54RkSiGqsZeMYowQ=
@@ -503,6 +509,7 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ
503509
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
504510
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
505511
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
512+
github.com/mrunalp/fileutils v0.5.0 h1:NKzVxiH7eSk+OQ4M+ZYW1K6h27RUV3MI6NUTsHhU6Z4=
506513
github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ=
507514
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
508515
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
@@ -547,6 +554,8 @@ github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h
547554
github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
548555
github.com/opencontainers/runc v1.0.0-rc93/go.mod h1:3NOsor4w32B2tC0Zbl8Knk4Wg84SM2ImC1fxBuqJ/H0=
549556
github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0=
557+
github.com/opencontainers/runc v1.1.2 h1:2VSZwLx5k/BfsBxMMipG/LYUnmqOD/BPkIVgQUcTlLw=
558+
github.com/opencontainers/runc v1.1.2/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc=
550559
github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
551560
github.com/opencontainers/runtime-spec v1.0.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
552561
github.com/opencontainers/runtime-spec v1.0.2-0.20190207185410-29686dbc5559/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
@@ -558,6 +567,8 @@ github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mo
558567
github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqiriPsEqVhc+svHE=
559568
github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo=
560569
github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8=
570+
github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI=
571+
github.com/opencontainers/selinux v1.10.1 h1:09LIPVRP3uuZGQvgR+SgMSNBd1Eb3vlRbGqQpoHsF8w=
561572
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
562573
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
563574
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
@@ -614,6 +625,8 @@ github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiB
614625
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
615626
github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24q7p+U=
616627
github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo=
628+
github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921 h1:58EBmR2dMNL2n/FnbQewK3D14nXr0V9CObDSvMJLq+Y=
629+
github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg=
617630
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
618631
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
619632
github.com/shirou/gopsutil/v3 v3.23.9 h1:ZI5bWVeu2ep4/DIxB4U9okeYJ7zp/QLTO4auRb/ty/E=
@@ -670,6 +683,7 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
670683
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
671684
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
672685
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
686+
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 h1:kdXcSzyDtseVEc4yCz2qF8ZrQvIDBJLl4S1c3GCXmoI=
673687
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
674688
github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I=
675689
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
@@ -902,6 +916,8 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
902916
golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
903917
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
904918
golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
919+
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
920+
golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
905921
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
906922
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
907923
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

tests/crictl/crictl_test.go

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,20 @@ package urunc
33
import (
44
"encoding/json"
55
"fmt"
6+
"net"
67
"os"
78
"os/exec"
89
"path/filepath"
910
"regexp"
11+
"runtime"
1012
"strings"
1113
"testing"
1214
"time"
1315

16+
"github.com/asaskevich/govalidator"
1417
common "github.com/nubificus/urunc/tests"
18+
_ "github.com/opencontainers/runc/libcontainer/nsenter"
19+
"github.com/vishvananda/netns"
1520
)
1621

1722
func TestCrictlHvtRumprunRedis(t *testing.T) {
@@ -394,6 +399,160 @@ func TestCrictlFCUnikraftNginx(t *testing.T) {
394399
}
395400
}
396401

402+
func TestCrictlHTTPStaticNet(t *testing.T) {
403+
containerImage := "harbor.nbfc.io/nubificus/httpreply-fc:x86_64"
404+
procName := "firecracker"
405+
podConfig := crictlSandboxConfig("fc-unikraft-knative-sandbox")
406+
407+
// user-container is used as "io.kubernetes.cri.container-name" annotation by crictl
408+
// in order to trigger the static net mode
409+
containerConfig := crictlContainerConfig("user-container", containerImage)
410+
411+
// create config files
412+
cwd, err := os.Getwd()
413+
if err != nil {
414+
t.Fatal("Failed to retrieve current directory")
415+
}
416+
absPodConf := filepath.Join(cwd, "pod.json")
417+
absContConf := filepath.Join(cwd, "cont.json")
418+
err = writeToFile(absPodConf, podConfig)
419+
if err != nil {
420+
t.Fatalf("Failed to write pod config: %v", err)
421+
}
422+
defer os.Remove(absPodConf)
423+
err = writeToFile(absContConf, containerConfig)
424+
if err != nil {
425+
t.Fatalf("Failed to write container config: %v", err)
426+
}
427+
defer os.Remove(absContConf)
428+
429+
// pull image
430+
params := []string{"crictl", "pull", containerImage}
431+
cmd := exec.Command(params[0], params[1:]...) //nolint:gosec
432+
output, err := cmd.CombinedOutput()
433+
if err != nil {
434+
t.Fatalf("Failed to pull image: %v\n%s", err, output)
435+
}
436+
437+
// start unikernel in pod
438+
params = strings.Fields("crictl run --runtime=urunc cont.json pod.json")
439+
cmd = exec.Command(params[0], params[1:]...) //nolint:gosec
440+
output, err = cmd.CombinedOutput()
441+
if err != nil {
442+
t.Fatalf("Failed to run unikernel: %v\n%s", err, output)
443+
}
444+
time.Sleep(2 * time.Second)
445+
proc, err := common.FindProc(procName)
446+
if err != nil {
447+
t.Fatalf("Failed to find %s process: %v", procName, err)
448+
}
449+
netNs, err := netns.GetFromPid(int(proc.Pid))
450+
if err != nil {
451+
t.Fatalf("Failed to find %s process network namespace: %v", procName, err)
452+
}
453+
origns, _ := netns.Get()
454+
defer origns.Close()
455+
runtime.LockOSThread()
456+
defer runtime.UnlockOSThread()
457+
err = netns.Set(netNs)
458+
defer func() {
459+
err := netns.Set(origns)
460+
if err != nil {
461+
t.Fatalf("Failed to revert to default network nampespace: %v", err)
462+
}
463+
}()
464+
if err != nil {
465+
t.Fatalf("Failed to change network namespace: %v", err)
466+
}
467+
ifaces, err := net.Interfaces()
468+
if err != nil {
469+
t.Fatalf("Failed to get all interfaces in current network namespace: %v", err)
470+
}
471+
var tapUrunc net.Interface
472+
for _, iface := range ifaces {
473+
if strings.Contains(iface.Name, "urunc") {
474+
tapUrunc = iface
475+
break
476+
}
477+
}
478+
if tapUrunc.Name == "" {
479+
var names []string
480+
for _, iface := range ifaces {
481+
names = append(names, iface.Name)
482+
}
483+
err = fmt.Errorf("Expected tap0_urunc, got %v", names)
484+
t.Fatalf("Failed to find urunc's tap device: %v", err)
485+
}
486+
487+
addrs, err := tapUrunc.Addrs()
488+
if err != nil {
489+
t.Fatalf("Failed to get %s interface's IP addresses: %v", tapUrunc.Name, err)
490+
}
491+
ipAddr := ""
492+
for _, addr := range addrs {
493+
tmp := strings.Split(addr.String(), "/")[0]
494+
if govalidator.IsIPv4(tmp) {
495+
ipAddr = tmp
496+
break
497+
}
498+
}
499+
if ipAddr == "" {
500+
t.Fatalf("Failed to get %s interface's IPv4 address", tapUrunc.Name)
501+
}
502+
parts := strings.Split(ipAddr, ".")
503+
newIP := fmt.Sprintf("%s.%s.%s.2", parts[0], parts[1], parts[2])
504+
url := fmt.Sprintf("http://%s:8080", newIP)
505+
curlCmd := fmt.Sprintf("curl %s", url)
506+
params = strings.Fields(curlCmd)
507+
cmd = exec.Command(params[0], params[1:]...) //nolint:gosec
508+
output, err = cmd.CombinedOutput()
509+
if err != nil {
510+
t.Fatalf("Failed to run curl: %v\n%s", err, output)
511+
}
512+
if string(output) == "" {
513+
t.Fatal("Failed to receive valid response")
514+
}
515+
516+
// FIXME: Investigate why the GET request using net/http fails, while is successful using curl
517+
//
518+
// client := http.DefaultClient
519+
// client.Timeout = 10 * time.Second
520+
// resp, err := client.Get(url)
521+
// if err != nil {
522+
// t.Logf("Failed to perform GET request to %s: %v", url, err)
523+
// }
524+
// defer resp.Body.Close()
525+
// body, err := io.ReadAll(resp.Body)
526+
// if err != nil {
527+
// t.Logf("Error reading response body: %v", err)
528+
// }
529+
// t.Log(string(body))
530+
531+
// Find pod ID
532+
params = strings.Fields("crictl pods -q")
533+
cmd = exec.Command(params[0], params[1:]...) //nolint:gosec
534+
output, err = cmd.CombinedOutput()
535+
if err != nil {
536+
t.Fatalf("Failed to find pod: %v\n%s", err, output)
537+
}
538+
539+
podID := string(output)
540+
podID = strings.TrimSpace(podID)
541+
542+
// Stop and remove pod
543+
params = strings.Fields("crictl rmp --force " + podID)
544+
cmd = exec.Command(params[0], params[1:]...) //nolint:gosec
545+
output, err = cmd.CombinedOutput()
546+
if err != nil {
547+
t.Fatalf("Failed to stop and remove pod: %v\n%s", err, output)
548+
}
549+
550+
proc, _ = common.FindProc(procName)
551+
if proc != nil {
552+
t.Fatalf("%s process is still alive", procName)
553+
}
554+
}
555+
397556
func crictlSandboxConfig(name string) string {
398557
return fmt.Sprintf(`{
399558
"metadata": {

0 commit comments

Comments
 (0)