@@ -62,7 +62,7 @@ func TestFindDevice(t *testing.T) {
6262 t .Run ("match by exact name" , func (t * testing.T ) {
6363 blockEntries := BlockDevices {
6464 BlockDevices : []* BlockDevice {
65- {Name : "sda" , Children : []* BlockDevice {{Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoints : [] string { "/" } }}},
65+ {Name : "sda" , Children : []* BlockDevice {{Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoint : "/" }}},
6666 {Name : "nvme0n1" , Children : []* BlockDevice {{Uuid : "12345" , FsType : "xfs" , Label : "ROOT" , Name : "nvmd1n1" }, {Uuid : "12345" , FsType : "" , Label : "EFI" }}},
6767 {Name : "sdx" , Children : []* BlockDevice {{Uuid : "12346" , FsType : "xfs" , Label : "ROOT" , Name : "sdh1" }, {Uuid : "12345" , FsType : "" , Label : "EFI" }}},
6868 },
@@ -77,7 +77,7 @@ func TestFindDevice(t *testing.T) {
7777 t .Run ("match by alias name" , func (t * testing.T ) {
7878 blockEntries := BlockDevices {
7979 BlockDevices : []* BlockDevice {
80- {Name : "sda" , Children : []* BlockDevice {{Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoints : [] string { "/" } }}},
80+ {Name : "sda" , Children : []* BlockDevice {{Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoint : "/" }}},
8181 {Name : "nvme0n1" , Children : []* BlockDevice {{Uuid : "12345" , FsType : "xfs" , Label : "ROOT" , Name : "nvmd1n1" }, {Uuid : "12345" , FsType : "" , Label : "EFI" }}},
8282 {Name : "sdx" , Aliases : []string {"xvdx" }, Children : []* BlockDevice {{Uuid : "12346" , FsType : "xfs" , Label : "ROOT" , Name : "sdh1" }, {Uuid : "12345" , FsType : "" , Label : "EFI" }}},
8383 },
@@ -92,7 +92,7 @@ func TestFindDevice(t *testing.T) {
9292 t .Run ("match by interchangeable name" , func (t * testing.T ) {
9393 blockEntries := BlockDevices {
9494 BlockDevices : []* BlockDevice {
95- {Name : "sda" , Children : []* BlockDevice {{Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoints : [] string { "/" } }}},
95+ {Name : "sda" , Children : []* BlockDevice {{Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoint : "/" }}},
9696 {Name : "nvme0n1" , Children : []* BlockDevice {{Uuid : "12345" , FsType : "xfs" , Label : "ROOT" , Name : "nvmd1n1" }, {Uuid : "12345" , FsType : "" , Label : "EFI" }}},
9797 {Name : "xvdc" , Children : []* BlockDevice {{Uuid : "12346" , FsType : "xfs" , Label : "ROOT" , Name : "sdh1" }, {Uuid : "12345" , FsType : "" , Label : "EFI" }}},
9898 },
@@ -107,7 +107,7 @@ func TestFindDevice(t *testing.T) {
107107 t .Run ("no match" , func (t * testing.T ) {
108108 blockEntries := BlockDevices {
109109 BlockDevices : []* BlockDevice {
110- {Name : "sda" , Children : []* BlockDevice {{Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoints : [] string { "/" } }}},
110+ {Name : "sda" , Children : []* BlockDevice {{Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoint : "/" }}},
111111 {Name : "nvme0n1" , Children : []* BlockDevice {{Uuid : "12345" , FsType : "xfs" , Label : "ROOT" , Name : "nvmd1n1" }, {Uuid : "12345" , FsType : "" , Label : "EFI" }}},
112112 {Name : "xvdc" , Children : []* BlockDevice {{Uuid : "12346" , FsType : "xfs" , Label : "ROOT" , Name : "sdh1" }, {Uuid : "12345" , FsType : "" , Label : "EFI" }}},
113113 },
@@ -121,7 +121,7 @@ func TestFindDevice(t *testing.T) {
121121 t .Run ("multiple matches by trailing letter" , func (t * testing.T ) {
122122 blockEntries := BlockDevices {
123123 BlockDevices : []* BlockDevice {
124- {Name : "sda" , Children : []* BlockDevice {{Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoints : [] string { "/" } }}},
124+ {Name : "sda" , Children : []* BlockDevice {{Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoint : "/" }}},
125125 {Name : "nvme0n1" , Children : []* BlockDevice {{Uuid : "12345" , FsType : "xfs" , Label : "ROOT" , Name : "nvmd1n1" }, {Uuid : "12345" , FsType : "" , Label : "EFI" }}},
126126 {Name : "stc" , Children : []* BlockDevice {{Uuid : "12346" , FsType : "xfs" , Label : "ROOT" , Name : "sdh1" }, {Uuid : "12345" , FsType : "" , Label : "EFI" }}},
127127 {Name : "xvdc" , Children : []* BlockDevice {{Uuid : "12346" , FsType : "xfs" , Label : "ROOT" , Name : "sdh1" }, {Uuid : "12345" , FsType : "" , Label : "EFI" }}},
@@ -137,7 +137,7 @@ func TestFindDevice(t *testing.T) {
137137 t .Run ("perfect match and trailing letter matches" , func (t * testing.T ) {
138138 blockEntries := BlockDevices {
139139 BlockDevices : []* BlockDevice {
140- {Name : "sda" , Children : []* BlockDevice {{Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoints : [] string { "/" } }}},
140+ {Name : "sda" , Children : []* BlockDevice {{Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoint : "/" }}},
141141 {Name : "nvme0n1" , Children : []* BlockDevice {{Uuid : "12345" , FsType : "xfs" , Label : "ROOT" , Name : "nvmd1n1" }, {Uuid : "12345" , FsType : "" , Label : "EFI" }}},
142142 {Name : "sta" , Children : []* BlockDevice {{Uuid : "12346" , FsType : "xfs" , Label : "ROOT" , Name : "sdh1" }, {Uuid : "12345" , FsType : "" , Label : "EFI" }}},
143143 {Name : "xvda" , Children : []* BlockDevice {{Uuid : "12346" , FsType : "xfs" , Label : "ROOT" , Name : "sdh1" }, {Uuid : "12345" , FsType : "" , Label : "EFI" }}},
@@ -156,7 +156,7 @@ func TestFindDevice(t *testing.T) {
156156 {Name : "xvda" , Children : []* BlockDevice {{Uuid : "12346" , FsType : "xfs" , Label : "ROOT" , Name : "sdh1" }, {Uuid : "12345" , FsType : "" , Label : "EFI" }}},
157157 {Name : "sta" , Children : []* BlockDevice {{Uuid : "12346" , FsType : "xfs" , Label : "ROOT" , Name : "sdh1" }, {Uuid : "12345" , FsType : "" , Label : "EFI" }}},
158158 {Name : "nvme0n1" , Children : []* BlockDevice {{Uuid : "12345" , FsType : "xfs" , Label : "ROOT" , Name : "nvmd1n1" }, {Uuid : "12345" , FsType : "" , Label : "EFI" }}},
159- {Name : "sda" , Children : []* BlockDevice {{Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoints : [] string { "/" } }}},
159+ {Name : "sda" , Children : []* BlockDevice {{Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoint : "/" }}},
160160 },
161161 }
162162
@@ -172,7 +172,7 @@ func TestGetMountablePartition(t *testing.T) {
172172 block := BlockDevice {
173173 Name : "sda" ,
174174 Children : []* BlockDevice {
175- {Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoints : [] string { "/" } },
175+ {Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoint : "/" },
176176 },
177177 }
178178 _ , err := block .GetMountablePartition ()
@@ -184,7 +184,7 @@ func TestGetMountablePartition(t *testing.T) {
184184 block := BlockDevice {
185185 Name : "sda" ,
186186 Children : []* BlockDevice {
187- {Uuid : "1234" , FsType : "" , Label : "ROOT" , Name : "sda1" , MountPoints : [] string {} },
187+ {Uuid : "1234" , FsType : "" , Label : "ROOT" , Name : "sda1" , MountPoint : "" },
188188 },
189189 }
190190 _ , err := block .GetMountablePartition ()
@@ -196,7 +196,7 @@ func TestGetMountablePartition(t *testing.T) {
196196 block := BlockDevice {
197197 Name : "sda" ,
198198 Children : []* BlockDevice {
199- {Uuid : "1234" , FsType : "xfs" , Label : "EFI" , Name : "sda1" , MountPoints : [] string {} },
199+ {Uuid : "1234" , FsType : "xfs" , Label : "EFI" , Name : "sda1" , MountPoint : "" },
200200 },
201201 }
202202 _ , err := block .GetMountablePartition ()
@@ -208,7 +208,7 @@ func TestGetMountablePartition(t *testing.T) {
208208 block := BlockDevice {
209209 Name : "sda" ,
210210 Children : []* BlockDevice {
211- {Uuid : "1234" , FsType : "vfat" , Label : "" , Name : "sda1" , MountPoints : [] string {} },
211+ {Uuid : "1234" , FsType : "vfat" , Label : "" , Name : "sda1" , MountPoint : "" },
212212 },
213213 }
214214 _ , err := block .GetMountablePartition ()
@@ -220,7 +220,7 @@ func TestGetMountablePartition(t *testing.T) {
220220 block := BlockDevice {
221221 Name : "sda" ,
222222 Children : []* BlockDevice {
223- {Uuid : "1234" , FsType : "xfs" , Label : "boot" , Name : "sda1" , MountPoints : [] string {} },
223+ {Uuid : "1234" , FsType : "xfs" , Label : "boot" , Name : "sda1" , MountPoint : "" },
224224 },
225225 }
226226 _ , err := block .GetMountablePartition ()
@@ -270,11 +270,11 @@ func TestGetPartitions(t *testing.T) {
270270 Name : "sda" ,
271271 Children : []* BlockDevice {
272272 // already mounted
273- {Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoints : [] string { "/" } },
274- {Uuid : "12345" , FsType : "xfs" , Label : "ROOT" , Name : "sda2" , MountPoints : [] string {} },
275- {Uuid : "12346" , FsType : "xfs" , Label : "ROOT" , Name : "sda3" , MountPoints : [] string {} },
273+ {Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoint : "/" },
274+ {Uuid : "12345" , FsType : "xfs" , Label : "ROOT" , Name : "sda2" , MountPoint : "" },
275+ {Uuid : "12346" , FsType : "xfs" , Label : "ROOT" , Name : "sda3" , MountPoint : "" },
276276 // no fs type
277- {Uuid : "12347" , FsType : "" , Label : "ROOT" , Name : "sda4" , MountPoints : [] string {} },
277+ {Uuid : "12347" , FsType : "" , Label : "ROOT" , Name : "sda4" , MountPoint : "" },
278278 },
279279 }
280280 parts , err := block .GetPartitions (true , false )
@@ -306,11 +306,11 @@ func TestGetPartitions(t *testing.T) {
306306 Name : "sda" ,
307307 Children : []* BlockDevice {
308308 // already mounted
309- {Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoints : [] string { "/" } },
310- {Uuid : "12345" , FsType : "xfs" , Label : "ROOT" , Name : "sda2" , MountPoints : [] string {} },
311- {Uuid : "12346" , FsType : "xfs" , Label : "ROOT" , Name : "sda3" , MountPoints : [] string {} },
309+ {Uuid : "1234" , FsType : "xfs" , Label : "ROOT" , Name : "sda1" , MountPoint : "/" },
310+ {Uuid : "12345" , FsType : "xfs" , Label : "ROOT" , Name : "sda2" , MountPoint : "" },
311+ {Uuid : "12346" , FsType : "xfs" , Label : "ROOT" , Name : "sda3" , MountPoint : "" },
312312 // no fs type
313- {Uuid : "12347" , FsType : "" , Label : "ROOT" , Name : "sda4" , MountPoints : [] string {} },
313+ {Uuid : "12347" , FsType : "" , Label : "ROOT" , Name : "sda4" , MountPoint : "" },
314314 },
315315 }
316316 parts , err := block .GetPartitions (true , true )
@@ -327,11 +327,11 @@ func TestGetPartitions(t *testing.T) {
327327 block := BlockDevice {
328328 Name : "sda" ,
329329 Children : []* BlockDevice {
330- {Uuid : "1234" , FsType : "fat32" , Label : "EFI" , Name : "sda1" , MountPoints : [] string {} },
330+ {Uuid : "1234" , FsType : "fat32" , Label : "EFI" , Name : "sda1" , MountPoint : "" },
331331 {
332- Uuid : "12345" , FsType : "lvm2_member" , Label : "LVM" , Name : "sda2" , MountPoints : [] string {} , Children : []* BlockDevice {
333- {Uuid : "lv12346" , FsType : "lvm" , Label : "ROOT" , Name : "rootvg-rootlv" , MountPoints : [] string {} },
334- {Uuid : "lv12347" , FsType : "lvm" , Label : "HOME" , Name : "rootvg-homelv" , MountPoints : [] string {} },
332+ Uuid : "12345" , FsType : "lvm2_member" , Label : "LVM" , Name : "sda2" , MountPoint : "" , Children : []* BlockDevice {
333+ {Uuid : "lv12346" , FsType : "lvm" , Label : "ROOT" , Name : "rootvg-rootlv" , MountPoint : "" },
334+ {Uuid : "lv12347" , FsType : "lvm" , Label : "HOME" , Name : "rootvg-homelv" , MountPoint : "" },
335335 },
336336 },
337337 },
0 commit comments