Documentation
¶
Overview ¶
Package linux provides utilities for preforming tasks on linux components.
Index ¶
- func CurlURL(ctx context.Context, run components.Runner, timeout time.Duration, ...) (curlOutput string, HTTPErrorResponseCode int, err error)
- func IsPathExist(ctx context.Context, run components.Runner, path string) error
- func IsPathWritable(ctx context.Context, run components.Runner, testDir string) error
- func MountDrive(ctx context.Context, run components.Runner, mountPath, srcPath string) error
- func PathHasEnoughValue(ctx context.Context, r components.Runner, dutName string, path string, ...) error
- func PathOccupiedSpacePercentage(ctx context.Context, r components.Runner, path string) (float64, error)
- func StorageUtilizationReportOfFilesInDir(ctx context.Context, runner components.Runner, dirPath string) (string, error)
- func UnmountDrive(ctx context.Context, run components.Runner, mountPath string) error
- type SpaceType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurlURL ¶
func CurlURL(ctx context.Context, run components.Runner, timeout time.Duration, downloadURL string, headers map[string]string, extraCurlArgs ...string) (curlOutput string, HTTPErrorResponseCode int, err error)
CurlURL runs the curl command with the provided downloadURL, headers, and extraCurlArgs. Returns the output of the curl command.
If the curl command returns a non-nil error, the HTTP response code (parsed from the error) and the command error is returned along with the output of curl.
func IsPathExist ¶
IsPathExist checks if a given path exists or not. Raise error if the path does not exist.
func IsPathWritable ¶
IsPathWritable checks whether a given path is writable.
func MountDrive ¶
MountDrive mounts an external drive on host.
func PathHasEnoughValue ¶
func PathHasEnoughValue(ctx context.Context, r components.Runner, dutName string, path string, typeOfSpace SpaceType, minSpaceNeeded float64) error
PathHasEnoughValue is a helper function that checks the given path's free disk space / inodes is no less than the min disk space /indoes specified.
func PathOccupiedSpacePercentage ¶
func PathOccupiedSpacePercentage(ctx context.Context, r components.Runner, path string) (float64, error)
PathOccupiedSpacePercentage will find the percentage indicating the occupied space under the specified path.
func StorageUtilizationReportOfFilesInDir ¶
func StorageUtilizationReportOfFilesInDir(ctx context.Context, runner components.Runner, dirPath string) (string, error)
StorageUtilizationReportOfFilesInDir generates a CSV report of files present in the provided directory and returns it as a string.
func UnmountDrive ¶
UnmountDrive unmounts a drive from host.