Skip to content

Commit bf625c8

Browse files
committed
remove some cri-o container tests
Because we removed containernetworking-plugins, we can't run containers without ovn-kubernetes.
1 parent 0bc53dc commit bf625c8

File tree

1 file changed

+3
-146
lines changed

1 file changed

+3
-146
lines changed

mantle/kola/tests/crio/crio.go

Lines changed: 3 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,11 @@ import (
2020
"os"
2121
"path"
2222
"strings"
23-
"time"
24-
25-
"golang.org/x/crypto/ssh"
26-
"golang.org/x/net/context"
2723

2824
"github.com/coreos/coreos-assembler/mantle/kola"
2925
"github.com/coreos/coreos-assembler/mantle/kola/cluster"
3026
"github.com/coreos/coreos-assembler/mantle/kola/register"
3127
"github.com/coreos/coreos-assembler/mantle/kola/tests/util"
32-
"github.com/coreos/coreos-assembler/mantle/lang/worker"
3328
"github.com/coreos/coreos-assembler/mantle/platform"
3429
"github.com/coreos/coreos-assembler/mantle/platform/conf"
3530

@@ -78,7 +73,8 @@ var crioPodTemplate = `{
7873
"cgroup_parent": "Burstable-pod-123.slice",
7974
"security_context": {
8075
"namespace_options": {
81-
"pid": 1
76+
"pid": 1,
77+
"network": 2,
8278
},
8379
"capabilities": {
8480
"add_capabilities": [
@@ -198,25 +194,11 @@ func init() {
198194
Tags: []string{"crio", kola.NeedsInternetTag},
199195
RequiredTag: "openshift",
200196
})
201-
register.RegisterTest(&register.Test{
202-
Run: crioNetwork,
203-
ClusterSize: 2,
204-
Name: "crio.network",
205-
Description: "Verify crio containers can make network connections outside of the host.",
206-
Distros: []string{"rhcos"},
207-
UserData: enableCrioIgn,
208-
// this test requires net connections outside the host
209-
Tags: []string{"crio", kola.NeedsInternetTag},
210-
RequiredTag: "openshift",
211-
// qemu machines cannot communicate between each other
212-
ExcludePlatforms: []string{"qemu"},
213-
})
214197
}
215198

216199
// crioBaseTests executes multiple tests under the "base" name
217200
func crioBaseTests(c cluster.TestCluster) {
218201
c.Run("crio-info", testCrioInfo)
219-
c.Run("pod-continues-during-service-restart", crioPodContinuesDuringServiceRestart)
220202
c.Run("networks-reliably", crioNetworksReliably)
221203
}
222204

@@ -273,102 +255,6 @@ func genContainer(c cluster.TestCluster, m platform.Machine, podName, imageName
273255
return path.Base(configPathPod), path.Base(configPathContainer), nil
274256
}
275257

276-
// crioNetwork ensures that crio containers can make network connections outside of the host
277-
func crioNetwork(c cluster.TestCluster) {
278-
machines := c.Machines()
279-
src, dest := machines[0], machines[1]
280-
281-
c.Log("creating ncat containers")
282-
283-
// Since genContainer also generates crio pod/container configs,
284-
// there will be a duplicate config file on each machine.
285-
// Thus we only save one set for later use.
286-
crioConfigPod, crioConfigContainer, err := genContainer(c, src, "ncat", "ncat", []string{"ncat", "echo"}, []string{"ncat"})
287-
if err != nil {
288-
c.Fatal(err)
289-
}
290-
_, _, err = genContainer(c, dest, "ncat", "ncat", []string{"ncat", "echo"}, []string{"ncat"})
291-
if err != nil {
292-
c.Fatal(err)
293-
}
294-
295-
listener := func(ctx context.Context) error {
296-
podID, err := c.SSHf(dest, "sudo crictl runp -T %s %s", overrideCrioOperationTimeoutSeconds, crioConfigPod)
297-
if err != nil {
298-
return err
299-
}
300-
301-
containerID, err := c.SSHf(dest, "sudo crictl create -T %s --no-pull %s %s %s",
302-
overrideCrioOperationTimeoutSeconds,
303-
podID, crioConfigContainer, crioConfigPod)
304-
if err != nil {
305-
return err
306-
}
307-
308-
// This command will block until a message is recieved
309-
output, err := c.SSHf(dest, "sudo timeout 30 crictl exec %s echo 'HELLO FROM SERVER' | timeout 20 ncat --listen 0.0.0.0 9988 || echo 'LISTENER TIMEOUT'", containerID)
310-
if err != nil {
311-
return err
312-
}
313-
if string(output) != "HELLO FROM CLIENT" {
314-
return fmt.Errorf("unexpected result from listener: %s", output)
315-
}
316-
317-
return nil
318-
}
319-
320-
talker := func(ctx context.Context) error {
321-
// Wait until listener is ready before trying anything
322-
for {
323-
_, err := c.SSH(dest, "sudo ss -tulpn|grep 9988")
324-
if err == nil {
325-
break // socket is ready
326-
}
327-
328-
exit, ok := err.(*ssh.ExitError)
329-
if !ok || exit.Waitmsg.ExitStatus() != 1 { // 1 is the expected exit of grep -q
330-
return err
331-
}
332-
333-
select {
334-
case <-ctx.Done():
335-
return fmt.Errorf("timeout waiting for server")
336-
default:
337-
time.Sleep(100 * time.Millisecond)
338-
}
339-
}
340-
podID, err := c.SSHf(src, "sudo crictl runp -T %s %s", overrideCrioOperationTimeoutSeconds, crioConfigPod)
341-
if err != nil {
342-
return err
343-
}
344-
345-
containerID, err := c.SSHf(src, "sudo crictl create -T %s --no-pull %s %s %s",
346-
overrideCrioOperationTimeoutSeconds,
347-
podID, crioConfigContainer, crioConfigPod)
348-
if err != nil {
349-
return err
350-
}
351-
352-
output, err := c.SSHf(src, "sudo crictl exec %s echo 'HELLO FROM CLIENT' | ncat %s 9988",
353-
containerID, dest.PrivateIP())
354-
if err != nil {
355-
return err
356-
}
357-
if string(output) != "HELLO FROM SERVER" {
358-
return fmt.Errorf(`unexpected result from listener: "%s"`, output)
359-
}
360-
361-
return nil
362-
}
363-
364-
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
365-
defer cancel()
366-
367-
if err := worker.Parallel(ctx, listener, talker); err != nil {
368-
c.Fatal(err)
369-
}
370-
}
371-
372258
// crioNetworksReliably verifies that crio containers have a reliable network
373259
func crioNetworksReliably(c cluster.TestCluster) {
374260
m := c.Machines()[0]
@@ -394,7 +280,7 @@ func crioNetworksReliably(c cluster.TestCluster) {
394280
output = output + string(c.MustSSH(m, fmt.Sprintf("sudo crictl exec %s ping -i 0.2 %s -w 1 >/dev/null && echo PASS || echo FAIL", containerID, hostIP)))
395281
}
396282

397-
numPass := strings.Count(string(output), "PASS")
283+
numPass := strings.Count(output, "PASS")
398284
if numPass != 10 {
399285
c.Fatalf("Expected 10 passes, but received %d passes with output: %s", numPass, output)
400286
}
@@ -437,32 +323,3 @@ func testCrioInfo(c cluster.TestCluster) {
437323
}
438324

439325
}
440-
441-
// crioPodContinuesDuringServiceRestart verifies that a crio pod does not
442-
// stop when the service is restarted
443-
func crioPodContinuesDuringServiceRestart(c cluster.TestCluster) {
444-
m := c.Machines()[0]
445-
446-
crioConfigPod, crioConfigContainer, err := genContainer(
447-
c, m, "restart-test", "sleep",
448-
[]string{"bash", "sleep", "echo"}, []string{"bash"})
449-
if err != nil {
450-
c.Fatal(err)
451-
}
452-
cmdCreatePod := fmt.Sprintf("sudo crictl runp -T %s %s", overrideCrioOperationTimeoutSeconds, crioConfigPod)
453-
podID := c.MustSSH(m, cmdCreatePod)
454-
containerID := c.MustSSH(m, fmt.Sprintf("sudo crictl create -T %s --no-pull %s %s %s",
455-
overrideCrioOperationTimeoutSeconds,
456-
podID, crioConfigContainer, crioConfigPod))
457-
458-
cmd := fmt.Sprintf("sudo crictl exec %s bash -c \"sleep 25 && echo PASS > /tmp/test/restart-test\"", containerID)
459-
c.RunCmdSync(m, cmd)
460-
time.Sleep(3 * time.Second)
461-
c.RunCmdSync(m, "sudo systemctl restart crio")
462-
time.Sleep(25 * time.Second)
463-
output := strings.TrimSuffix(string(c.MustSSH(m, "cat /tmp/test/restart-test")), "\n")
464-
465-
if output != "PASS" {
466-
c.Fatalf("Pod did not continue during service restart. Output=%s, Command=%s", output, cmd)
467-
}
468-
}

0 commit comments

Comments
 (0)