tests

package
v1.20.6 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

README

Writing new tests

These tests should be ignored by regular go test ./.... This is achieved by a build constraints.

The test must have a // +build e2e tag at the top to make sure they aren't executed via CI or a regular go test ./... run.

The command line options must contain --organization-id=1234 because otherwise the parallel nature of these tests might step on each other. You could get an error like, you are a member of 2 or more organizations...

Running the tests

NOTE: Make sure the oasisctl binary exists before running the tests.

To run all tests execute the following:

go test ./... -tags=e2c

To run a specific test, cd into the folder you wish to run tests for and execute for example:

go test -run=TestCreateCertificate -tags=e2c

Constraints

The following assumptions are based on the system:

  • There is a user with an organization and a project.
  • The project has a Default Certificate. The certificate will not be deleted.

The tests are designed so that they can be run in parallel which is the default of go test.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareOutput

func CompareOutput(output []byte, regex []byte) bool

CompareOutput regex compare the result with the output so keys like .*, can be used to check random ids, or timestamps or values which should match something but there is no possible way to define what that something will be.

func GetDefaultOrganization

func GetDefaultOrganization() (string, error)

GetDefaultOrganization returns the first organization for the user to work with.

func GetDefaultProject

func GetDefaultProject(org string) (string, error)

GetDefaultProject returns the first project for the user to work with.

func GetResourceID

func GetResourceID(out string) (string, error)

GetResourceID takes a `create` call output and greps for the resource's ID.

func RunCommand

func RunCommand(args []string) ([]byte, error)

RunCommand finds the oasisctl binary and executes it with the given arguments.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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