@@ -59,27 +59,30 @@ type localTestConfig struct {
59
59
type localVolumeType string
60
60
61
61
const (
62
- // default local volume type, aka a directory
62
+ // DirectoryLocalVolumeType is the default local volume type, aka a directory
63
63
DirectoryLocalVolumeType localVolumeType = "dir"
64
- // like DirectoryLocalVolumeType but it's a symbolic link to directory
64
+ // DirectoryLinkLocalVolumeType is like DirectoryLocalVolumeType,
65
+ // but it's a symbolic link to directory
65
66
DirectoryLinkLocalVolumeType localVolumeType = "dir-link"
66
- // like DirectoryLocalVolumeType but bind mounted
67
+ // DirectoryBindMountedLocalVolumeType is like DirectoryLocalVolumeType
68
+ // but bind mounted
67
69
DirectoryBindMountedLocalVolumeType localVolumeType = "dir-bindmounted"
68
- // like DirectoryLocalVolumeType but it's a symbolic link to self bind mounted directory
70
+ // DirectoryLinkBindMountedLocalVolumeType is like DirectoryLocalVolumeType,
71
+ // but it's a symbolic link to self bind mounted directory
69
72
// Note that bind mounting at symbolic link actually mounts at directory it
70
73
// links to.
71
74
DirectoryLinkBindMountedLocalVolumeType localVolumeType = "dir-link-bindmounted"
72
- // creates a tmpfs and mounts it
75
+ // TmpfsLocalVolumeType creates a tmpfs and mounts it
73
76
TmpfsLocalVolumeType localVolumeType = "tmpfs"
74
- // tests based on local ssd at /mnt/disks/by-uuid/
77
+ // GCELocalSSDVolumeType tests based on local ssd at /mnt/disks/by-uuid/
75
78
GCELocalSSDVolumeType localVolumeType = "gce-localssd-scsi-fs"
76
- // Creates a local file, formats it, and maps it as a block device.
79
+ // BlockLocalVolumeType creates a local file, formats it, and maps it as a block device.
77
80
BlockLocalVolumeType localVolumeType = "block"
78
- // Creates a local file serving as the backing for block device., formats it ,
79
- // and mounts it to use as FS mode local volume.
81
+ // BlockFsWithFormatLocalVolumeType creates a local file serving as the backing for block device,
82
+ // formats it, and mounts it to use as FS mode local volume.
80
83
BlockFsWithFormatLocalVolumeType localVolumeType = "blockfswithformat"
81
- // Creates a local file serving as the backing for block device. do not format it manually ,
82
- // and mounts it to use as FS mode local volume.
84
+ // BlockFsWithoutFormatLocalVolumeType creates a local file serving as the backing for block device,
85
+ // does not format it manually, and mounts it to use as FS mode local volume.
83
86
BlockFsWithoutFormatLocalVolumeType localVolumeType = "blockfswithoutformat"
84
87
)
85
88
@@ -1003,21 +1006,19 @@ func createWriteCmd(testDir string, testFile string, writeTestFileContent string
1003
1006
// Cleanup the file containing testFileContent.
1004
1007
deleteTestFileCmd := fmt .Sprintf ("rm %s" , testFilePath )
1005
1008
return fmt .Sprintf ("%s && %s && %s && %s" , writeTestFileCmd , sudoCmd , writeBlockCmd , deleteTestFileCmd )
1006
- } else {
1007
- testFilePath := filepath .Join (testDir , testFile )
1008
- return fmt .Sprintf ("mkdir -p %s; echo %s > %s" , testDir , writeTestFileContent , testFilePath )
1009
1009
}
1010
+ testFilePath := filepath .Join (testDir , testFile )
1011
+ return fmt .Sprintf ("mkdir -p %s; echo %s > %s" , testDir , writeTestFileContent , testFilePath )
1010
1012
}
1011
1013
1012
1014
func createReadCmd (testFileDir string , testFile string , volumeType localVolumeType ) string {
1013
1015
if volumeType == BlockLocalVolumeType {
1014
1016
// Create the command to read the beginning of the block device and print it in ascii.
1015
1017
return fmt .Sprintf ("hexdump -n 100 -e '100 \" %%_p\" ' %s | head -1" , testFileDir )
1016
- } else {
1017
- // Create the command to read (aka cat) a file.
1018
- testFilePath := filepath .Join (testFileDir , testFile )
1019
- return fmt .Sprintf ("cat %s" , testFilePath )
1020
1018
}
1019
+ // Create the command to read (aka cat) a file.
1020
+ testFilePath := filepath .Join (testFileDir , testFile )
1021
+ return fmt .Sprintf ("cat %s" , testFilePath )
1021
1022
}
1022
1023
1023
1024
// Read testFile and evaluate whether it contains the testFileContent
0 commit comments