Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveVU

type ActiveVU struct {
	*VU
	*lib.VUActivationParams
	// contains filtered or unexported fields
}

    ActiveVU holds a VU and its activation parameters

    func (*ActiveVU) RunOnce

    func (u *ActiveVU) RunOnce() error

      RunOnce runs the configured Exec function once.

      type Bundle

      type Bundle struct {
      	Filename *url.URL
      	Source   string
      	Program  *goja.Program
      	Options  lib.Options
      
      	BaseInitContext *InitContext
      
      	RuntimeOptions    lib.RuntimeOptions
      	CompatibilityMode lib.CompatibilityMode // parsed value
      	// contains filtered or unexported fields
      }

        A Bundle is a self-contained bundle of scripts and resources. You can use this to produce identical BundleInstance objects.

        func NewBundle

        func NewBundle(
        	logger logrus.FieldLogger, src *loader.SourceData, filesystems map[string]afero.Fs, rtOpts lib.RuntimeOptions,
        ) (*Bundle, error)

          NewBundle creates a new bundle from a source file and a filesystem.

          func NewBundleFromArchive

          func NewBundleFromArchive(logger logrus.FieldLogger, arc *lib.Archive, rtOpts lib.RuntimeOptions) (*Bundle, error)

            NewBundleFromArchive creates a new bundle from an lib.Archive.

            func (*Bundle) Instantiate

            func (b *Bundle) Instantiate(logger logrus.FieldLogger, vuID int64) (bi *BundleInstance, instErr error)

              Instantiate creates a new runtime from this bundle.

              type BundleInstance

              type BundleInstance struct {
              	Runtime *goja.Runtime
              	Context *context.Context
              	// contains filtered or unexported fields
              }

                A BundleInstance is a self-contained instance of a Bundle.

                type InitContext

                type InitContext struct {
                	// contains filtered or unexported fields
                }

                  InitContext provides APIs for use in the init context.

                  TODO: refactor most/all of this state away, use common.InitEnvironment instead

                  func NewInitContext

                  func NewInitContext(
                  	logger logrus.FieldLogger, rt *goja.Runtime, c *compiler.Compiler, compatMode lib.CompatibilityMode,
                  	ctxPtr *context.Context, filesystems map[string]afero.Fs, pwd *url.URL,
                  ) *InitContext

                    NewInitContext creates a new initcontext with the provided arguments

                    func (*InitContext) Open

                    func (i *InitContext) Open(ctx context.Context, filename string, args ...string) (goja.Value, error)

                      Open implements open() in the init context and will read and return the contents of a file. If the second argument is "b" it returns the data as a binary array, otherwise as a string.

                      func (*InitContext) Require

                      func (i *InitContext) Require(arg string) goja.Value

                        Require is called when a module/file needs to be loaded by a script

                        type Runner

                        type Runner struct {
                        	Bundle *Bundle
                        	Logger *logrus.Logger
                        
                        	BaseDialer net.Dialer
                        	Resolver   netext.Resolver
                        	// TODO: Remove ActualResolver, it's a hack to simplify mocking in tests.
                        	ActualResolver netext.MultiResolver
                        	RPSLimit       *rate.Limiter
                        	// contains filtered or unexported fields
                        }

                        func New

                        func New(
                        	logger *logrus.Logger, src *loader.SourceData, filesystems map[string]afero.Fs, rtOpts lib.RuntimeOptions,
                        ) (*Runner, error)

                          New returns a new Runner for the provide source

                          func NewFromArchive

                          func NewFromArchive(logger *logrus.Logger, arc *lib.Archive, rtOpts lib.RuntimeOptions) (*Runner, error)

                            NewFromArchive returns a new Runner from the source in the provided archive

                            func (*Runner) GetDefaultGroup

                            func (r *Runner) GetDefaultGroup() *lib.Group

                            func (*Runner) GetOptions

                            func (r *Runner) GetOptions() lib.Options

                            func (*Runner) GetSetupData

                            func (r *Runner) GetSetupData() []byte

                              GetSetupData returns the setup data as json if Setup() was specified and executed, nil otherwise

                              func (*Runner) HandleSummary

                              func (r *Runner) HandleSummary(ctx context.Context, summary *lib.Summary) (map[string]io.Reader, error)

                                HandleSummary calls the specified summary callback, if supplied.

                                func (*Runner) IsExecutable

                                func (r *Runner) IsExecutable(name string) bool

                                  IsExecutable returns whether the given name is an exported and executable function in the script.

                                  func (*Runner) MakeArchive

                                  func (r *Runner) MakeArchive() *lib.Archive

                                  func (*Runner) NewVU

                                  func (r *Runner) NewVU(id int64, samplesOut chan<- stats.SampleContainer) (lib.InitializedVU, error)

                                    NewVU returns a new initialized VU.

                                    func (*Runner) SetOptions

                                    func (r *Runner) SetOptions(opts lib.Options) error

                                    func (*Runner) SetSetupData

                                    func (r *Runner) SetSetupData(data []byte)

                                      SetSetupData saves the externally supplied setup data as json in the runner, so it can be used in VUs

                                      func (*Runner) Setup

                                      func (r *Runner) Setup(ctx context.Context, out chan<- stats.SampleContainer) error

                                        Setup runs the setup function if there is one and sets the setupData to the returned value

                                        func (*Runner) Teardown

                                        func (r *Runner) Teardown(ctx context.Context, out chan<- stats.SampleContainer) error

                                        type VU

                                        type VU struct {
                                        	BundleInstance
                                        
                                        	Runner    *Runner
                                        	Transport *http.Transport
                                        	Dialer    *netext.Dialer
                                        	CookieJar *cookiejar.Jar
                                        	TLSConfig *tls.Config
                                        	ID        int64
                                        	Iteration int64
                                        
                                        	Console *console
                                        	BPool   *bpool.BufferPool
                                        
                                        	Samples chan<- stats.SampleContainer
                                        	// contains filtered or unexported fields
                                        }

                                        func (*VU) Activate

                                        func (u *VU) Activate(params *lib.VUActivationParams) lib.ActiveVU

                                          Activate the VU so it will be able to run code.

                                          func (*VU) GetID

                                          func (u *VU) GetID() int64

                                            GetID returns the unique VU ID.

                                            Directories

                                            Path Synopsis
                                            k6
                                            k6/html
                                            generated by js/modules/k6/html/gen/gen_elements.go directed by js/modules/k6/html/elements.go; DO NOT EDIT nolint: goconst
                                            generated by js/modules/k6/html/gen/gen_elements.go directed by js/modules/k6/html/elements.go; DO NOT EDIT nolint: goconst
                                            internal