Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func If ¶
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")