Skip to content

Commit 83a23c1

Browse files
committed
Reproduce 2297 harvester 8759
Signed-off-by: Jian Wang <[email protected]>
1 parent d6f7ff8 commit 83a23c1

File tree

8 files changed

+134
-0
lines changed

8 files changed

+134
-0
lines changed

pkg/cloudinit/cloudinit_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,43 @@ var _ = Describe("CloudRunner", Label("CloudRunner", "types", "cloud-init"), fun
5151
Describe("loading yaml files", func() {
5252
logger := v1.NewNullLogger()
5353

54+
It("executes commands a1", func() {
55+
fs := vfs.OSFS
56+
var err error
57+
runner := NewYipCloudInitRunner(logger, &v1.RealRunner{}, fs)
58+
path := "/go/src/github.com/rancher/elemental-toolkit-v11x/elemental-toolkit/pkg/cloudinit"
59+
err = runner.Run("rootfs", path)
60+
Expect(err).Should(BeNil())
61+
})
62+
63+
It("executes commands a2", func() {
64+
fs := vfs.OSFS
65+
var err error
66+
runner := NewYipCloudInitRunner(logger, &v1.RealRunner{}, fs)
67+
path := "/go/src/github.com/rancher/elemental-toolkit-v11x/elemental-toolkit/pkg/cloudinit"
68+
err = runner.Run("initramfs", path)
69+
Expect(err).Should(BeNil())
70+
})
71+
72+
It("executes commands a3", func() {
73+
fs := vfs.OSFS
74+
var err error
75+
runner := NewYipCloudInitRunner(logger, &v1.RealRunner{}, fs)
76+
path := "/go/src/github.com/rancher/elemental-toolkit-v11x/elemental-toolkit/pkg/cloudinit"
77+
err = runner.Run("fs", path)
78+
Expect(err).Should(BeNil())
79+
})
80+
81+
It("executes commands a4", func() {
82+
fs := vfs.OSFS
83+
var err error
84+
runner := NewYipCloudInitRunner(logger, &v1.RealRunner{}, fs)
85+
path := "/go/src/github.com/rancher/elemental-toolkit-v11x/elemental-toolkit/pkg/cloudinit"
86+
err = runner.Run("boot", path)
87+
Expect(err).Should(BeNil())
88+
})
89+
90+
5491
It("executes commands", func() {
5592

5693
fs2, cleanup2, err := vfst.NewTestFS(map[string]interface{}{})
@@ -342,5 +379,6 @@ stages:
342379
cloudRunner := NewYipCloudInitRunner(logger, runner, afs)
343380
Expect(cloudRunner.Run("test", "/some/yip")).NotTo(BeNil())
344381
})
382+
345383
})
346384
})

pkg/cloudinit/data/00_test.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
stages:
2+
rootfs:
3+
- name: "testtest-rootfs-stage-from-00_test_yaml"
4+
commands:
5+
- ls
6+
initramfs:
7+
- name: "testtest-initramfs-stage-from-00_test_yaml"
8+
commands:
9+
- ls
10+
fs:
11+
- name: "testtest-fs-stage-from-00_test_yaml"
12+
commands:
13+
- ls
14+
boot:
15+
- name: "testtest-boot-stage-from-00_test_yaml"
16+
commands:
17+
- ls

pkg/cloudinit/data/05_test.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
stages:
2+
rootfs:
3+
- name: "testtest-rootfs-stage-from-05_test_yaml"
4+
commands:
5+
- ls
6+
initramfs:
7+
- name: "testtest-initramfs-stage-from-05_test_yaml"
8+
commands:
9+
- ls
10+
fs:
11+
- name: "testtest-fs-stage-from-05_test_yaml"
12+
commands:
13+
- ls
14+
boot:
15+
- name: "testtest-boot-stage-from-05_test_yaml"
16+
commands:
17+
- ls

pkg/cloudinit/data/85_test.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
stages:
2+
rootfs:
3+
- name: "testtest-rootfs-stage-from-85_test_yaml"
4+
commands:
5+
- ls
6+
initramfs:
7+
- name: "testtest-initramfs-stage-from-85_test_yaml"
8+
commands:
9+
- ls
10+
fs:
11+
- name: "testtest-fs-stage-from-85_test_yaml"
12+
commands:
13+
- ls
14+
boot:
15+
- name: "testtest-boot-stage-from-85_test_yaml"
16+
commands:
17+
- ls

pkg/cloudinit/data/90_custom.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name: Harvester Configuration
2+
stages:
3+
initramfs:
4+
- commands:
5+
- ls
6+
- date
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name: oem_settings
2+
stages:
3+
initramfs:
4+
- name: ntp
5+
commands:
6+
- ls

pkg/cloudinit/data/99_test.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
stages:
2+
rootfs:
3+
- name: "testtest-rootfs-stage-from-99_test_yaml"
4+
commands:
5+
- ls
6+
initramfs:
7+
- name: "testtest-initramfs-stage-from-99_test_yaml"
8+
commands:
9+
- ls
10+
fs:
11+
- name: "testtest-fs-stage-from-99_test_yaml"
12+
commands:
13+
- ls
14+
boot:
15+
- name: "testtest-boot-stage-from-99_test_yaml"
16+
commands:
17+
- ls

vendor/github.com/mudler/yip/pkg/executor/default.go

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)