framework

package
v0.0.0-...-1624042 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RetryCount is the amount of times we will retry an api operation
	RetryCount = 20
	// RetryInterval is the interval of time until we retry after a failure
	RetryInterval = 5 * time.Second
	// WindowsLabel represents the node label that need to be applied to the Windows node created
	WindowsLabel = "node.openshift.io/os_id=Windows"

	// PrivateKeyPath contains the path to the private key which is used to access the VMs. This would have been mounted
	// as a secret by user
	PrivateKeyPath = "/etc/private-key/private-key.pem"
	// AWSCredentialsPath contains the path to the AWS credentials to interact with AWS cloud provider.
	AWSCredentialsPath = "/etc/aws-creds/credentials"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type TestFramework

type TestFramework struct {
	// WinVms contains the Windows VMs that are created to execute the test suite
	WinVMs []TestWindowsVM
	// k8sclientset is the kubernetes clientset we will use to query the cluster's status
	K8sclientset *kubernetes.Clientset
	// OSConfigClient is the OpenShift config client, we will use to query the OpenShift api object status
	OSConfigClient *configclient.Clientset
	// OSOperatorClient is the OpenShift operator client, we will use to interact with OpenShift operator objects
	OSOperatorClient *operatorv1.OperatorV1Client

	// ClusterVersion is the major.minor.patch version of the OpenShift cluster
	ClusterVersion string

	// K8sVersion is the current version of Kuberenetes
	K8sVersion string
	// clusterAddress is the address of the OpenShift cluster e.g. "foo.fah.com".
	// This should not include "https://api-" or a port.
	ClusterAddress string
	// Signer is a signer created from the user's private key
	Signer ssh.Signer
	// contains filtered or unexported fields
}

TestFramework holds the info to run the test suite.

func (*TestFramework) DestroyMachineSet

func (f *TestFramework) DestroyMachineSet() error

DestroyMachineSet() deletes the MachineSet which in turn deletes all the Machines created by the MachineSet

func (*TestFramework) GetClusterVersion

func (f *TestFramework) GetClusterVersion() error

GetClusterVersion gets the OpenShift cluster version in major.minor format. This is being done this way, and not with oc get clusterversion, as OpenShift CI doesn't have the actual version attached to its clusters, instead replacing it with 0.0.1 and information about the release creation date

func (*TestFramework) GetLatestWMCBRelease

func (f *TestFramework) GetLatestWMCBRelease() error

GetLatestWMCBRelease gets the latest github release for the WMCB repo. This release is specific to the cluster version

func (*TestFramework) GetNode

func (f *TestFramework) GetNode(internalIP string) (*v1.Node, error)

GetNode returns a pointer to the node object associated with the internal IP provided

func (*TestFramework) GetNodeName

func (f *TestFramework) GetNodeName(internalIP string) (string, error)

GetNode uses internal IP and finds out the name associated with the node

func (*TestFramework) GetReleaseArtifactSHA

func (f *TestFramework) GetReleaseArtifactSHA(artifactName string) (string, error)

GetReleaseArtifactSHA returns the SHA256 of the release artifact specified, given the body of the release

func (*TestFramework) GetReleaseArtifactURL

func (f *TestFramework) GetReleaseArtifactURL(artifactName string) (string, error)

GetLatestReleaseArtifactURL returns the URL of the releases artifact matching the given name

func (*TestFramework) RetrieveArtifacts

func (f *TestFramework) RetrieveArtifacts()

RetrieveArtifacts should retrieve artifacts related the test run. Ideally this should retrieve all the logs related to the Windows VM. This shouldn't return an error but should print the failures as log collection is nice to have rather than a must have. TODO: Think about how we can retrieve stdout from ansible out within this function

func (*TestFramework) Setup

func (f *TestFramework) Setup(vmCount int, skipVMSetup bool) error

Setup creates and initializes a variable amount of Windows VMs. If the array of credentials are passed then it will be used in lieu of creating new VMs. If skipVMsetup is true then it will result in the VM setup not being run. These two options are mainly used during test development.

func (*TestFramework) TearDown

func (f *TestFramework) TearDown()

TearDown destroys the resources created by the Setup function

func (*TestFramework) WriteToArtifactDir

func (f *TestFramework) WriteToArtifactDir(contents []byte, subDirName, filename string) error

WriteToArtifactDir will write contents to $ARTIFACT_DIR/subDirName/filename. If subDirName is empty, contents will be written to $ARTIFACT_DIR/filename

type TestWindowsVM

type TestWindowsVM interface {
	// RetrieveDirectories recursively copies the files and directories from the directory in the remote Windows VM
	// to the given directory on the local host.
	RetrieveDirectories(string, string) error
	// Compose the Windows VM we have from MachineSets
	windows.WindowsVM
}

TestWindowsVM is the interface for interacting with a Windows VM in the test framework. This will hold the specialized information related to test suite

Jump to

Keyboard shortcuts

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