Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
Signed-off-by: Kimmo Lehto <[email protected]>
  • Loading branch information
kke committed Dec 2, 2024
1 parent 3b02c56 commit cb326f2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/host_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,16 @@ func TestFlagsChanged(t *testing.T) {
h := Host{
Configurer: cfg,
DataDir: "/tmp/data",
Role: "controller",
Role: "controller+worker",
PrivateAddress: "10.0.0.1",
InstallFlags: []string{"--foo='bar'", "--bar=foo"},
Metadata: HostMetadata{
K0sStatusArgs: []string{"--foo=bar", `--bar="foo"`, "--data-dir=/tmp/data", "--token-file=/tmp/token", "--config=/tmp/foo.yaml"},
K0sStatusArgs: []string{"--foo=bar", `--bar="foo"`, "--enable-worker=true", "--data-dir=/tmp/data", "--token-file=/tmp/token", "--config=/tmp/foo.yaml"},
},
}
require.False(t, h.FlagsChanged())
newFlags, err := h.K0sInstallFlags()
require.NoError(t, err)
require.False(t, h.FlagsChanged(), "flags %+v should not be considered different from %+v", newFlags, h.Metadata.K0sStatusArgs)
h.InstallFlags = []string{"--foo=bar", `--bar="foo"`}
require.False(t, h.FlagsChanged())
h.InstallFlags = []string{"--foo=baz", `--bar="foo"`}
Expand Down

0 comments on commit cb326f2

Please sign in to comment.