skip

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func If

func If(t *testing.T, conditions string)

If can be used to skip a test case based on comma-separated conditions. There are two kinds of conditions, comparisons and booleans.

Comparison conditions

Comparison conditions are in the following format:

KEY OP [VERSION|STRING]

KEY is one of the following keys:

hz: Hazelcast version
ver: Go Client version
os: Operating system name, taken from runtime.GOOS
arch: Operating system architecture, taken from runtime.GOARCH

hz and ver keys support the following operators:

<, <=, =, !=, >=, >, ~=

os and arch key support the following operators:

=, !=

VERSION has the following format:

Major[.Minor[.Patch[...]]][-SUFFIX]

Tilde (~) operator uses the version in the right operand to set the precision, that is the number of version components to compare. If the precision of the left operand is less than the right, then the missing version components on the left operand is set to zero. Suffixes are not used in the comparison.

The following conditions are evaluated to true:

(assuming hz == 5.1.2)
hz ~ 5
hz ~ 5.1
hz ~ 5.1.2
hz ~ 5.1.2-SNAPSHOT

(assuming hz == 5.1-SNAPSHOT)
hz ~ 5
hz ~ 5.1
hz ~ 5.1.0
hz ~ 5.1.0-SNAPSHOT

The following conditions are evaluated to false:

(assuming hz == 5.1.2)
hz ~ 6
hz ~ 5.2
hz ~ 5.1.3
hz ~ 5.1.3-SNAPSHOT

(assuming hz == 5.1-SNAPSHOT)
hz ~ 6
hz ~ 5.2
hz ~ 5.1.1

For other comparison operators, if minor, patch, etc. are not given, they are assumed to be 0. A version with a suffix is less than a version without suffix, if their Major, Minor, Patch, ... are the same.

The following conditions are evaluated to true:

(assuming hz == 5.1.2)
hz > 5
hz > 5.1
hz = 5.1.2
hz < 5.1.2-SNAPSHOT

(assuming hz == 5.1-SNAPSHOT)
hz > 5
hz < 5.1
hz < 5.1.0
hz = 5.1.0-SNAPSHOT

The following conditions are evaluated to false:

(assuming hz == 5.1.2)
hz = 5
hz = 5.1
hz > 5.1.2

(assuming hz == 5.1-SNAPSHOT)
hz = 5
hz = 5.1
hz = 5.1.0

Boolean conditions

Boolean conditions are in the following format:

[!]KEY

KEY is one of the following keys:

enterprise: Whether the Hazelcast cluster is enterprise
			(existence of HAZELCAST_ENTERPRISE_KEY environment variable)
oss: Whether the Hazelcast cluster is open source
	 (non-existence of HAZELCAST_ENTERPRISE_KEY environment variable)
race: existence of RACE_ENABLED environment variable with value "1"
ssl: existence of ENABLE_SSL environment variable with value "1"
slow: existence of SLOW_ENABLED environment variable with value "1"
flaky: existence of FLAKY_ENABLED environment variable with value "1"

! operator negates the value of the key.

Many Conditions

More than one condition may be specified by separating them with commas. All conditions should be satisfied to skip.

skip.If(t, "ver > 1.1, hz = 5, os != windows, !enterprise")

You can use multiple skip.If statements to skip when one of the conditions is satisfied:

// skip if the OS is windows or client version is greater than 1.3.2 and the Hazelcast cluster is open source:
skip.If(t, "os = windows")
skip.If(t, "ver > 1.3.2, oss")

func IfNot

func IfNot(t *testing.T, conditions string)

IfNot can be used to skip a test case if the list of comma-separated conditions does not hold. It is the reverse of skip.If. See the documentation about skip.If.

Types

type Checker

type Checker struct {
	HzVer      string
	Ver        string
	OS         string
	Arch       string
	Enterprise bool
	Race       bool
	SSL        bool
	Slow       bool
	Flaky      bool
	All        bool
}

func (Checker) CanSkip

func (s Checker) CanSkip(condStr string) bool

CanSkip skips returns true if all the given conditions evaluate to true. Separate conditions with commas (,).

Jump to

Keyboard shortcuts

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