lib

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoColCount              = 3
	PreOperationColCount    = 17
	OperationColCount       = 17
	ExpectedResultsColCount = 17
	DurationColCount        = 2
	ResultColCount          = 1
	TestedDateColCount      = 3
	TestedByColCount        = 3
)

number of columns to be merged

Variables

This section is empty.

Functions

func Ask_usrinput_int

func Ask_usrinput_int(message_to_show string) (int, error)

func Ask_usrinput_passwd_string

func Ask_usrinput_passwd_string(message_to_show string) string

func Ask_usrinput_string

func Ask_usrinput_string(message_to_show string) string

func CheckSSHforRebootingAfterDelay

func CheckSSHforRebootingAfterDelay(client *ssh.Client, timeAmount int) bool

CheckSSHforRebootingAfterDelay checks if the system is up using SSH connection after waiting for a specified timeAmount.

func ConnectDB

func ConnectDB(user, password, dbname string)

ConnectDB initializes the database connection

func ConnectWithRetry

func ConnectWithRetry(hostIP string, port int, username string, password string, maxRetries int) *ssh.Client

func ConvertParamPostgresToMysql

func ConvertParamPostgresToMysql(query string) string

Converts the parameter in postgresql query to a compatible version for mysql

func DBexec

func DBexec(query DBQuery, args ...interface{}) (sql.Result, error)

ExecuteQuery that changes the state of the database

func DBslect

func DBslect(query DBQuery, args ...interface{}) (*sql.Rows, error)

GetData fetches rows based on a query

func Enable_common_jobnets

func Enable_common_jobnets()

func Formatted_log

func Formatted_log(level int, unfmt string, arg ...any) string

func GenerateExcelFile

func GenerateExcelFile(yamlFiles []string, outputExcel, testerName string) error

func Generate_sshkeys

func Generate_sshkeys(key_filepath string)

func GetSSHClient

func GetSSHClient(hostIP string, port int, username string, password string) (*ssh.Client, error)

This is new function of GetSSHClient that does not exit on error.

func GetSSHClientWithKey

func GetSSHClientWithKey(hostIP string, port int, username string, keyfilepath string) (*ssh.Client, error)

func GetSingleRow

func GetSingleRow(query DBQuery, args []interface{}, dest ...interface{}) error

This function will execute the query that will get exactly one row

func Get_file_trunc

func Get_file_trunc(filepath string, flag int, permission os.FileMode) *os.File

func Get_formatted_time

func Get_formatted_time() string

func Get_host

func Get_host(hosts []common.Host, host_type common.Host_type) (common.Host, error)

Get_host returns found host otherwise returns "no such host" error

func Get_hosts

func Get_hosts(hosts []common.Host, host_types ...common.Host_type) ([]common.Host, error)

Get_host returns found hosts otherwise returns "no such host" error

func Get_hosts_from_jsonfile

func Get_hosts_from_jsonfile(jsonfilepath string)

func Get_log_filepath

func Get_log_filepath() string

func Get_res_no

func Get_res_no(stdout string) (string, error)

func Get_str_str_map

func Get_str_str_map(keysAndValues ...string) (map[string]string, error)

Get_str_str_map_single() gives [string]string map.

func JobProcessDBCountCheck

func JobProcessDBCountCheck(targetProcessCount int, timeoutDuration int, inner_jobnet_main_id string, query DBQuery, args ...interface{}) error

Check count of the query

func Jobarg_enable_jobnet

func Jobarg_enable_jobnet(jobnet_id string, jobnet_name string) error

func Logi

func Logi(level int, unfmt string, arg ...any) string

This function will write log with ticket and testcase numbers. If you call this function outside of testcase function, ticket and testcase numbers will be zero.

func Set_host_pool

func Set_host_pool(jsonfilepath string)

func Set_hosts_to_jsonfile

func Set_hosts_to_jsonfile(hosts *[]common.Host, json_filepath string)

Types

type DBQuery

type DBQuery string
const (
	DeleteRunJobnetQuery     DBQuery = "DELETE FROM ja_run_jobnet_table"
	AbortSingleFWaitJobQuery DBQuery = `` /* 155-byte string literal not displayed */

	CheckJobStatusCountQuery DBQuery = "SELECT count(*) FROM ja_run_job_table where status = 4 and job_type = 4 and inner_jobnet_main_id = $1"
	AbortExtJobQuery         DBQuery = `UPDATE ja_run_jobnet_summary_table SET jobnet_abort_flag = 1 WHERE inner_jobnet_id = ?`
	AbortJobnetQuery         DBQuery = "UPDATE ja_run_jobnet_summary_table SET jobnet_abort_flag = 1 WHERE inner_jobnet_id = $1"
	AbortSingleJOBIconQuery  DBQuery = "UPDATE ja_run_job_table SET method_flag = 3 WHERE inner_jobnet_id = $1"
	CheckJobnetDoneWithRed   DBQuery = "select * from ja_run_jobnet_table where status = 2 or status = 6"
	CheckAllRunCount         DBQuery = `` /* 1202-byte string literal not displayed */

)

Jump to

Keyboard shortcuts

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