-
Notifications
You must be signed in to change notification settings - Fork 13
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
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ecb36e0
test/ignition: add units test
tormath1 907d1a6
kola/cluster: add helper to check cmd output
tormath1 73a12cf
test/ignition: add symlink test
tormath1 edf16cb
mod: bump ignition/v2
tormath1 e598c97
sum: go mod tidy
tormath1 d74aaf8
vendor: go mod vendor
tormath1 29dc5e0
platform/conf: support ignition 3.1, 3.2 and 3.3
tormath1 615778a
test/ignition: add kargs test
tormath1 69b6d94
changelog: add entry
tormath1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(®ister.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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(®ister.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") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(®ister.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"}, | ||
}) | ||
} | ||
|
||
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") | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.