From 0ad1bf30d7210b3d9485e959982b42c7ecc70b64 Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Tue, 31 May 2022 17:21:19 +0200 Subject: [PATCH] test/locksmith: add airlock test this test spawns an etcd node with a airlock instance. We try to lock the instance via airlock + etcd in order to validate the behavior. Signed-off-by: Mathieu Tortuyaux --- kola/tests/locksmith/locksmith.go | 76 +++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/kola/tests/locksmith/locksmith.go b/kola/tests/locksmith/locksmith.go index 74aa31671..767c3dd6f 100644 --- a/kola/tests/locksmith/locksmith.go +++ b/kola/tests/locksmith/locksmith.go @@ -33,6 +33,75 @@ import ( ) func init() { + register.Register(®ister.Test{ + Name: "cl.locksmith.airlock", + Run: airlock, + ClusterSize: 1, + UserData: conf.Butane(`--- +variant: flatcar +version: 1.0.0 +systemd: + units: + - name: update-engine.service + enabled: true + - name: etcd-member.service + enabled: true + - name: locksmithd.service + enabled: true + dropins: + - name: custom.conf + contents: | + [Service] + Environment=LOCKSMITHD_ENDPOINT=http://127.0.0.1:3333 + Environment=LOCKSMITHD_GROUP=default + Environment=LOCKSMITHD_ID=12345 + - name: airlock.service + enabled: true + contents: | + [Install] + WantedBy=multi-user.target + [Unit] + After=etcd-member.service + Requires=etcd-member.service + [Service] + Type=fork + ExecStartPre=-/usr/bin/docker stop airlock + ExecStartPre=-/usr/bin/docker pull quay.io/coreos/airlock:main + ExecStart=/usr/bin/docker \ + run \ + --rm \ + --network host \ + --name airlock \ + -v "/opt/config.toml:/etc/airlock/config.toml:ro,z" \ + quay.io/coreos/airlock:main \ + airlock serve -vv +storage: + files: + - path: /opt/config.toml + contents: + inline: | + # Main service configuration + [service] + address = "127.0.0.1" + port = 3333 + tls = false + # Etcd-v3 client configuration + [etcd3] + endpoints = [ "http://127.0.0.1:2379" ] + # Lock configuration, base reboot group + [lock] + default_group_name = "default" + default_slots = 2 + # Lock configuration, additional reboot groups + [[lock.groups]] + name = "workers" + [[lock.groups]] + name = "controllers" + slots = 1 + mode: 0644`), + Distros: []string{"cl"}, + Platforms: []string{"qemu"}, + }) register.Register(®ister.Test{ Name: "cl.locksmith.cluster", Run: locksmithCluster, @@ -218,3 +287,10 @@ func locksmithTLS(c cluster.TestCluster) { c.Fatal(err) } } + +func airlock(c cluster.TestCluster) { + m := c.Machines()[0] + + c.MustSSH(m, "locksmithctl exp --id kola-test-id --group default --endpoint http://localhost:3333 lock") + c.AssertCmdOutputContains(m, "docker exec airlock airlock exp get slots", "kola-test-id") +}