Skip to content

Commit

Permalink
test: ensure that lxd snap is stopped before refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
jnsgruk committed Nov 20, 2024
1 parent fea22ef commit bbd14b0
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions internal/providers/lxd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,32 @@ func TestLXDPrepareCommands(t *testing.T) {
}
}

func TestLXDPrepareCommandsLXDAlreadyInstalled(t *testing.T) {
config := &config.Config{}

expected := []string{
"snap stop lxd",
"snap refresh lxd",
"lxd waitready",
"lxd init --minimal",
"lxc network set lxdbr0 ipv6.address none",
"chmod a+wr /var/snap/lxd/common/lxd/unix.socket",
"usermod -a -G lxd test-user",
"iptables -F FORWARD",
"iptables -P FORWARD ACCEPT",
}

system := system.NewMockSystem()
system.MockSnapStoreLookup("lxd", "", false, true)

lxd := NewLXD(system, config)
lxd.Prepare()

if !reflect.DeepEqual(expected, system.ExecutedCommands) {
t.Fatalf("expected: %v, got: %v", expected, system.ExecutedCommands)
}
}

func TestLXDRestore(t *testing.T) {
config := &config.Config{}

Expand Down

0 comments on commit bbd14b0

Please sign in to comment.