utils

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KubeConfigEnv Environmental Variable
	KubeConfigEnv = "KUBECONFIG"

	XML          = ".xml"                                                       // XML is an extension for .xml
	IgnoreFile   = "pkg/utils/ignore.yaml"                                      // IgnoreFile contains the tests to be skipped
	BinaryPrefix = "https://storage.googleapis.com/kubernetes-release/release/" // BinaryPrefix Binary url prefix
	BinarySuffix = "/kubernetes-test-linux-amd64.tar.gz"                        // BinarySuffix  binary url suffix
	BinaryFile   = "kubernetes-test-linux-amd64.tar.gz"                         // BinaryFile downloaded binary file
)

Constants to support e2e tests

View Source
const (
	// LoggerContextKey logger
	LoggerContextKey loggerKey = "logger"
)

Variables

View Source
var (

	// Home home environmental variable
	Home = os.Getenv("HOME")
)

Functions

func BuildE2eCommand

func BuildE2eCommand(ctx *cli.Context) ([]string, error)

BuildE2eCommand will build the command args

func CheckIfBinaryExists

func CheckIfBinaryExists(version string) bool

CheckIfBinaryExists will check the existing binary version and return true if version match else return false

func CheckKubeConfigEnv

func CheckKubeConfigEnv() string

CheckKubeConfigEnv will check the environment variable KUBECONFIG and returns default KUBECONFIG if not set

func DownloadBinary

func DownloadBinary(version string) error

DownloadBinary will download the binary from the kubernetes artifactory based the version

func E2eReportParser

func E2eReportParser(filename string) ([]map[string]string, error)

E2eReportParser will parse the kubernetes end-to-end report.

func ExecuteE2ECommand

func ExecuteE2ECommand(args []string, ch chan os.Signal) error

ExecuteE2ECommand will execute the ./e2e.test command and generates the reports

func FileExists

func FileExists(filename string) bool

FileExists will check the file existence and return true if it exists otherwise return false

func GenerateReport

func GenerateReport(report string)

GenerateReport will call parser function and generates the report

func GetLoggerFromContext

func GetLoggerFromContext(ctx context.Context) *logrus.Entry

GetLoggerFromContext returns logger

func GetURL

func GetURL(version string) (string, error)

GetURL will return the URL by including the given version

func Prechecks

func Prechecks(c *cli.Context) bool

Prechecks function will check some prechecks like driver config file existence

func Prerequisites

func Prerequisites(version string) error

Prerequisites function will full-fill all prerequisites

func ReadTestDriverConfig

func ReadTestDriverConfig(driverconfig string) string

ReadTestDriverConfig will read the driver config

func SkipTests

func SkipTests(skipFile string) (string, error)

SkipTests will skip the tests mentioned in the ignore.yaml

func UnTarBinary

func UnTarBinary() error

UnTarBinary will untar the kubernetes tar.gz file to get the e2e binaries

Types

type DriverConfig

type DriverConfig struct {
	StorageClass struct {
		Class string `yaml:"FromExistingClassName"`
	} `yaml:"StorageClass"`
}

DriverConfig is used to get the storage-class name

type ExtendedDuration

type ExtendedDuration struct {
	Weeks   int
	Days    int
	Hours   int
	Minutes int
	Seconds int
}

ExtendedDuration in weeks, days, hours, minutes and seconds

func ParseDuration

func ParseDuration(str string) (*ExtendedDuration, error)

ParseDuration parse duration string and returns ExtendedDuration struct

func (ExtendedDuration) Duration

func (s ExtendedDuration) Duration() time.Duration

Duration returns time duration

type Testcase

type Testcase struct {
	XMLName xml.Name `xml:"testcase"`
	Name    string   `xml:"name,attr"`
	Status  string   `xml:"status,attr"`
}

Testcase is an individual testcase in the end-to-end report

type Testsuite

type Testsuite struct {
	XMLName xml.Name `xml:"testsuite"`
	// Properties []Property `xml:"properties"`
	Name      string     `xml:"name,attr"`
	Tests     string     `xml:"tests,attr"`
	Skipped   string     `xml:"skipped,attr"`
	Errors    string     `xml:"errors,attr"`
	Failures  string     `xml:"failures,attr"`
	Testcases []Testcase `xml:"testcase"`
}

Testsuite contain all the information about the tests

type Testsuites

type Testsuites struct {
	XMLName    xml.Name    `xml:"testsuites"`
	Testsuites []Testsuite `xml:"testsuite"`
}

Testsuites contains list of testsuites

Jump to

Keyboard shortcuts

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