github.com/insomniacslk/u-root@v0.0.0-20200717035308-96b791510d76/pkg/mount/block/blockdev_test.go (about) 1 // Copyright 2017-2019 the u-root Authors. All rights reserved 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package block 6 7 import ( 8 "testing" 9 10 "github.com/stretchr/testify/require" 11 ) 12 13 // TestFindMountPointNotExists checks that non existent 14 // entry is checked and nil returned 15 func TestFindMountPointNotExists(t *testing.T) { 16 LinuxMountsPath = "testdata/mounts" 17 _, err := GetMountpointByDevice("/dev/mapper/sys-oldxxxxxx") 18 require.Error(t, err) 19 } 20 21 // TestFindMountPointValid check for valid output of 22 // test mountpoint. 23 func TestFindMountPointValid(t *testing.T) { 24 LinuxMountsPath = "testdata/mounts" 25 mountpoint, err := GetMountpointByDevice("/dev/mapper/sys-old") 26 require.NoError(t, err) 27 require.Equal(t, *mountpoint, "/media/usb") 28 }