testhelpers

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BoolSchema = `{
		"type": "boolean"
	}`

BoolSchema schema

View Source
var NonNegativeInteger = `{
	"type": ["integer", "string"],
	"pattern": "^[0-9]*$", "minimum": 0
}`

NonNegativeInteger schema

View Source
var PositiveInteger = `{
	"type": ["integer", "string"],
	"pattern": "^[0-9]*$", "minimum": 1
}`

PositiveInteger schema

Functions

func AssembleRequest

func AssembleRequest(processes []*os.Process, coreIds []string, maxCache, minCache int, mbaPercentage int, policy string) map[string]interface{}

AssembleRequest assemble the request body by given process id and max, min cache or policy

func CleanupProcess

func CleanupProcess(p *os.Process)

CleanupProcess To kill process

func CleanupProcesses

func CleanupProcesses(ps []*os.Process)

CleanupProcesses To kill processes

func ConfigInit

func ConfigInit(path string) error

ConfigInit initializes config

func CreateNewProcess

func CreateNewProcess(cmd string) (*os.Process, error)

CreateNewProcess Create a new background running process by command string e.g. CreateNewprocess("sleep 1000")

func CreateNewProcesses

func CreateNewProcesses(cmd string, number int) ([]*os.Process, error)

CreateNewProcesses To create some processes

func FormatByKey

func FormatByKey(f string, m map[string]interface{}) (string, error)

FormatByKey usage:

      m := map[string]interface{}{"name": "John", "age": 47}
      s := "Hi {{.name}}. Your age is {{.age}}\n"
		 result, err := FormatByKey(s, m)

use go native template. If you do not like go template, you can use mustache

import "github.com/hoisie/mustache"
m := map[string]interface{}{"name": "John", "age": 47}
s := "Hi {{name}}. Your age is {{age}}\n"
result := mustache.Render("hello {{c}}, {{age}}", m)

func GetClientAuthType

func GetClientAuthType() string

GetClientAuthType getter for client auth type

func GetConfigAddr

func GetConfigAddr() string

GetConfigAddr getter for address

func GetConfigDebugPort

func GetConfigDebugPort() int

GetConfigDebugPort getter for Debug port

func GetConfigOption

func GetConfigOption(key string, rawVal interface{}) error

GetConfigOption is just simple wraper for config UnmarshalKey

func GetConfigOptions

func GetConfigOptions(rawVal interface{}) error

GetConfigOptions is just simple wraper for config Unmarshal

func GetConfigTLSPort

func GetConfigTLSPort() int

GetConfigTLSPort getter for TLS port

func GetHTTPSV1URL

func GetHTTPSV1URL() string

GetHTTPSV1URL getter for HTTPSV1URL

func GetHTTPV1URL

func GetHTTPV1URL() string

GetHTTPV1URL getter for HTTPV1URL

func GetPolicyPath

func GetPolicyPath() string

GetPolicyPath getter for path with policy

Types

This section is empty.

Jump to

Keyboard shortcuts

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