mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-26 08:26:26 -06:00
85f0fba9f9
* providers: ignition, basic config, version and config * providers: ignition, user and passwd example, general cache implementation * vendor: Capture new dependency upstream-pkg * providers: ignition ignition_user * providers: ignition ignition_disk, ignition_group and ignition_raid * providers: ignition_file and ignition_filesystem * providers: ignition_systemd_unit and ignition_networkd_unit * providers: ignition_config improvements * vendor: Capture new dependency upstream-pkg * providers: ignition main * documentation: ignition provider * providers: ignition minor changes * providers: ignition, fix test * fixing tests and latest versions
40 lines
798 B
Go
40 lines
798 B
Go
package ignition
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/coreos/ignition/config/types"
|
|
)
|
|
|
|
func TestIngnitionNetworkdUnit(t *testing.T) {
|
|
testIgnition(t, `
|
|
resource "ignition_networkd_unit" "foo" {
|
|
name = "foo.link"
|
|
content = "[Match]\nName=eth0\n\n[Network]\nAddress=10.0.1.7\n"
|
|
}
|
|
|
|
resource "ignition_config" "test" {
|
|
networkd = [
|
|
"${ignition_networkd_unit.foo.id}",
|
|
]
|
|
}
|
|
`, func(c *types.Config) error {
|
|
if len(c.Networkd.Units) != 1 {
|
|
return fmt.Errorf("networkd, found %d", len(c.Networkd.Units))
|
|
}
|
|
|
|
u := c.Networkd.Units[0]
|
|
|
|
if u.Name != "foo.link" {
|
|
return fmt.Errorf("name, found %q", u.Name)
|
|
}
|
|
|
|
if u.Contents != "[Match]\nName=eth0\n\n[Network]\nAddress=10.0.1.7\n" {
|
|
return fmt.Errorf("content, found %q", u.Contents)
|
|
}
|
|
|
|
return nil
|
|
})
|
|
}
|