regression

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DescribeRegression

func DescribeRegression(text string, body func(*TestContext)) bool

DescribeRegression must be used instead of the usual Ginkgo Describe to register a test block. The difference is that the body function will be called multiple times with the right context (when setting up a Ginkgo suite or a testing.T test, with the right configuration).

func ShowSnapshots

func ShowSnapshots(logger logr.Logger, snapshots []common.SnapshotObject)

ShowSnapshots: Display useful information for snapshot objects

func ShowVolumes

func ShowVolumes(logger logr.Logger, volumes []common.VolumeObject)

ShowVolumes: Display useful data from volume objects

func Test

func Test(t GinkgoTestingT, config *TestConfig, logger logr.Logger)

Test will test the application at the specified address by setting up a Ginkgo suite and running it.

Types

type ConfigurationYaml

type ConfigurationYaml struct {
	Ip        string   `yaml:"ip"`        // The IP Address in dot notation of the storage controller, for example 10.1.2.3
	Protocol  string   `yaml:"protocol"`  // The IP protocol to use, such as http or https
	Username  string   `yaml:"username"`  // The username used to log into the storage controller
	Password  string   `yaml:"password"`  // The password used to log into the storage controller
	Initiator []string `yaml:"initiator"` // The initiator IGN value to use for iSCSI regression testing
	Pool      string   `yaml:"pool"`      // The storage pool (A or B) to use for testing
}

ConfigurationYaml provides configuration credentials for a specific storage controller.

func ReadConfigurationYaml

func ReadConfigurationYaml(filename string) (*ConfigurationYaml, error)

ReadConfigurationYaml: Read configuration file and return Go struct

type TestConfig

type TestConfig struct {
	StorageController ConfigurationYaml // The storage controller credentials
	Ctx               context.Context   // The cfm-regression context
}

TestConfig provides the configuration for the regression tests. It must be constructed with NewTestConfig to initialize it with sane defaults. The user of the regression package can then override values before passing the instance to [Ginkgo]Test and/or (when using GinkgoTest) in a BeforeEach.

func NewTestConfig

func NewTestConfig(filename string) (*TestConfig, error)

NewTestConfig returns a config instance with all values set to values read from a config file.

type TestContext

type TestContext struct {
	Config *TestConfig
}

TestContext gets initialized by the regression package before each test runs. It holds the variables that each test can depend on.

func GinkgoTest

func GinkgoTest(config *TestConfig) *TestContext

GinkoTest is another entry point for regression testing: instead of directly running tests like Test does, it merely registers the tests. This can be used to embed regression testing in a custom Ginkgo test suite. The pointer to the configuration is merely stored by GinkgoTest for use when the tests run. Therefore its content can still be modified in a BeforeEach. The regression package itself treats it as read-only.

func NewTestContext

func NewTestContext(config *TestConfig) *TestContext

NewContext sets up regression testing with a config supplied by the user of the regression package. Ownership of that config is shared between the regression package and the caller.

func (*TestContext) Finalize

func (sc *TestContext) Finalize()

Finalize frees any resources that might be still cached in the context. It should be called after running all tests.

func (*TestContext) Setup

func (sc *TestContext) Setup()

Setup must be invoked before each test. It initialize per-test variables in the context.

func (*TestContext) Teardown

func (sc *TestContext) Teardown()

Teardown must be called after each test. It frees resources allocated by Setup.

Jump to

Keyboard shortcuts

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