PE-5115 add cluster reset event (#95)

* add cluster reset event

Signed-off-by: Nianyu Shen <xiaoyu9964@gmail.com>

* bump go to 1.23

Signed-off-by: Nianyu Shen <xiaoyu9964@gmail.com>

* fix uninstall script name

Signed-off-by: Nianyu Shen <xiaoyu9964@gmail.com>

---------

Signed-off-by: Nianyu Shen <xiaoyu9964@gmail.com>
This commit is contained in:
Nianyu Shen
2024-09-29 18:28:26 -07:00
committed by GitHub
parent 1426d16933
commit 4fcff11e7e
8 changed files with 67 additions and 132 deletions

View File

@@ -6,8 +6,6 @@ import (
"testing"
"github.com/kairos-io/kairos-sdk/clusterplugin"
yip "github.com/mudler/yip/pkg/schema"
"github.com/onsi/gomega"
)
func Test_parseOptions(t *testing.T) {
@@ -89,52 +87,3 @@ func Test_parseOptions(t *testing.T) {
})
}
}
func Test_rootPathMountStage(t *testing.T) {
gomega.RegisterTestingT(t)
type args struct {
rootPath string
}
tests := []struct {
name string
args args
want yip.Stage
}{
{
name: "custom root path",
args: args{
rootPath: "/writable",
},
want: yip.Stage{
Name: "Mount K3s data, conf directories",
Commands: []string{
"mkdir -p /writable/etc/rancher",
"mkdir -p /etc/rancher",
"systemctl enable --now etc-rancher.mount",
"mkdir -p /writable/var/lib/rancher",
"mkdir -p /var/lib/rancher",
"systemctl enable --now var-lib-rancher.mount",
},
Files: []yip.File{
{
Path: "/run/systemd/system/etc-rancher.mount",
Permissions: 0644,
Content: "[Unit]\nDescription=etc-rancher mount unit\nBefore=local-fs.target k3s.service k3s-agent.service\n\n[Mount]\nWhat=/writable/etc/rancher\nWhere=/etc/rancher\nType=none\nOptions=bind\n\n[Install]\nWantedBy=local-fs.target\n",
},
{
Path: "/run/systemd/system/var-lib-rancher.mount",
Permissions: 0644,
Content: "[Unit]\nDescription=var-lib-rancher mount unit\nBefore=local-fs.target k3s.service k3s-agent.service\n\n[Mount]\nWhat=/writable/var/lib/rancher\nWhere=/var/lib/rancher\nType=none\nOptions=bind\n\n[Install]\nWantedBy=local-fs.target\n",
},
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := rootPathMountStage(tt.args.rootPath)
gomega.Expect(got).To(gomega.Equal(tt.want))
})
}
}