package
0.57.0
Repository: https://github.com/grafana/k6.git
Documentation: pkg.go.dev

# Packages

Package consts houses some constants needed across k6.
Package executor defines the executors k6 can use.
Package fsext provides extended file system functions.
Package netext provides extensions to the standard net package.
Package types contains types used in the codebase Most of the types have a Null prefix like gopkg.in/guregu/null.v3 and UnmarshalJSON and MarshalJSON methods.

# Functions

CompatibilityModeString retrieves an enum value from the enum constants string name.
CompatibilityModeValues returns all values of the enum.
ConcatErrors is a a helper function for joining error messages into a single string.
ExecutionStatusString retrieves an enum value from the enum constants string name.
ExecutionStatusValues returns all values of the enum.
GetEndOffset returns the time offset of the last step of the execution plan, and whether that step is a final one, i.e.
GetExecutionState returns an ExecutionState from ctx.
GetFilledExecutionSegmentSequence makes sure we don't have any gaps in the given execution segment sequence, or a nil one.
GetMaxPlannedVUs returns the maximum number of planned VUs at any stage of the execution plan.
GetMaxPossibleVUs returns the maximum number of planned + unplanned (i.e.
GetParsedExecutorConfig returns a struct instance corresponding to the supplied config type.
GetScenarioState returns a ScenarioState from ctx.
NewBufferPool create a new instance of BufferPool using a sync.Pool implementation returning a bytes.NewBuffer for each pooled new element.
NewCheck creates a new check with the given name and parent group.
NewExecutionSegment validates the supplied arguments (basically, that 0 <= from < to <= 1) and either returns an error, or it returns a fully-initialized and usable execution segment.
NewExecutionSegmentFromString validates the supplied string value and returns the newly created ExecutionSegment or and error from it.
NewExecutionSegmentSequence validates the that the supplied execution segments are non-overlapping and without gaps.
NewExecutionSegmentSequenceFromString parses strings of the format "r1,r2,r3,...,rn", which represents the sequences like (r1, r2], (r2, r3], (r3, r4], ..., (r{n-1}, rn].
NewExecutionSegmentSequenceWrapper expects a filled-out execution segment sequence.
NewExecutionState initializes all of the pointers in the ExecutionState with zeros.
NewExecutionTuple returns a new ExecutionTuple for the provided segment and sequence.
NewGroup creates a new group with the given name and parent group.
NewGroupPath ...
NewGroupSummary returns new GroupSummary ready to be started.
NewMultiSlotLimiter initializes and returns a new MultiSlotLimiter with the given slot count TODO: move to lib and use something better than a mutex? sync.Map perhaps?.
NewSegmentedIndex returns a pointer to a new SegmentedIndex instance, given an ExecutionTuple.
NewSlotLimiter initializes and returns a new SlotLimiter with the given slot count.
NewVUStateTags initializes a new VUStateTags and returns it.
NormalizeAndAnonymizePath Normalizes (to use a / path separator) and anonymizes a file path, by scrubbing usernames from home directories.
ParseCIDR creates an IPNet out of a CIDR string.
ReadArchive reads an archive created by Archive.Write from a reader.
RegisterExecutorConfigType adds the supplied ExecutorConfigConstructor as the constructor for its type in the configConstructors map, in a thread-safe manner.
StrictJSONUnmarshal decodes a JSON in a strict manner, emitting an error if there are unknown fields or unexpected data.
ValidateCompatibilityMode checks if the provided val is a valid compatibility mode.
WithExecutionState embeds an ExecutionState in ctx.
WithScenarioState embeds a ScenarioState in ctx.

# Constants

CompatibilityModeBase is standard Sobek, which means pure vanilla JS following ECMAScript standards.
CompatibilityModeExperimentalEnhanced achieves TypeScript and ES6+ compatibility with esbuild.
CompatibilityModeExtended adds `global` as an alias for `globalThis` on top of the base mode.
DefaultScenarioName is used as the default key/ID of the scenario config entries that were created due to the use of the shortcut execution control options (i.e.
Possible execution status values.
Possible execution status values.
Possible execution status values.
Possible execution status values.
Possible execution status values.
Possible execution status values.
Possible execution status values.
Possible execution status values.
Possible execution status values.
Possible execution status values.
Possible execution status values.
GroupSeparator for group IDs.
GroupSummaryDescription is the description of the GroupSummary used to identify and ignore it for the purposes of the cli descriptions.
MaxRetriesGetPlannedVU how many times we should wait for MaxTimeToWaitForPlannedVU before we actually return an error.
MaxTimeToWaitForPlannedVU specifies the maximum allowable time for an executor to wait for a planned VU to be retrieved from the ExecutionState.PlannedVUs buffer.
RootGroupPath is the id of the root group Note(@mstoykov): the constant shouldn't be used in all tests in order to not couple the tests too much with it.

# Variables

DefaultSummaryTrendStats are the default trend columns shown in the test summary output nolint:gochecknoglobals.
ErrNameContainsGroupSeparator is emitted if you attempt to instantiate a Group or Check that contains the separator.
SupportedTLSCipherSuites is string-to-constant map of available TLS cipher suites.
SupportedTLSCipherSuitesToString is constant-to-string map of available TLS cipher suites.
SupportedTLSVersions is string-to-constant map of available TLS versions.
SupportedTLSVersionsToString is constant-to-string map of available TLS versions.

# Structs

An Archive is a rollup of all resources and options needed to reproduce a test identically elsewhere.
BufferPool implements a bytes.Buffer pool using sync.Pool.
A Check stores a series of successful or failing tests against a value.
ExecutionSegment represents a (start, end] partition of the total execution work for a specific test.
ExecutionSegmentSequenceWrapper is a caching layer on top of the execution segment sequence that allows us to make fast and useful calculations, after a somewhat slow initialization.
ExecutionState contains a few different things: - Some convenience items, that are needed by all executors, like the execution segment and the unique VU ID generator.
ExecutionStep is used by different executors to specify the planned number of VUs they will need at a particular time.
ExecutionTuple is the combination of an ExecutionSegmentSequence(Wrapper) and a specific ExecutionSegment from it.
A Group is an organisational block, that samples and checks may be tagged with.
GroupSummary is an internal output implementation that facilitates the aggregation of group and check metrics for the purposes of the end of test summary and the REST API.
IPNet is a wrapper around net.IPNet for JSON unmarshalling.
MultiSlotLimiter can restrict the concurrent execution of different groups of tasks to the given `slots` limit.
Options represent configure options for k6.
RuntimeOptions are settings passed onto the Sobek JS runtime.
ScenarioOptions are options specific to a scenario.
ScenarioState holds runtime scenario information returned by the k6/execution JS module.
SegmentedIndex is an iterator that returns both the scaled and the unscaled sequential values according to the given ExecutionTuple.
StageFields defines the fields used for a Stage; this is a dumb hack to make the JSON code cleaner.
State provides the volatile state for a VU.
Summary contains all of the data the summary handler gets.
TestPreInitState contains all of the state that can be gathered and built before the test run is initialized.
TestRunState contains the pre-init state as well as all of the state and options that are necessary for actually running the test.
TLSAuth defines a TLS client certificate to present to certain hosts.
TLSAuthFields for TLSAuth.
UIState describes the state of the UI, which might influence what handleSummary() returns.
VUActivationParams are supplied by each executor when it retrieves a VU from the buffer pool and activates it for use.
VUStateTags wraps the current VU's tags and ensures a thread-safe way to access and modify them exists.

# Interfaces

ActiveVU represents an actively running virtual user.
DialContexter is an interface that can dial with a context.
Executor is the interface all executors should implement.
ExecutorConfig is an interface that should be implemented by all executor config types nolint:interfacebloat // We don't have plan to split it.
InitializedVU represents a virtual user ready for work.
LiveUpdatableExecutor should be implemented for the executors whose configuration can be modified in the middle of the test execution.
PausableExecutor should be implemented by the executors that can be paused and resumed in the middle of the test execution.
A Runner is a factory for VUs.
TracerProvider provides methods for OTEL tracers initialization.

# Type aliases

CompatibilityMode specifies the JS compatibility mode go:generate enumer -type=CompatibilityMode -transform=snake -trimprefix CompatibilityMode -output compatibility_mode_gen.go.
ExecutionSegmentSequence represents an ordered chain of execution segments, where the end of one segment is the beginning of the next.
ExecutionStatus is used to mark the possible states of a test run at any given time in its execution, from its start to its finish.
ExecutorConfigConstructor is a simple function that returns a concrete Config instance with the specified name and all default values correctly initialized.
InitVUFunc is just a shorthand so we don't have to type the function signature every time.
ScenarioConfigs can contain mixed executor config types.
A Stage defines a step in a test's timeline.
TLSCipherSuites represents a list of TLS cipher suites.
TLSVersion describes a TLS version.
TLSVersions describes a set (min/max) of TLS versions.