mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
* 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
60 lines
1.0 KiB
Go
60 lines
1.0 KiB
Go
package ignition
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/coreos/ignition/config/types"
|
|
)
|
|
|
|
func TestIngnitionGroup(t *testing.T) {
|
|
testIgnition(t, `
|
|
resource "ignition_group" "foo" {
|
|
name = "foo"
|
|
password_hash = "password"
|
|
gid = 42
|
|
}
|
|
|
|
resource "ignition_group" "qux" {
|
|
name = "qux"
|
|
}
|
|
|
|
resource "ignition_config" "test" {
|
|
groups = [
|
|
"${ignition_group.foo.id}",
|
|
"${ignition_group.qux.id}",
|
|
]
|
|
}
|
|
`, func(c *types.Config) error {
|
|
if len(c.Passwd.Groups) != 2 {
|
|
return fmt.Errorf("groups, found %d", len(c.Passwd.Groups))
|
|
}
|
|
|
|
g := c.Passwd.Groups[0]
|
|
|
|
if g.Name != "foo" {
|
|
return fmt.Errorf("name, found %q", g.Name)
|
|
}
|
|
|
|
if g.PasswordHash != "password" {
|
|
return fmt.Errorf("password_hash, found %q", g.PasswordHash)
|
|
}
|
|
|
|
if g.Gid == nil || *g.Gid != uint(42) {
|
|
return fmt.Errorf("gid, found %q", *g.Gid)
|
|
}
|
|
|
|
g = c.Passwd.Groups[1]
|
|
|
|
if g.Name != "qux" {
|
|
return fmt.Errorf("name, found %q", g.Name)
|
|
}
|
|
|
|
if g.Gid != nil {
|
|
return fmt.Errorf("uid, found %d", *g.Gid)
|
|
}
|
|
|
|
return nil
|
|
})
|
|
}
|