Fix getting lvm recovery (#70)

This commit is contained in:
Itxaka
2023-06-23 14:49:38 +02:00
committed by GitHub
parent f051fab7bc
commit 9dd1dbddbe
14 changed files with 312 additions and 621 deletions

View File

@@ -115,9 +115,6 @@ stages:
runner = v1mock.NewFakeRunner()
runner.SideEffect = func(cmd string, args ...string) ([]byte, error) {
if cmd == "lsblk" && args[0] == "--list" {
return lsblkMockOutput(), nil
}
if cmd == cmdFail {
return []byte{}, errors.New("command error")
}
@@ -253,8 +250,7 @@ stages:
`, device)), constants.FilePerm)
Expect(err).To(BeNil())
cloudRunner := NewYipCloudInitRunner(logger, runner, afs)
res := cloudRunner.Run("test", "/some/yip")
Expect(res).NotTo(BeNil())
Expect(cloudRunner.Run("test", "/some/yip")).NotTo(BeNil())
})
It("Fails to find device by path", func() {
err := afs.WriteFile("/some/yip/layout.yaml", []byte(`
@@ -284,28 +280,3 @@ stages:
})
})
})
func lsblkMockOutput() []byte {
return []byte(`{ "blockdevices":
[
{
"name": "device",
"pkname": "",
"path": "/dev/device",
"fstype": "",
"mountpoint": "",
"size": 0,
"ro": false,
"label": ""
},{
"name": "device1",
"pkname": "device",
"path": "/dev/device1",
"fstype": "ext4",
"mountpoint": "/mnt/fake1",
"size": 0,
"ro": false,
"label": "DEV_LABEL"
}
]}`)
}