Skip to content

Commit

Permalink
Merge pull request #334 from flatcar-linux/tormath1/networkd
Browse files Browse the repository at this point in the history
test/ignition: add `networkd` translation test
  • Loading branch information
tormath1 authored Jun 3, 2022
2 parents 481a860 + cd4c299 commit d0bd70a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Ignition v3 support and tests ([#301](https://github.com/flatcar-linux/mantle/pull/301), [#311](https://github.com/flatcar-linux/mantle/pull/311))
- Butane config support ([#318](https://github.com/flatcar-linux/mantle/pull/318))
- GCP: support testing with GVNIC ([#322](https://github.com/flatcar-linux/mantle/pull/322))
- `networkd` Ignition translation test ([#344](https://github.com/flatcar-linux/mantle/pull/334))

### Changed
- removed `packet` occurrences in favor of `equinixmetal` ([#277](https://github.com/flatcar-linux/mantle/pull/277))
Expand Down
21 changes: 18 additions & 3 deletions kola/tests/ignition/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,26 @@ func init() {
Distros: []string{"cl", "fcos", "rhcos"},
})
register.Register(&register.Test{
Name: "cl.ignition.links",
Run: testLink,
Name: "cl.ignition.translation",
Run: testTranslation,
ClusterSize: 1,
// Important: the link's path shares a prefix with the
// file's path and should pass the ign-converter sanity
// check for not using a link dir in the file path
UserData: conf.Ignition(`{
"ignition": { "version": "2.3.0" },
"networkd": {
"units": [
{
"name": "00-dummy.netdev",
"contents": "[NetDev]\nName=kola\nKind=dummy"
},
{
"name": "00-dummy.network",
"contents": "[Match]\nName=kola\n\n[Network]\nAddress=10.0.2.1/24"
}
]
},
"storage": {
"files": [
{
Expand Down Expand Up @@ -130,9 +142,12 @@ func runsOnce(c cluster.TestCluster) {
c.MustSSH(m, "test ! -e /etc/ignition-ran")
}

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

// fail if link is broken or does not exist
c.MustSSH(m, "ls /testdir/hello")

// assert that the networkd configuration has correctly been translated to files and applied.
c.AssertCmdOutputContains(m, `ip --json address show kola | jq -r '.[] | .addr_info | .[] | select( .family == "inet") | .local'`, "10.0.2.1")
}

0 comments on commit d0bd70a

Please sign in to comment.