From d44c5972d0088f9e6e0b8b9b309e6e62ad9b4cb8 Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Wed, 1 Dec 2021 10:57:55 +0100 Subject: [PATCH 1/2] kola: remove rkt test `rkt` is no more shipped into the OS since https://github.com/flatcar-linux/coreos-overlay/pull/965, let's remove this tests. Signed-off-by: Mathieu Tortuyaux --- kola/registry/registry.go | 1 - kola/tests/rkt/rkt.go | 178 -------------------------------------- 2 files changed, 179 deletions(-) delete mode 100644 kola/tests/rkt/rkt.go diff --git a/kola/registry/registry.go b/kola/registry/registry.go index 795b25b4d..377e22e07 100644 --- a/kola/registry/registry.go +++ b/kola/registry/registry.go @@ -15,7 +15,6 @@ import ( _ "github.com/flatcar-linux/mantle/kola/tests/ostree" _ "github.com/flatcar-linux/mantle/kola/tests/packages" _ "github.com/flatcar-linux/mantle/kola/tests/podman" - _ "github.com/flatcar-linux/mantle/kola/tests/rkt" _ "github.com/flatcar-linux/mantle/kola/tests/rpmostree" _ "github.com/flatcar-linux/mantle/kola/tests/systemd" _ "github.com/flatcar-linux/mantle/kola/tests/torcx" diff --git a/kola/tests/rkt/rkt.go b/kola/tests/rkt/rkt.go deleted file mode 100644 index 4205382d0..000000000 --- a/kola/tests/rkt/rkt.go +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright 2016 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package rkt - -import ( - "bytes" - "fmt" - "strings" - "time" - - "github.com/flatcar-linux/mantle/kola" - "github.com/flatcar-linux/mantle/kola/cluster" - "github.com/flatcar-linux/mantle/kola/register" - "github.com/flatcar-linux/mantle/platform" - "github.com/flatcar-linux/mantle/platform/conf" - "github.com/flatcar-linux/mantle/platform/machine/qemu" - "github.com/flatcar-linux/mantle/util" -) - -var config = conf.Ignition(`{ - "ignition": { - "version": "2.0.0" - }, - "systemd": { - "units": [{ - "name": "etcd-member.service", - "enable": true - }] - } -}`) - -func init() { - register.Register(®ister.Test{ - Name: "cl.rkt.etcd3", - Run: rktEtcd, - ClusterSize: 1, - Distros: []string{"cl"}, - UserData: config, - ExcludeChannels: []string{"alpha", "beta", "stable"}, - }) - - register.Register(®ister.Test{ - Name: "rkt.base", - ClusterSize: 1, - Run: rktBase, - Distros: []string{"cl"}, - ExcludeChannels: []string{"alpha", "beta", "stable"}, - }) - -} - -func rktEtcd(c cluster.TestCluster) { - m := c.Machines()[0] - - etcdCmd := "etcdctl cluster-health" - etcdCheck := func() error { - output, err := c.SSH(m, etcdCmd) - if err != nil { - return fmt.Errorf("failed to run %q: output: %q status: %q", etcdCmd, output, err) - } - - return nil - } - - if err := util.Retry(60, 3*time.Second, etcdCheck); err != nil { - c.Fatalf("etcd in rkt failed health check: %v", err) - } -} - -// we use subtests to improve testing performance here. Creating the aci is -// more expensive than actually running most of these tests. -func rktBase(c cluster.TestCluster) { - m := c.Machines()[0] - - // TODO this should not be necessary, but is at the time of writing - c.MustSSH(m, "sudo setenforce 0") - - createTestAci(c, m, "test.rkt.aci", []string{"echo", "sleep", "sh"}) - - journalForPodContains := func(c cluster.TestCluster, uuidFile string, contains string) { - output := c.MustSSH(m, fmt.Sprintf("journalctl --dir /var/log/journal/$(cat %s | sed 's/-//g')", uuidFile)) - if !bytes.Contains(output, []byte(contains)) { - c.Fatalf("expected journal logs from machine dir to include app output %q; was %s", contains, output) - } - } - - c.Run("cli", func(c cluster.TestCluster) { - uuidFile := "/tmp/run-test.uuid" - - output := c.MustSSH(m, fmt.Sprintf("sudo rkt run --uuid-file-save=%s test.rkt.aci:latest --exec=sh -- -c 'echo success'", uuidFile)) - defer c.SSH(m, fmt.Sprintf("sudo rkt rm --uuid-file=%s", uuidFile)) - - if !bytes.Contains(output, []byte("success")) { - c.Fatalf("expected rkt stdout to include app output ('success'); was %s", output) - } - - journalForPodContains(c, uuidFile, "success") - }) - - c.Run("unit", func(c cluster.TestCluster) { - uuidFile := "/tmp/run-as-unit-test.uuid" - - c.MustSSH(m, fmt.Sprintf("sudo systemd-run --quiet --unit run-as-unit.service -- rkt run --uuid-file-save=%s test.rkt.aci:latest --exec=sh -- -c 'echo success'", uuidFile)) - defer c.SSH(m, fmt.Sprintf("sudo rkt rm --uuid-file=%s", uuidFile)) - - c.MustSSH(m, fmt.Sprintf("while ! [ -s %s ]; do sleep 0.1; done; rkt status --wait $(cat %s)", uuidFile, uuidFile)) - - journalForPodContains(c, uuidFile, "success") - }) - - c.Run("machinectl-integration", func(c cluster.TestCluster) { - uuidFile := "/tmp/run-machinectl.uuid" - - c.MustSSH(m, fmt.Sprintf("sudo systemd-run --quiet --unit run-machinectl -- rkt run --uuid-file-save=%s test.rkt.aci:latest --exec=sleep -- inf", uuidFile)) - defer c.SSH(m, fmt.Sprintf("sudo rkt rm --uuid-file=%s", uuidFile)) - - c.MustSSH(m, fmt.Sprintf("while ! [ -s %s ]; do sleep 0.1; done; rkt status --wait-ready $(cat %s)", uuidFile, uuidFile)) - - machinectlOutput := c.MustSSH(m, fmt.Sprintf("machinectl show rkt-$(cat %s)", uuidFile)) - - for _, line := range []string{"State=running", "Class=container", "Service=rkt"} { - if !bytes.Contains(machinectlOutput, []byte(line)) { - c.Fatalf("expected machinectl to include %q: was %s", line, machinectlOutput) - } - } - - c.MustSSH(m, fmt.Sprintf("sudo rkt stop --uuid-file=%s", uuidFile)) - c.MustSSH(m, fmt.Sprintf("rkt status --wait $(cat %s)", uuidFile)) - }) -} - -// TODO: once rkt can fetch a local 'docker' image, using `genDockerContainer` -// from the docker test file could be a better solution. -func createTestAci(c cluster.TestCluster, m platform.Machine, name string, bins []string) { - // Has format strings for: - // 1) aci name - // 2) arch - testAciManifest := `{ - "acKind": "ImageManifest", - "acVersion": "0.8.9", - "name": "%s", - "labels": [{"name": "os","value": "linux"},{"name": "arch","value": "%s"},{"name": "version","value": "latest"}] -}` - - arch := "amd64" - if _, ok := c.Cluster.(*qemu.Cluster); ok && kola.QEMUOptions.Board == "arm64-usr" { - arch = "aarch64" - } - - c.MustSSH(m, `set -e - tmpdir=$(mktemp -d) - cd $tmpdir - cat > manifest < Date: Wed, 1 Dec 2021 11:00:28 +0100 Subject: [PATCH 2/2] changelog: add entry Signed-off-by: Mathieu Tortuyaux --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index df9d735f4..f3657fc7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Removed - Legacy Kola Kubernetes tests ([#250](https://github.com/flatcar-linux/mantle/pull/250)) +- `rkt` kola tests ([#261](https://github.com/flatcar-linux/mantle/pull/261)) ## [0.17.0] - 05/10/2021 ### Security