mirror of
https://github.com/kairos-io/kairos-sdk.git
synced 2025-09-23 11:57:07 +00:00
Override the ghw paths on ghw mock (#496)
This commit is contained in:
@@ -48,6 +48,8 @@ func (g *GhwMock) CreateDevices() {
|
|||||||
d, _ := os.MkdirTemp("", "ghwmock")
|
d, _ := os.MkdirTemp("", "ghwmock")
|
||||||
g.Chroot = d
|
g.Chroot = d
|
||||||
g.paths = ghw.NewPaths(d)
|
g.paths = ghw.NewPaths(d)
|
||||||
|
// Set the env override to the chroot
|
||||||
|
_ = os.Setenv("GHW_CHROOT", d)
|
||||||
// Create the /sys/block dir
|
// Create the /sys/block dir
|
||||||
_ = os.MkdirAll(g.paths.SysBlock, 0755)
|
_ = os.MkdirAll(g.paths.SysBlock, 0755)
|
||||||
// Create the /run/udev/data dir
|
// Create the /run/udev/data dir
|
||||||
@@ -157,5 +159,7 @@ func (g *GhwMock) RemovePartitionFromDisk(diskName string, partitionName string)
|
|||||||
|
|
||||||
// Clean will remove the chroot dir and unset the env var
|
// Clean will remove the chroot dir and unset the env var
|
||||||
func (g *GhwMock) Clean() {
|
func (g *GhwMock) Clean() {
|
||||||
|
// Uset the test override
|
||||||
|
_ = os.Unsetenv("GHW_CHROOT")
|
||||||
_ = os.RemoveAll(g.Chroot)
|
_ = os.RemoveAll(g.Chroot)
|
||||||
}
|
}
|
||||||
|
1
go.sum
1
go.sum
@@ -359,6 +359,7 @@ github.com/saferwall/pe v1.5.4 h1:tLmMggEMUfeqrpJ25zS/okUQmyFdD5xWKL2+z9njCqg=
|
|||||||
github.com/saferwall/pe v1.5.4/go.mod h1:mJx+PuptmNpoPFBNhWs/uDMFL/kTHVZIkg0d4OUJFbQ=
|
github.com/saferwall/pe v1.5.4/go.mod h1:mJx+PuptmNpoPFBNhWs/uDMFL/kTHVZIkg0d4OUJFbQ=
|
||||||
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4=
|
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4=
|
||||||
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY=
|
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY=
|
||||||
|
github.com/santhosh-tekuri/jsonschema/v6 v6.0.1/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
|
||||||
github.com/secDre4mer/pkcs7 v0.0.0-20240322103146-665324a4461d h1:RQqyEogx5J6wPdoxqL132b100j8KjcVHO1c0KLRoIhc=
|
github.com/secDre4mer/pkcs7 v0.0.0-20240322103146-665324a4461d h1:RQqyEogx5J6wPdoxqL132b100j8KjcVHO1c0KLRoIhc=
|
||||||
github.com/secDre4mer/pkcs7 v0.0.0-20240322103146-665324a4461d/go.mod h1:PegD7EVqlN88z7TpCqH92hHP+GBpfomGCCnw1PFtNOA=
|
github.com/secDre4mer/pkcs7 v0.0.0-20240322103146-665324a4461d/go.mod h1:PegD7EVqlN88z7TpCqH92hHP+GBpfomGCCnw1PFtNOA=
|
||||||
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||||
|
@@ -6,10 +6,10 @@ type Partition struct {
|
|||||||
Size uint `yaml:"size,omitempty" mapstructure:"size"`
|
Size uint `yaml:"size,omitempty" mapstructure:"size"`
|
||||||
FS string `yaml:"fs,omitempty" mapstrcuture:"fs"`
|
FS string `yaml:"fs,omitempty" mapstrcuture:"fs"`
|
||||||
Flags []string `yaml:"flags,omitempty" mapstrcuture:"flags"`
|
Flags []string `yaml:"flags,omitempty" mapstrcuture:"flags"`
|
||||||
UUID string
|
UUID string `yaml:"uuid,omitempty" mapstructure:"uuid"`
|
||||||
MountPoint string `yaml:"-"`
|
MountPoint string `yaml:"-"`
|
||||||
Path string `yaml:"-"`
|
Path string `yaml:"-"`
|
||||||
Disk string `yaml:"-"`
|
Disk string `yaml:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PartitionList []*Partition
|
type PartitionList []*Partition
|
||||||
|
Reference in New Issue
Block a user