utils

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColumnToLetter added in v0.3.0

func ColumnToLetter(col int) string

Helper function to convert column index to Excel column letter

func ConvertVMDKtoQCOW2

func ConvertVMDKtoQCOW2(src string, dst string) error

ConvertVMDKtoQCOW2 converts a VMDK file to QCOW2 using qemu-img

func CreateExcelOnlyWithVInfo added in v0.3.0

func CreateExcelOnlyWithVInfo() ([]byte, error)

func CreateLargeExcel added in v0.3.0

func CreateLargeExcel() ([]byte, error)

func CreateTempExcelFile added in v0.3.0

func CreateTempExcelFile(content []byte) (string, error)

Helper function to create a temporary Excel file for testing

func CreateValidTestExcel added in v0.3.0

func CreateValidTestExcel() ([]byte, error)

func DefaultUserAuth

func DefaultUserAuth() *auth.User

DefaultUserAuth returns an auth.User object with the default username and organization.

func GetToken

func GetToken(credentials *auth.User) (string, error)

GetToken retrieves the private key from the specified path, parses it, and then generates a token for the given credentials using the private key. Returns the token or an error.

func LogExecutionSummary

func LogExecutionSummary()

LogExecutionSummary logs the execution time of all tests stored in the TestsExecutionTime map. It sorts the tests by duration in descending order and logs the test name along with its execution duration.

func RemoveFile

func RemoveFile(fullPath string) error

RemoveFile Remove OS file if exist

func RunLocalCommand

func RunLocalCommand(command string) (string, error)

RunLocalCommand runs the given shell command locally and returns its combined output or error

func RunSSHCommand

func RunSSHCommand(ip string, command string) (string, error)

RunSSHCommand executes a command on a remote machine over SSH using sshpass for authentication. It takes an IP address and a command string as parameters, runs the command on the remote machine, and returns the command's output (stdout) as a string, or an error if the command fails.

func Untar

func Untar(file *os.File, destFile string, fileName string) error

Untar extracts a specific file (identified by 'fileName') from a tar file and writes it to the 'destFile' path. If the specified file is found, it is extracted and written; otherwise, an error is returned indicating that the file was not found in the tar archive.

func UserAuth

func UserAuth(user string, org string, emailDomain string) *auth.User

UserAuth returns an auth.User object with the provided username and organization.

func ValidateTar

func ValidateTar(file *os.File) error

ValidateTar validates a tar file by checking if it contains at least one file with the following suffixes: .ovf, .vmdk, and .iso. It also performs basic validation on the .ovf file to ensure it contains essential elements like <Envelope> and <VirtualSystem>. Returns an error if any of these conditions are not met

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL