Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some ignition/v3 test #301

Merged
merged 9 commits into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Azure: support for running Kola within an existing vnet and with private addressing ([#295](https://github.com/flatcar-linux/mantle/pull/295))
- kola tests `cl.cgroupv1` and `kubeadm.*.*.cgroupv1.base` that test functionality with cgroupv1 ([#298](https://github.com/flatcar-linux/mantle/pull/298))
- Added private network support to qemu-unpriv platform ([#307](https://github.com/flatcar-linux/mantle/pull/307))
- Ignition v3 support and tests ([#301](https://github.com/flatcar-linux/mantle/pull/301))

### Changed
- removed `packet` occurrences in favor of `equinixmetal` ([#277](https://github.com/flatcar-linux/mantle/pull/277))
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ require (
github.com/coreos/yaml v0.0.0-20141224210557-6b16a5714269 // indirect
github.com/digitalocean/godo v1.45.0
github.com/flatcar-linux/container-linux-config-transpiler v0.9.3-0.20220208152502-6e8303479682
github.com/flatcar-linux/ignition v0.36.1
github.com/flatcar-linux/ignition/v2 v2.2.1-0.20220107090316-32908ec8bade
github.com/flatcar-linux/ignition v0.36.2-0.20220221101037-de4e6cc9bbba
github.com/flatcar-linux/ignition/v2 v2.2.1-0.20220311122140-cb95c51122f5
github.com/form3tech-oss/jwt-go v3.2.5+incompatible // indirect
github.com/godbus/dbus v0.0.0-20181025153459-66d97aec3384
github.com/golang/protobuf v1.5.2
Expand All @@ -31,7 +31,7 @@ require (
github.com/pborman/uuid v1.2.0
github.com/pin/tftp v2.1.0+incompatible
github.com/spf13/cobra v1.1.3
github.com/spf13/pflag v1.0.5
github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace
github.com/stretchr/testify v1.7.0
github.com/ulikunitz/xz v0.5.10
github.com/vincent-petithory/dataurl v1.0.0
Expand Down
15 changes: 10 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/clarketm/json v1.14.1/go.mod h1:ynr2LRfb0fQU34l07csRNBTcivjySLLiY1YzQqKVfdo=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
Expand Down Expand Up @@ -169,10 +170,13 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/flatcar-linux/container-linux-config-transpiler v0.9.3-0.20220208152502-6e8303479682 h1:CiIJbwa0iC52LGviALcCtpnLpNa2hYXEdM64xFgALa0=
github.com/flatcar-linux/container-linux-config-transpiler v0.9.3-0.20220208152502-6e8303479682/go.mod h1:AGVTulMzeIKwurV9ExYH3UiokET1Ur65g+EIeRDMwzM=
github.com/flatcar-linux/ignition v0.36.1 h1:yNvS9sQvm9HJ8VgxXskx88DsF73qdF35ALJkbTwcYhY=
github.com/flatcar-linux/ign-converter v0.1.1-0.20220311112608-f121a881f370/go.mod h1:t/kcw0CQ/uKMCyZwDAzuwMO3CShxaimEJhQzLGCsb3Y=
github.com/flatcar-linux/ignition v0.36.1/go.mod h1:0jS5n4AopgOdwgi7QDo5MFgkMx/fQUDYjuxlGJC1Txg=
github.com/flatcar-linux/ignition/v2 v2.2.1-0.20220107090316-32908ec8bade h1:9GBoxuiqpcmCH6nGz4tbPLxrW21fRUdkR68qXVu4FMQ=
github.com/flatcar-linux/ignition/v2 v2.2.1-0.20220107090316-32908ec8bade/go.mod h1:edsyBkLOoqVhT99HwgWUXip9QNrR1dC2NF4oGhQj1gY=
github.com/flatcar-linux/ignition v0.36.2-0.20220221101037-de4e6cc9bbba h1:HiTCL7737Hi944kXfLN8ReGoJtAiibGIsCk3MGlYy9M=
github.com/flatcar-linux/ignition v0.36.2-0.20220221101037-de4e6cc9bbba/go.mod h1:JzHCIdCu9dy0xtezyBit/aOY4QIlJ12UYU6nXNPnnRE=
github.com/flatcar-linux/ignition/v2 v2.2.1-0.20220302150437-ce14e51676e9/go.mod h1:n076OVuGbg6f+j3YYoxFCjRyMU2hxsx6Q4Gy0xwO7cM=
github.com/flatcar-linux/ignition/v2 v2.2.1-0.20220311122140-cb95c51122f5 h1:k7xpW9MfyAxjsoA0HW6nnHlQnlNlPrPhHPNuT4uf7Xo=
github.com/flatcar-linux/ignition/v2 v2.2.1-0.20220311122140-cb95c51122f5/go.mod h1:C0FynALB9lic4GBqxCuNqUqfZlny9rySbFx0VVXy7uU=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
github.com/form3tech-oss/jwt-go v3.2.5+incompatible h1:/l4kBbb4/vGSsdtB5nUe8L7B9mImVMaBPw9L/0TBHU8=
Expand Down Expand Up @@ -437,8 +441,9 @@ github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M=
github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace h1:9PNP1jnUjRhfmGMlkXHjYPishpcw4jpSt/V/xYY3FMA=
github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand All @@ -453,7 +458,6 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8=
github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/vincent-petithory/dataurl v0.0.0-20160330182126-9a301d65acbb/go.mod h1:FHafX5vmDzyP+1CQATJn7WFKc9CvnvxyvZy6I1MrG/U=
github.com/vincent-petithory/dataurl v1.0.0 h1:cXw+kPto8NLuJtlMsI152irrVw9fRDX8AbShPRpg2CI=
github.com/vincent-petithory/dataurl v1.0.0/go.mod h1:FHafX5vmDzyP+1CQATJn7WFKc9CvnvxyvZy6I1MrG/U=
github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5 h1:+UB2BJA852UkGH42H+Oee69djmxS3ANzl2b/JtT1YiA=
Expand Down Expand Up @@ -522,6 +526,7 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.17.0 h1:MTjgFu6ZLKvY6Pvaqk97GlxNBuMpV4Hy/3P6tRGlI2U=
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
go4.org v0.0.0-20160314031811-03efcb870d84/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
go4.org v0.0.0-20200104003542-c7e774b10ea0/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
go4.org v0.0.0-20201209231011-d4a079459e60 h1:iqAGo78tVOJXELHQFRjR6TMwItrvXH4hrGJ32I/NFF8=
go4.org v0.0.0-20201209231011-d4a079459e60/go.mod h1:CIiUVy99QCPfoE13bO4EZaz5GZMZXMSBGhxRdsvzbkg=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
Expand Down
10 changes: 10 additions & 0 deletions kola/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,13 @@ func (t *TestCluster) MustSSH(m platform.Machine, cmd string) []byte {
}
return out
}

// AssertCmdOutputContains runs cmd via SSH and panics if stdout does not contain expected
func (t *TestCluster) AssertCmdOutputContains(m platform.Machine, cmd string, expected string) {
t.Logf("+ " + cmd)
outputBuf := t.MustSSH(m, cmd)
output := string(outputBuf)
if !strings.Contains(output, expected) {
t.Fatalf("cmd %s did not output %s", cmd, expected)
}
}
33 changes: 33 additions & 0 deletions kola/tests/ignition/kernel.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright The Mantle Authors
// SPDX-License-Identifier: Apache-2.0
package ignition

import (
"github.com/coreos/go-semver/semver"
"github.com/flatcar-linux/mantle/kola/cluster"
"github.com/flatcar-linux/mantle/kola/register"
"github.com/flatcar-linux/mantle/platform/conf"
)

func init() {
register.Register(&register.Test{
Name: "cl.ignition.kargs",
Run: check,
ClusterSize: 1,
UserData: conf.Ignition(`{
"ignition": {
"version": "3.3.0"
},
"kernelArguments": {
"shouldExist": ["quiet"]
}
}`),
MinVersion: semver.Version{Major: 3185},
})
}

func check(c cluster.TestCluster) {
m := c.Machines()[0]

c.AssertCmdOutputContains(m, "cat /proc/cmdline", " quiet") // assuming space for word separation
}
47 changes: 47 additions & 0 deletions kola/tests/ignition/symlink.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright The Mantle Authors
// Copyright 2020 Red Hat
// SPDX-License-Identifier: Apache-2.0
package ignition

import (
"github.com/coreos/go-semver/semver"
"github.com/flatcar-linux/mantle/kola/cluster"
"github.com/flatcar-linux/mantle/kola/register"
"github.com/flatcar-linux/mantle/platform/conf"
)

func init() {
register.Register(&register.Test{
Name: "cl.ignition.symlink",
Run: writeAbsoluteSymlink,
ClusterSize: 1,
UserData: conf.Ignition(`{
"ignition": {
"version": "3.0.0"
},
"storage": {
"links": [
{
"group": {
"name": "core"
},
"overwrite": true,
"path": "/etc/localtime",
"user": {
"name": "core"
},
"hard": false,
"target": "/usr/share/zoneinfo/Europe/Zurich"
}
]
}
}`),
MinVersion: semver.Version{Major: 3185},
})
}

func writeAbsoluteSymlink(c cluster.TestCluster) {
m := c.Machines()[0]

c.AssertCmdOutputContains(m, "readlink /etc/localtime", "/usr/share/zoneinfo/Europe/Zurich")
}
56 changes: 56 additions & 0 deletions kola/tests/ignition/units.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright The Mantle Authors
// Copyright 2020 Red Hat
// SPDX-License-Identifier: Apache-2.0
package ignition

import (
"github.com/flatcar-linux/mantle/kola/cluster"
"github.com/flatcar-linux/mantle/kola/register"
"github.com/flatcar-linux/mantle/platform/conf"
)

func init() {
register.Register(&register.Test{
Name: "cl.ignition.instantiated.enable-unit",
Run: enableSystemdInstantiatedService,
ClusterSize: 1,
UserData: conf.Ignition(`{
"ignition": {"version": "3.0.0"},
"systemd": {
"units": [{
"name": "echo@.service",
"contents": "[Unit]\nDescription=f\n[Service]\nType=oneshot\nExecStart=/bin/echo %i\nRemainAfterExit=yes\n[Install]\nWantedBy=multi-user.target\n"
},
{
"name": "echo@.timer",
"contents": "[Unit]\nDescription=echo timer template\n[Timer]\nOnUnitInactiveSec=10s\n[Install]\nWantedBy=timers.target"
},
{
"enabled": true,
"name": "echo@bar.service"
},
{
"enabled": true,
"name": "echo@foo.service"
},
{
"enabled": true,
"name": "echo@foo.timer"
}]
}
}`),
Distros: []string{"cl"},
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tormath1 this need a MinVersion doesn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, version 3.0.0... Totally missed this one.

}

func enableSystemdInstantiatedService(c cluster.TestCluster) {
m := c.Machines()[0]
// MustSSH function will throw an error if the exit code
// of the command is anything other than 0.
_ = c.MustSSH(m, "systemctl -q is-active echo@foo.service")
_ = c.MustSSH(m, "systemctl -q is-active echo@bar.service")
_ = c.MustSSH(m, "systemctl -q is-enabled echo@foo.service")
_ = c.MustSSH(m, "systemctl -q is-enabled echo@bar.service")
_ = c.MustSSH(m, "systemctl -q is-active echo@foo.timer")
_ = c.MustSSH(m, "systemctl -q is-enabled echo@foo.timer")
}
Loading