From c9af17469e08fa39f7f413aa85b3706c56900043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Miri=C4=87?= Date: Wed, 23 Jun 2021 18:05:11 +0200 Subject: [PATCH 1/8] Replace getter with property based API Based on internal design discussion. Access by property is more idiomatic for JS. Also, s/stats/info/ based on feedback in https://github.com/k6io/k6/pull/1863. --- go.mod | 2 +- go.sum | 4 +- pkg/execution/execution.go | 251 ++++++++++++++++++++++---------- pkg/execution/execution_test.go | 66 ++++----- 4 files changed, 209 insertions(+), 114 deletions(-) diff --git a/go.mod b/go.mod index 3266b25..acaf823 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,6 @@ require ( github.com/sirupsen/logrus v1.8.1 github.com/spf13/afero v1.1.2 github.com/stretchr/testify v1.7.0 - go.k6.io/k6 v0.32.1-0.20210622082042-2039c5691bbe + go.k6.io/k6 v0.32.1-0.20210624122905-f24bd9a86806 gopkg.in/guregu/null.v3 v3.3.0 ) diff --git a/go.sum b/go.sum index d52b342..0d5cefc 100644 --- a/go.sum +++ b/go.sum @@ -329,8 +329,8 @@ github.com/zyedidia/highlight v0.0.0-20170330143449-201131ce5cf5/go.mod h1:c1r+O go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.k6.io/k6 v0.31.2-0.20210510132435-c2958278a362/go.mod h1:WmqQqrJOnATU2o+vmmfPejQquY7DDsfUflLWUpu+LX0= go.k6.io/k6 v0.31.2-0.20210511090412-61f464b99a2d/go.mod h1:5BTMcTH7K+IEoBUPBRM15M9c97nBqeKzQfop868FMiw= -go.k6.io/k6 v0.32.1-0.20210622082042-2039c5691bbe h1:k3IcFb/gUSo/XQPLdaaw7YJXBrPY/Y+AHEh3HtfXNy0= -go.k6.io/k6 v0.32.1-0.20210622082042-2039c5691bbe/go.mod h1:SNG6/ZknLfIqNGbYUfORZT6sNdUuBJ15ntzt8jZloc0= +go.k6.io/k6 v0.32.1-0.20210624122905-f24bd9a86806 h1:8DkI2JZ289voqprAvvDYPDTO49qpXsi4Pxeac+9zVH8= +go.k6.io/k6 v0.32.1-0.20210624122905-f24bd9a86806/go.mod h1:SNG6/ZknLfIqNGbYUfORZT6sNdUuBJ15ntzt8jZloc0= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= diff --git a/pkg/execution/execution.go b/pkg/execution/execution.go index 1e36408..0d5f6c6 100644 --- a/pkg/execution/execution.go +++ b/pkg/execution/execution.go @@ -23,6 +23,7 @@ package execution import ( "context" "errors" + "sort" "time" "github.com/dop251/goja" @@ -31,47 +32,101 @@ import ( "go.k6.io/k6/lib" ) -// Execution is a JS module to return information about the execution in progress. -type Execution struct{} +type ( + // RootExecution is the global module instance that will create module + // instances for each VU. + RootExecution struct{} + // Execution is a JS module that returns information about the currently + // executing test run. + Execution struct{ *goja.Proxy } +) -// New returns a pointer to a new Execution. -func New() *Execution { +// NewModuleInstancePerVU fulfills the k6 modules.HasModuleInstancePerVU +// interface so that each VU will get a separate copy of the module. +func (*RootExecution) NewModuleInstancePerVU() interface{} { return &Execution{} } -// GetVUStats returns information about the currently executing VU. -func (e *Execution) GetVUStats(ctx context.Context) (goja.Value, error) { - vuState := lib.GetState(ctx) - if vuState == nil { - return nil, errors.New("getting VU information in the init context is not supported") +// New returns a pointer to a new RootExecution instance. +func New() *RootExecution { + return &RootExecution{} +} + +// WithContext fulfills the k6 modules.HasWithContext interface to allow +// retrieving the VU, scenario and test state from the context used by each VU. +// It initializes a goja.Proxy object for the per-VU module instance, which in +// turn retrieves goja.DynamicObject instances for each property (scenario, vu, +// test). +func (e *Execution) WithContext(getCtx func() context.Context) { + keys := []string{"scenario", "vu", "test"} + + pcfg := goja.ProxyTrapConfig{ + OwnKeys: func(target *goja.Object) *goja.Object { + ctx := getCtx() + rt := common.GetRuntime(ctx) + return rt.ToValue(keys).ToObject(rt) + }, + Has: func(target *goja.Object, prop string) (available bool) { + return sort.SearchStrings(keys, prop) != -1 + }, + Get: func(target *goja.Object, prop string, r goja.Value) goja.Value { + return dynObjValue(getCtx, target, prop) + }, + GetOwnPropertyDescriptor: func(target *goja.Object, prop string) (desc goja.PropertyDescriptor) { + desc.Enumerable, desc.Configurable = goja.FLAG_TRUE, goja.FLAG_TRUE + desc.Value = dynObjValue(getCtx, target, prop) + return desc + }, } + ctx := getCtx() rt := common.GetRuntime(ctx) - if rt == nil { - return nil, errors.New("goja runtime is nil in context") + proxy := rt.NewProxy(rt.NewObject(), &pcfg) + e.Proxy = &proxy +} + +// dynObjValue returns a goja.Value for a specific prop on target. +func dynObjValue(getCtx func() context.Context, target *goja.Object, prop string) goja.Value { + v := target.Get(prop) + if v != nil { + return v } - stats := map[string]interface{}{ - "id": vuState.VUID, - "idGlobal": vuState.VUIDGlobal, - "iteration": vuState.Iteration, - "iterationScenario": func() goja.Value { - return rt.ToValue(vuState.GetScenarioVUIter()) - }, + ctx := getCtx() + rt := common.GetRuntime(ctx) + var ( + dobj *execInfo + err error + ) + switch prop { + case "scenario": + dobj, err = newScenarioInfo(getCtx) + case "test": + dobj, err = newTestInfo(getCtx) + case "vu": + dobj, err = newVUInfo(getCtx) } - obj, err := newLazyJSObject(rt, stats) if err != nil { - return nil, err + // TODO: Something less drastic? + common.Throw(rt, err) } - return obj, nil + if dobj != nil { + v = rt.NewDynamicObject(dobj) + } + if err := target.Set(prop, v); err != nil { + common.Throw(rt, err) + } + return v } -// GetScenarioStats returns information about the currently executing scenario. -func (e *Execution) GetScenarioStats(ctx context.Context) (goja.Value, error) { - ss := lib.GetScenarioState(ctx) +// newScenarioInfo returns a goja.DynamicObject implementation to retrieve +// information about the scenario the current VU is running in. +func newScenarioInfo(getCtx func() context.Context) (*execInfo, error) { + ctx := getCtx() vuState := lib.GetState(ctx) + ss := lib.GetScenarioState(ctx) if ss == nil || vuState == nil { return nil, errors.New("getting scenario information in the init context is not supported") } @@ -81,35 +136,40 @@ func (e *Execution) GetScenarioStats(ctx context.Context) (goja.Value, error) { return nil, errors.New("goja runtime is nil in context") } - var iterGlobal interface{} - if vuState.GetScenarioGlobalVUIter != nil { - iterGlobal = vuState.GetScenarioGlobalVUIter() - } else { - iterGlobal = goja.Null() - } - - stats := map[string]interface{}{ - "name": ss.Name, - "executor": ss.Executor, - "startTime": float64(ss.StartTime.UnixNano()) / 1e9, - "progress": func() goja.Value { + si := map[string]func() interface{}{ + "name": func() interface{} { + ctx := getCtx() + ss := lib.GetScenarioState(ctx) + return ss.Name + }, + "executor": func() interface{} { + ctx := getCtx() + ss := lib.GetScenarioState(ctx) + return ss.Executor + }, + "startTime": func() interface{} { return float64(ss.StartTime.UnixNano()) / 1e9 }, + "progress": func() interface{} { p, _ := ss.ProgressFn() - return rt.ToValue(p) + return p + }, + "iteration": func() interface{} { + return vuState.GetScenarioLocalVUIter() + }, + "iterationGlobal": func() interface{} { + if vuState.GetScenarioGlobalVUIter != nil { + return vuState.GetScenarioGlobalVUIter() + } + return goja.Null() }, - "iteration": vuState.GetScenarioLocalVUIter(), - "iterationGlobal": iterGlobal, - } - - obj, err := newLazyJSObject(rt, stats) - if err != nil { - return nil, err } - return obj, nil + return newExecInfo(rt, si), nil } -// GetTestInstanceStats returns test information for the current k6 instance. -func (e *Execution) GetTestInstanceStats(ctx context.Context) (goja.Value, error) { +// newTestInfo returns a goja.DynamicObject implementation to retrieve +// information about the overall test run (local instance). +func newTestInfo(getCtx func() context.Context) (*execInfo, error) { + ctx := getCtx() es := lib.GetExecutionState(ctx) if es == nil { return nil, errors.New("getting test information in the init context is not supported") @@ -120,48 +180,85 @@ func (e *Execution) GetTestInstanceStats(ctx context.Context) (goja.Value, error return nil, errors.New("goja runtime is nil in context") } - stats := map[string]interface{}{ - "duration": func() goja.Value { - return rt.ToValue(float64(es.GetCurrentTestRunDuration()) / float64(time.Millisecond)) + ti := map[string]func() interface{}{ + "duration": func() interface{} { + return float64(es.GetCurrentTestRunDuration()) / float64(time.Millisecond) }, - "iterationsCompleted": func() goja.Value { - return rt.ToValue(es.GetFullIterationCount()) + "iterationsCompleted": func() interface{} { + return es.GetFullIterationCount() }, - "iterationsInterrupted": func() goja.Value { - return rt.ToValue(es.GetPartialIterationCount()) + "iterationsInterrupted": func() interface{} { + return es.GetPartialIterationCount() }, - "vusActive": func() goja.Value { - return rt.ToValue(es.GetCurrentlyActiveVUsCount()) + "vusActive": func() interface{} { + return es.GetCurrentlyActiveVUsCount() }, - "vusMax": func() goja.Value { - return rt.ToValue(es.GetInitializedVUsCount()) + "vusMax": func() interface{} { + return es.GetInitializedVUsCount() }, } - obj, err := newLazyJSObject(rt, stats) - if err != nil { - return nil, err + return newExecInfo(rt, ti), nil +} + +// newVUInfo returns a goja.DynamicObject implementation to retrieve +// information about the currently executing VU. +func newVUInfo(getCtx func() context.Context) (*execInfo, error) { + ctx := getCtx() + vuState := lib.GetState(ctx) + if vuState == nil { + return nil, errors.New("getting VU information in the init context is not supported") + } + + rt := common.GetRuntime(ctx) + if rt == nil { + return nil, errors.New("goja runtime is nil in context") } - return obj, nil + vi := map[string]func() interface{}{ + "id": func() interface{} { return vuState.VUID }, + "idGlobal": func() interface{} { return vuState.VUIDGlobal }, + "iteration": func() interface{} { return vuState.Iteration }, + "iterationScenario": func() interface{} { + return vuState.GetScenarioVUIter() + }, + } + + return newExecInfo(rt, vi), nil } -func newLazyJSObject(rt *goja.Runtime, data map[string]interface{}) (goja.Value, error) { - obj := rt.NewObject() +// execInfo is a goja.DynamicObject implementation to lazily return data only +// on property access. +type execInfo struct { + rt *goja.Runtime + obj map[string]func() interface{} + keys []string +} - for k, v := range data { - if val, ok := v.(func() goja.Value); ok { - if err := obj.DefineAccessorProperty(k, rt.ToValue(val), - nil, goja.FLAG_FALSE, goja.FLAG_TRUE); err != nil { - return nil, err - } - } else { - if err := obj.DefineDataProperty(k, rt.ToValue(v), - goja.FLAG_FALSE, goja.FLAG_FALSE, goja.FLAG_TRUE); err != nil { - return nil, err - } - } +var _ goja.DynamicObject = &execInfo{} + +func newExecInfo(rt *goja.Runtime, obj map[string]func() interface{}) *execInfo { + keys := make([]string, 0, len(obj)) + for k := range obj { + keys = append(keys, k) } + return &execInfo{obj: obj, keys: keys, rt: rt} +} - return obj, nil +func (ei *execInfo) Get(key string) goja.Value { + if fn, ok := ei.obj[key]; ok { + return ei.rt.ToValue(fn()) + } + return goja.Undefined() } + +func (ei *execInfo) Set(key string, val goja.Value) bool { return false } + +func (ei *execInfo) Has(key string) bool { + _, has := ei.obj[key] + return has +} + +func (ei *execInfo) Delete(key string) bool { return false } + +func (ei *execInfo) Keys() []string { return ei.keys } diff --git a/pkg/execution/execution_test.go b/pkg/execution/execution_test.go index e8d66a3..fe315d0 100644 --- a/pkg/execution/execution_test.go +++ b/pkg/execution/execution_test.go @@ -27,7 +27,7 @@ func TestMain(m *testing.M) { os.Exit(m.Run()) } -func TestExecutionStatsVUSharing(t *testing.T) { +func TestExecutionInfoVUSharing(t *testing.T) { t.Parallel() script := []byte(` import exec from 'k6/x/execution'; @@ -58,14 +58,14 @@ func TestExecutionStatsVUSharing(t *testing.T) { }; export function cvus() { - const stats = Object.assign({scenario: 'cvus'}, exec.getVUStats()); - console.log(JSON.stringify(stats)); + const info = Object.assign({scenario: 'cvus'}, exec.vu); + console.log(JSON.stringify(info)); sleep(0.2); }; export function carr() { - const stats = Object.assign({scenario: 'carr'}, exec.getVUStats()); - console.log(JSON.stringify(stats)); + const info = Object.assign({scenario: 'carr'}, exec.vu); + console.log(JSON.stringify(info)); }; `) @@ -136,7 +136,7 @@ func TestExecutionStatsVUSharing(t *testing.T) { } } -func TestExecutionStatsScenarioIter(t *testing.T) { +func TestExecutionInfoScenarioIter(t *testing.T) { t.Parallel() script := []byte(` import exec from 'k6/x/execution'; @@ -166,13 +166,13 @@ func TestExecutionStatsScenarioIter(t *testing.T) { }; export function pvu() { - const stats = Object.assign({VUID: __VU}, exec.getScenarioStats()); - console.log(JSON.stringify(stats)); + const info = Object.assign({VUID: __VU}, exec.scenario); + console.log(JSON.stringify(info)); } export function carr() { - const stats = Object.assign({VUID: __VU}, exec.getScenarioStats()); - console.log(JSON.stringify(stats)); + const info = Object.assign({VUID: __VU}, exec.scenario); + console.log(JSON.stringify(info)); }; `) @@ -248,9 +248,8 @@ func TestSharedIterationsStable(t *testing.T) { }, }; export default function () { - const stats = exec.getScenarioStats(); sleep(1); - console.log(JSON.stringify(Object.assign({VUID: __VU}, stats))); + console.log(JSON.stringify(Object.assign({VUID: __VU}, exec.scenario))); } `) @@ -305,7 +304,7 @@ func TestSharedIterationsStable(t *testing.T) { } } -func TestExecutionStats(t *testing.T) { +func TestExecutionInfo(t *testing.T) { t.Parallel() testCases := []struct { @@ -315,48 +314,47 @@ func TestExecutionStats(t *testing.T) { var exec = require('k6/x/execution'); exports.default = function() { - var vuStats = exec.getVUStats(); - if (vuStats.id !== 1) throw new Error('unexpected VU ID: '+vuStats.id); - if (vuStats.idGlobal !== 10) throw new Error('unexpected global VU ID: '+vuStats.idGlobal); - if (vuStats.iteration !== 0) throw new Error('unexpected VU iteration: '+vuStats.iteration); - if (vuStats.iterationScenario !== 0) throw new Error('unexpected scenario iteration: '+vuStats.iterationScenario); + if (exec.vu.id !== 1) throw new Error('unexpected VU ID: '+exec.vu.id); + if (exec.vu.idGlobal !== 10) throw new Error('unexpected global VU ID: '+exec.vu.idGlobal); + if (exec.vu.iteration !== 0) throw new Error('unexpected VU iteration: '+exec.vu.iteration); + if (exec.vu.iterationScenario !== 0) throw new Error('unexpected scenario iteration: '+exec.vu.iterationScenario); }`}, {name: "vu_err", script: ` var exec = require('k6/x/execution'); - exec.getVUStats(); + exec.vu; `, expErr: "getting VU information in the init context is not supported"}, {name: "scenario_ok", script: ` var exec = require('k6/x/execution'); var sleep = require('k6').sleep; exports.default = function() { - var ss = exec.getScenarioStats(); + var si = exec.scenario; sleep(0.1); - if (ss.name !== 'default') throw new Error('unexpected scenario name: '+ss.name); - if (ss.executor !== 'test-exec') throw new Error('unexpected executor: '+ss.executor); - if (ss.startTime > new Date().getTime()) throw new Error('unexpected startTime: '+ss.startTime); - if (ss.progress !== 0.1) throw new Error('unexpected progress: '+ss.progress); - if (ss.iteration !== 3) throw new Error('unexpected scenario local iteration: '+ss.iteration); - if (ss.iterationGlobal !== 4) throw new Error('unexpected scenario local iteration: '+ss.iterationGlobal); + if (si.name !== 'default') throw new Error('unexpected scenario name: '+si.name); + if (si.executor !== 'test-exec') throw new Error('unexpected executor: '+si.executor); + if (si.startTime > new Date().getTime()) throw new Error('unexpected startTime: '+si.startTime); + if (si.progress !== 0.1) throw new Error('unexpected progress: '+si.progress); + if (si.iteration !== 3) throw new Error('unexpected scenario local iteration: '+si.iteration); + if (si.iterationGlobal !== 4) throw new Error('unexpected scenario local iteration: '+si.iterationGlobal); }`}, {name: "scenario_err", script: ` var exec = require('k6/x/execution'); - exec.getScenarioStats(); + exec.scenario; `, expErr: "getting scenario information in the init context is not supported"}, {name: "test_ok", script: ` var exec = require('k6/x/execution'); exports.default = function() { - var ts = exec.getTestInstanceStats(); - if (ts.duration !== 0) throw new Error('unexpected test duration: '+ts.duration); - if (ts.vusActive !== 1) throw new Error('unexpected vusActive: '+ts.vusActive); - if (ts.vusMax !== 0) throw new Error('unexpected vusMax: '+ts.vusMax); - if (ts.iterationsCompleted !== 0) throw new Error('unexpected iterationsCompleted: '+ts.iterationsCompleted); - if (ts.iterationsInterrupted !== 0) throw new Error('unexpected iterationsInterrupted: '+ts.iterationsInterrupted); + var ti = exec.test; + if (ti.duration !== 0) throw new Error('unexpected test duration: '+ti.duration); + if (ti.vusActive !== 1) throw new Error('unexpected vusActive: '+ti.vusActive); + if (ti.vusMax !== 0) throw new Error('unexpected vusMax: '+ti.vusMax); + if (ti.iterationsCompleted !== 0) throw new Error('unexpected iterationsCompleted: '+ti.iterationsCompleted); + if (ti.iterationsInterrupted !== 0) throw new Error('unexpected iterationsInterrupted: '+ti.iterationsInterrupted); }`}, {name: "test_err", script: ` var exec = require('k6/x/execution'); - exec.getTestInstanceStats(); + exec.test; `, expErr: "getting test information in the init context is not supported"}, } From c6a5f93319bd4bfc110da7f4b90ccd61768b57bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Miri=C4=87?= Date: Fri, 6 Aug 2021 10:39:44 +0200 Subject: [PATCH 2/8] Upgrade k6 for new common.Bind replacement This will now be based on https://github.com/grafana/k6/pull/2108 --- go.mod | 4 +- go.sum | 128 ++++++++++++++++----------------------------------------- 2 files changed, 38 insertions(+), 94 deletions(-) diff --git a/go.mod b/go.mod index acaf823..cfde41e 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,10 @@ module github.com/k6io/xk6-execution go 1.16 require ( - github.com/dop251/goja v0.0.0-20210427212725-462d53687b0d + github.com/dop251/goja v0.0.0-20210712101704-705acef95ba3 github.com/sirupsen/logrus v1.8.1 github.com/spf13/afero v1.1.2 github.com/stretchr/testify v1.7.0 - go.k6.io/k6 v0.32.1-0.20210624122905-f24bd9a86806 + go.k6.io/k6 v0.33.1-0.20210806145330-da1fb43c1c42 gopkg.in/guregu/null.v3 v3.3.0 ) diff --git a/go.sum b/go.sum index 0d5cefc..9befe11 100644 --- a/go.sum +++ b/go.sum @@ -11,30 +11,23 @@ cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqCl cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c h1:/IBSNwUN8+eKzUzbJPqhK839ygXJ82sde8x3ogr6R28= github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v0.0.0-20180330214955-e67964b4021a/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/GeertJohan/go.rice v0.0.0-20170420135705-c02ca9a983da/go.mod h1:DgrzXonpdQbfN3uYaGz1EG4Sbhyum/MMIn6Cphlh2bw= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/PuerkitoBio/goquery v1.3.0/go.mod h1:T9ezsOHcCrDCgA8aF1Cqr3sSYbO/xgdy8/R/XiIMAhA= github.com/PuerkitoBio/goquery v1.6.1 h1:FgjbQZKl5HTmcn4sKBgvx8vv63nhyhIpv7lJpFGCWpk= github.com/PuerkitoBio/goquery v1.6.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= -github.com/Shopify/sarama v1.16.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/Soontao/goHttpDigestClient v0.0.0-20170320082612-6d28bb1415c5 h1:k+1+doEm31k0rRjCjLnGG3YRkuO9ljaEyS2ajZd6GK8= github.com/Soontao/goHttpDigestClient v0.0.0-20170320082612-6d28bb1415c5/go.mod h1:5Q4+CyR7+Q3VMG8f78ou+QSX/BNUNUx5W48eFRat8DQ= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/andybalholm/brotli v0.0.0-20190704151324-71eb68cc467c/go.mod h1:+lx6/Aqd1kLJ1GQfkvOnaZ1WGmLpMpbprPuIOOZX30U= -github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= -github.com/andybalholm/brotli v1.0.2 h1:JKnhI/XQ75uFBTiuzXpzFrUriDPiZjlOSzh6wXogP0E= -github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= -github.com/andybalholm/cascadia v1.0.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= +github.com/andybalholm/brotli v1.0.3 h1:fpcw+r1N1h0Poc1F/pHbW40cUm/lMEQslZtCkBQ0UnM= +github.com/andybalholm/brotli v1.0.3/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/andybalholm/cascadia v1.1.0 h1:BuuO6sSfQNFRu1LppgbD25Hr2vLYW25JvxHs5zzsLTo= github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= @@ -47,6 +40,7 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -54,7 +48,6 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/daaku/go.zipexe v0.0.0-20150329023125-a5fe2436ffcb/go.mod h1:U0vRfAucUOohvdCxt5MWLF+TePIL0xbCkbKIiV8TQCE= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -62,33 +55,24 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 h1:Izz0+t1Z5nI16/II7vuEo/nHjodOg0p7+OiDpjX5t1E= github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/dop251/goja v0.0.0-20210216182323-60bc6ebb9fc1/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA= -github.com/dop251/goja v0.0.0-20210427212725-462d53687b0d h1:enuVjS1vVnToj/GuGZ7QegOAIh1jF340Sg6NXcoMohs= -github.com/dop251/goja v0.0.0-20210427212725-462d53687b0d/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/dop251/goja v0.0.0-20210712101704-705acef95ba3 h1:9ILKyhZZQ3D/7Hk5io+HA7HVg9mgGn0gocu6+n6kNgQ= +github.com/dop251/goja v0.0.0-20210712101704-705acef95ba3/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20160609142408-bb955e01b934/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fatih/color v1.5.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= -github.com/fatih/color v1.11.0 h1:l4iX0RqNnx/pU7rY2DB/I+znuYY0K3x6Ywac6EIr0PA= -github.com/fatih/color v1.11.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.12.0 h1:mRhaKNwANqRgUBGKmnI5ZxEk7QXmjQeCcuYFMX2bfcc= +github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813/go.mod h1:P+oSoE9yhSRvsmYyZsshflcR6ePWYLql6UU1amW13IM= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= -github.com/gin-gonic/gin v1.1.5-0.20170702092826-d459835d2b07/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -98,7 +82,6 @@ github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5Nq github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/gddo v0.0.0-20190419222130-af0f2af80721/go.mod h1:xEhNfoBDX1hzLm2Nf80qUvZ2sVwoMZ8d6IE2SrsQfh4= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -114,9 +97,9 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -137,13 +120,12 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= -github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/mux v1.6.1/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -167,31 +149,21 @@ github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/J github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20190402204710-8ff2fc3824fc/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/jhump/protoreflect v1.7.0/go.mod h1:RZkzh7Hi9J7qT/sPlWnJ/UwZqCJvciFxKDA0UCeltSM= -github.com/jhump/protoreflect v1.8.2 h1:k2xE7wcUomeqwY0LDCYA16y4WWfyTcMx5mKhk0d4ua0= -github.com/jhump/protoreflect v1.8.2/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= +github.com/jhump/protoreflect v1.9.0 h1:npqHz788dryJiR/l6K/RUQAyh2SwV91+d1dnh4RjO9w= +github.com/jhump/protoreflect v1.9.0/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/julienschmidt/httprouter v1.1.1-0.20180222160526-d18983907793/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/k6io/xk6-output-kafka v0.1.1/go.mod h1:FEnBddwavknsQ3/tGFW0CP9ABAVMyimlJdLgyT1BDPE= -github.com/k6io/xk6-output-kafka v0.1.2-0.20210510135110-a159d7c8c171/go.mod h1:fgsOfxm/erON/jKuOBL8/TceTnAZPQ1OS8A7cPhrso8= -github.com/k6io/xk6-output-kafka v0.2.0/go.mod h1:yoiecpPwfa3F/UVl8k2scJ0xkZqRYu6Ht1XqohXnlXA= -github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.7.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.12.2 h1:2KCfW3I9M7nSc5wOqXAlW2v2U6v+w6cbjvbfp+OykW8= -github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/cpuid v1.3.1/go.mod h1:bYW4mA6ZgKPob1/Dlai2LviZJO7KGI3uoWLd42rAQw4= +github.com/klauspost/compress v1.13.1 h1:wXr2uRxZTJXHLly6qhJabee5JqIhTRoLBhDOA74hDEQ= +github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= @@ -202,11 +174,7 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kubernetes/helm v2.9.0+incompatible h1:X6Tl40RMiqT0GD8hT3+jFPgkZV1EB6vYsoJDX8YkY+c= github.com/kubernetes/helm v2.9.0+incompatible/go.mod h1:3Nb8I82ptmDi7OvvBQK25X1bwxg+WMAkusUQXHxu8ag= -github.com/labstack/echo v3.2.6+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s= -github.com/labstack/gommon v0.2.2-0.20170925052817-57409ada9da0/go.mod h1:/tj9csK2iPSBvn+3NLM9e52usepMtrd5ilFYA+wQNJ4= -github.com/loadimpact/k6 v0.31.1/go.mod h1:wROIullWNNJKvNvRV/angbz+9lXn3OcCSVHmZVTO3Mc= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mailru/easyjson v0.7.4-0.20200812114229-8ab5ff9cd8e4/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/manyminds/api2go v0.0.0-20180125085803-95be7bd0455e/go.mod h1:Z60vy0EZVSu0bOugCHdcN5ZxFMKSpjRgsnh0XKPFqqk= @@ -214,9 +182,9 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA= +github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa h1:lx8ZnNPwjkXSzOROz0cg69RlErRXs+L3eDkggASWKLo= github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa/go.mod h1:fhpOYavp5g2K74XDl/ao2y4KvhqVtKlkg1e+0UaQv7I= @@ -228,7 +196,6 @@ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eI github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -247,13 +214,10 @@ github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9k github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/oxtoacart/bpool v0.0.0-20150712133111-4e1c5567d7c2/go.mod h1:L3UMQOThbttwfYRNFOWLLVXMhk5Lkio4GGOtw5UrxS0= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pierrec/lz4 v1.0.2-0.20171218195038-2fcda4cb7018/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pierrec/xxHash v0.1.1/go.mod h1:w2waW5Zoa/Wc4Yqe0wgrIYAGKqRMf7czn2HNKXmuL+I= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -269,32 +233,27 @@ github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs= github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e h1:zWKUYT07mGmVBH+9UgnHXd/ekCK99C8EbDSAt5qsjXE= github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.1/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.4-0.20180629152535-a114f312e075/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= @@ -306,33 +265,23 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/tidwall/gjson v1.6.1/go.mod h1:BaHyNc5bjzYkPqgLq7mdVzeiRtULKULXLgZFKsxEHI0= -github.com/tidwall/gjson v1.7.4/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= -github.com/tidwall/gjson v1.8.0 h1:Qt+orfosKn0rbNTZqHYDqBrmm3UDA4KRkv70fDzG+PQ= -github.com/tidwall/gjson v1.8.0/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= -github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= +github.com/tidwall/gjson v1.8.1 h1:8j5EE9Hrh3l9Od1OIEDAb7IpezNA20UdRngNAj5N0WU= +github.com/tidwall/gjson v1.8.1/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE= github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= -github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tidwall/pretty v1.1.0 h1:K3hMW5epkdAVwibsQEfR/7Zj0Qgt4DxtNumTq/VloO8= github.com/tidwall/pretty v1.1.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/urfave/negroni v0.3.1-0.20180130044549-22c5532ea862/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v0.0.0-20170224212429-dcecefd839c4/go.mod h1:50wTf68f99/Zt14pr046Tgt3Lp2vLyFZKzbFXTOabXw= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/zyedidia/highlight v0.0.0-20170330143449-201131ce5cf5/go.mod h1:c1r+Ob9tUTPB0FKWO1+x+Hsc/zNa45WdGq7Y38Ybip0= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.k6.io/k6 v0.31.2-0.20210510132435-c2958278a362/go.mod h1:WmqQqrJOnATU2o+vmmfPejQquY7DDsfUflLWUpu+LX0= -go.k6.io/k6 v0.31.2-0.20210511090412-61f464b99a2d/go.mod h1:5BTMcTH7K+IEoBUPBRM15M9c97nBqeKzQfop868FMiw= -go.k6.io/k6 v0.32.1-0.20210624122905-f24bd9a86806 h1:8DkI2JZ289voqprAvvDYPDTO49qpXsi4Pxeac+9zVH8= -go.k6.io/k6 v0.32.1-0.20210624122905-f24bd9a86806/go.mod h1:SNG6/ZknLfIqNGbYUfORZT6sNdUuBJ15ntzt8jZloc0= +go.k6.io/k6 v0.33.1-0.20210806145330-da1fb43c1c42 h1:HaZsGGeqQMDjJlsIT0dCzu/Rlhj5tkCa7EdaBCT0KZ4= +go.k6.io/k6 v0.33.1-0.20210806145330-da1fb43c1c42/go.mod h1:Ajo3TAXd3NIelxiSVT3ClnhyInD8pVAvm1HvmNEI0Sw= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= @@ -385,13 +334,13 @@ golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201008223702-a5fa9d4b7c91/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210428185458-6f5299370f2b h1:KhiR4XRT2U3zIM2Doxa5zRumXk0ikjVzXMlrCr8epjQ= golang.org/x/net v0.0.0-20210428185458-6f5299370f2b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -409,7 +358,6 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -422,7 +370,6 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88 h1:KmZPnMocC93w341XZp26yTJg8Za7lhb2KhkYmixoeso= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -433,11 +380,10 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/time v0.0.0-20170927054726-6dc17368e09b/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20210611083556-38a9dc6acbc6 h1:Vv0JUPWTyeqUq42B2WJ1FeIDjjvGKoA2Ss+Ts0lAVbs= +golang.org/x/time v0.0.0-20210611083556-38a9dc6acbc6/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -474,7 +420,6 @@ google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9Ywl google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -484,20 +429,20 @@ google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200903010400-9bfcb5116336 h1:ZcAny/XH59BbzUOKydQpvIlklwibW3T9SvDE5cGhdzc= google.golang.org/genproto v0.0.0-20200903010400-9bfcb5116336/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.1 h1:ARnQJNWxGyYJpdf/JXscNlQr/uv607ZPU9Z7ogHi+iI= -google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.39.0 h1:Klz8I9kdtkIN6EpHHUOMLCYhTn/2WAe5a0s1hcBkdTI= +google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -517,8 +462,6 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= gopkg.in/guregu/null.v2 v2.1.2/go.mod h1:XORrx8tyS5ZDcyUboCIxQtta/Aujk/6pfWrn9Xe33mU= gopkg.in/guregu/null.v3 v3.3.0 h1:8j3ggqq+NgKt/O7mbFVUFKUMWN+l1AmT5jQmJ6nPh2c= gopkg.in/guregu/null.v3 v3.3.0/go.mod h1:E4tX2Qe3h7QdL+uZ3a0vqvYwKQsRSQKM5V4YltdgH9Y= @@ -529,6 +472,7 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= From a417c77b7a44d45869cbf0db90edf6221b6109b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Miri=C4=87?= Date: Fri, 6 Aug 2021 15:16:54 +0200 Subject: [PATCH 3/8] Convert to V2 JS module See https://github.com/grafana/k6/pull/2108 --- pkg/execution/execution.go | 58 +++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/pkg/execution/execution.go b/pkg/execution/execution.go index 0d5f6c6..0321e18 100644 --- a/pkg/execution/execution.go +++ b/pkg/execution/execution.go @@ -29,60 +29,66 @@ import ( "github.com/dop251/goja" "go.k6.io/k6/js/common" + "go.k6.io/k6/js/modules" "go.k6.io/k6/lib" ) type ( - // RootExecution is the global module instance that will create module + // RootModule is the global module instance that will create module // instances for each VU. - RootExecution struct{} - // Execution is a JS module that returns information about the currently - // executing test run. - Execution struct{ *goja.Proxy } + RootModule struct{} + + // ModuleInstance represents an instance of the execution module. + ModuleInstance struct { + modules.InstanceCore + proxy *goja.Proxy + } ) -// NewModuleInstancePerVU fulfills the k6 modules.HasModuleInstancePerVU -// interface so that each VU will get a separate copy of the module. -func (*RootExecution) NewModuleInstancePerVU() interface{} { - return &Execution{} -} +var ( + _ modules.IsModuleV2 = &RootModule{} + _ modules.Instance = &ModuleInstance{} +) -// New returns a pointer to a new RootExecution instance. -func New() *RootExecution { - return &RootExecution{} +// New returns a pointer to a new RootModule instance. +func New() *RootModule { + return &RootModule{} } -// WithContext fulfills the k6 modules.HasWithContext interface to allow -// retrieving the VU, scenario and test state from the context used by each VU. -// It initializes a goja.Proxy object for the per-VU module instance, which in -// turn retrieves goja.DynamicObject instances for each property (scenario, vu, -// test). -func (e *Execution) WithContext(getCtx func() context.Context) { +// NewModuleInstance implements the modules.IsModuleV2 interface to return +// a new instance for each VU. +// It initializes a goja.Proxy instance, which in turn returns +// goja.DynamicObject instances for each property (scenario, vu, test). +func (*RootModule) NewModuleInstance(m modules.InstanceCore) modules.Instance { keys := []string{"scenario", "vu", "test"} pcfg := goja.ProxyTrapConfig{ OwnKeys: func(target *goja.Object) *goja.Object { - ctx := getCtx() - rt := common.GetRuntime(ctx) + rt := m.GetRuntime() return rt.ToValue(keys).ToObject(rt) }, Has: func(target *goja.Object, prop string) (available bool) { return sort.SearchStrings(keys, prop) != -1 }, Get: func(target *goja.Object, prop string, r goja.Value) goja.Value { - return dynObjValue(getCtx, target, prop) + return dynObjValue(m.GetContext, target, prop) }, GetOwnPropertyDescriptor: func(target *goja.Object, prop string) (desc goja.PropertyDescriptor) { desc.Enumerable, desc.Configurable = goja.FLAG_TRUE, goja.FLAG_TRUE - desc.Value = dynObjValue(getCtx, target, prop) + desc.Value = dynObjValue(m.GetContext, target, prop) return desc }, } - ctx := getCtx() - rt := common.GetRuntime(ctx) + rt := m.GetRuntime() proxy := rt.NewProxy(rt.NewObject(), &pcfg) - e.Proxy = &proxy + + return &ModuleInstance{InstanceCore: m, proxy: &proxy} +} + +// GetExports returns the exports of the execution module. +func (mi *ModuleInstance) GetExports() modules.Exports { + return modules.Exports{Default: mi.proxy} } // dynObjValue returns a goja.Value for a specific prop on target. From ea169099eb85d4beed9be305b68f253ba2867497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Miri=C4=87?= Date: Thu, 12 Aug 2021 15:54:29 +0200 Subject: [PATCH 4/8] Replace goja.Proxy with simple Object with property accessors Resolves https://github.com/grafana/xk6-execution/pull/2#discussion_r685319635 --- pkg/execution/execution.go | 101 +++++++++++-------------------------- 1 file changed, 30 insertions(+), 71 deletions(-) diff --git a/pkg/execution/execution.go b/pkg/execution/execution.go index 0321e18..8b53bf7 100644 --- a/pkg/execution/execution.go +++ b/pkg/execution/execution.go @@ -21,9 +21,7 @@ package execution import ( - "context" "errors" - "sort" "time" "github.com/dop251/goja" @@ -41,7 +39,7 @@ type ( // ModuleInstance represents an instance of the execution module. ModuleInstance struct { modules.InstanceCore - proxy *goja.Proxy + obj *goja.Object } ) @@ -57,80 +55,41 @@ func New() *RootModule { // NewModuleInstance implements the modules.IsModuleV2 interface to return // a new instance for each VU. -// It initializes a goja.Proxy instance, which in turn returns -// goja.DynamicObject instances for each property (scenario, vu, test). func (*RootModule) NewModuleInstance(m modules.InstanceCore) modules.Instance { - keys := []string{"scenario", "vu", "test"} - - pcfg := goja.ProxyTrapConfig{ - OwnKeys: func(target *goja.Object) *goja.Object { - rt := m.GetRuntime() - return rt.ToValue(keys).ToObject(rt) - }, - Has: func(target *goja.Object, prop string) (available bool) { - return sort.SearchStrings(keys, prop) != -1 - }, - Get: func(target *goja.Object, prop string, r goja.Value) goja.Value { - return dynObjValue(m.GetContext, target, prop) - }, - GetOwnPropertyDescriptor: func(target *goja.Object, prop string) (desc goja.PropertyDescriptor) { - desc.Enumerable, desc.Configurable = goja.FLAG_TRUE, goja.FLAG_TRUE - desc.Value = dynObjValue(m.GetContext, target, prop) - return desc - }, + mi := &ModuleInstance{InstanceCore: m} + rt := m.GetRuntime() + o := rt.NewObject() + defProp := func(name string, newInfo func() (*execInfo, error)) { + err := o.DefineAccessorProperty(name, rt.ToValue(func() goja.Value { + rt := mi.GetRuntime() + dobj, err := newInfo() + if err != nil { + common.Throw(rt, err) + } + return rt.NewDynamicObject(dobj) + }), nil, goja.FLAG_FALSE, goja.FLAG_TRUE) + if err != nil { + common.Throw(rt, err) + } } + defProp("scenario", mi.newScenarioInfo) + defProp("test", mi.newTestInfo) + defProp("vu", mi.newVUInfo) - rt := m.GetRuntime() - proxy := rt.NewProxy(rt.NewObject(), &pcfg) + mi.obj = o - return &ModuleInstance{InstanceCore: m, proxy: &proxy} + return mi } // GetExports returns the exports of the execution module. func (mi *ModuleInstance) GetExports() modules.Exports { - return modules.Exports{Default: mi.proxy} -} - -// dynObjValue returns a goja.Value for a specific prop on target. -func dynObjValue(getCtx func() context.Context, target *goja.Object, prop string) goja.Value { - v := target.Get(prop) - if v != nil { - return v - } - - ctx := getCtx() - rt := common.GetRuntime(ctx) - var ( - dobj *execInfo - err error - ) - switch prop { - case "scenario": - dobj, err = newScenarioInfo(getCtx) - case "test": - dobj, err = newTestInfo(getCtx) - case "vu": - dobj, err = newVUInfo(getCtx) - } - - if err != nil { - // TODO: Something less drastic? - common.Throw(rt, err) - } - - if dobj != nil { - v = rt.NewDynamicObject(dobj) - } - if err := target.Set(prop, v); err != nil { - common.Throw(rt, err) - } - return v + return modules.Exports{Default: mi.obj} } // newScenarioInfo returns a goja.DynamicObject implementation to retrieve // information about the scenario the current VU is running in. -func newScenarioInfo(getCtx func() context.Context) (*execInfo, error) { - ctx := getCtx() +func (mi *ModuleInstance) newScenarioInfo() (*execInfo, error) { + ctx := mi.GetContext() vuState := lib.GetState(ctx) ss := lib.GetScenarioState(ctx) if ss == nil || vuState == nil { @@ -144,12 +103,12 @@ func newScenarioInfo(getCtx func() context.Context) (*execInfo, error) { si := map[string]func() interface{}{ "name": func() interface{} { - ctx := getCtx() + ctx := mi.GetContext() ss := lib.GetScenarioState(ctx) return ss.Name }, "executor": func() interface{} { - ctx := getCtx() + ctx := mi.GetContext() ss := lib.GetScenarioState(ctx) return ss.Executor }, @@ -174,8 +133,8 @@ func newScenarioInfo(getCtx func() context.Context) (*execInfo, error) { // newTestInfo returns a goja.DynamicObject implementation to retrieve // information about the overall test run (local instance). -func newTestInfo(getCtx func() context.Context) (*execInfo, error) { - ctx := getCtx() +func (mi *ModuleInstance) newTestInfo() (*execInfo, error) { + ctx := mi.GetContext() es := lib.GetExecutionState(ctx) if es == nil { return nil, errors.New("getting test information in the init context is not supported") @@ -209,8 +168,8 @@ func newTestInfo(getCtx func() context.Context) (*execInfo, error) { // newVUInfo returns a goja.DynamicObject implementation to retrieve // information about the currently executing VU. -func newVUInfo(getCtx func() context.Context) (*execInfo, error) { - ctx := getCtx() +func (mi *ModuleInstance) newVUInfo() (*execInfo, error) { + ctx := mi.GetContext() vuState := lib.GetState(ctx) if vuState == nil { return nil, errors.New("getting VU information in the init context is not supported") From 01b22c718d89b0bd7d14645c907d65a42f42e3b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Miri=C4=87?= Date: Thu, 12 Aug 2021 16:32:54 +0200 Subject: [PATCH 5/8] Get k6 version to build extension with from go.mod The current WIP branches depend on WIP branches of k6, so we can't build against k6 master. This should work for all cases... --- .github/workflows/xk6.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/xk6.yml b/.github/workflows/xk6.yml index 5211c0e..12e1cf9 100644 --- a/.github/workflows/xk6.yml +++ b/.github/workflows/xk6.yml @@ -41,7 +41,8 @@ jobs: go version go install github.com/k6io/xk6/cmd/xk6@master - GOPROXY="direct" xk6 build master \ + K6_VERSION="$(grep 'go\.k6\.io' go.mod | cut -d' ' -f2)" + GOPROXY="direct" xk6 build \ --output ./k6ext \ --with github.com/k6io/xk6-execution="$(pwd)" ./k6ext version From e09c3e7bc10b7a736162708326cf4dfe4bb0b98a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Miri=C4=87?= Date: Thu, 12 Aug 2021 16:47:05 +0200 Subject: [PATCH 6/8] Set GONOSUMDB to ignore the hash mismatch for k6 v0.33.0 The v0.33.0 tag was moved in k6, which messed up the sum.golang.org proxy. We can remove this after the next k6 version is released. --- .github/workflows/xk6.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/xk6.yml b/.github/workflows/xk6.yml index 12e1cf9..1ee938b 100644 --- a/.github/workflows/xk6.yml +++ b/.github/workflows/xk6.yml @@ -40,6 +40,8 @@ jobs: which go go version + # Temporary hack to ignore the v0.33.0 tag change + export GONOSUMDB="go.k6.io/k6" go install github.com/k6io/xk6/cmd/xk6@master K6_VERSION="$(grep 'go\.k6\.io' go.mod | cut -d' ' -f2)" GOPROXY="direct" xk6 build \ From 65326ec1b60866e6a5d1635df14d2688a69f8216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Miri=C4=87?= Date: Thu, 12 Aug 2021 17:23:53 +0200 Subject: [PATCH 7/8] Also replace goja.DynamicObject with simple Object Resolves https://github.com/grafana/xk6-execution/pull/2#discussion_r687801663 --- pkg/execution/execution.go | 66 ++++++++++++-------------------------- 1 file changed, 21 insertions(+), 45 deletions(-) diff --git a/pkg/execution/execution.go b/pkg/execution/execution.go index 8b53bf7..43a7d20 100644 --- a/pkg/execution/execution.go +++ b/pkg/execution/execution.go @@ -59,14 +59,13 @@ func (*RootModule) NewModuleInstance(m modules.InstanceCore) modules.Instance { mi := &ModuleInstance{InstanceCore: m} rt := m.GetRuntime() o := rt.NewObject() - defProp := func(name string, newInfo func() (*execInfo, error)) { + defProp := func(name string, newInfo func() (*goja.Object, error)) { err := o.DefineAccessorProperty(name, rt.ToValue(func() goja.Value { - rt := mi.GetRuntime() - dobj, err := newInfo() + obj, err := newInfo() if err != nil { - common.Throw(rt, err) + common.Throw(mi.GetRuntime(), err) } - return rt.NewDynamicObject(dobj) + return obj }), nil, goja.FLAG_FALSE, goja.FLAG_TRUE) if err != nil { common.Throw(rt, err) @@ -86,9 +85,9 @@ func (mi *ModuleInstance) GetExports() modules.Exports { return modules.Exports{Default: mi.obj} } -// newScenarioInfo returns a goja.DynamicObject implementation to retrieve +// newScenarioInfo returns a goja.Object with property accessors to retrieve // information about the scenario the current VU is running in. -func (mi *ModuleInstance) newScenarioInfo() (*execInfo, error) { +func (mi *ModuleInstance) newScenarioInfo() (*goja.Object, error) { ctx := mi.GetContext() vuState := lib.GetState(ctx) ss := lib.GetScenarioState(ctx) @@ -128,12 +127,12 @@ func (mi *ModuleInstance) newScenarioInfo() (*execInfo, error) { }, } - return newExecInfo(rt, si), nil + return newInfoObj(rt, si), nil } -// newTestInfo returns a goja.DynamicObject implementation to retrieve +// newTestInfo returns a goja.Object with property accessors to retrieve // information about the overall test run (local instance). -func (mi *ModuleInstance) newTestInfo() (*execInfo, error) { +func (mi *ModuleInstance) newTestInfo() (*goja.Object, error) { ctx := mi.GetContext() es := lib.GetExecutionState(ctx) if es == nil { @@ -163,12 +162,12 @@ func (mi *ModuleInstance) newTestInfo() (*execInfo, error) { }, } - return newExecInfo(rt, ti), nil + return newInfoObj(rt, ti), nil } -// newVUInfo returns a goja.DynamicObject implementation to retrieve +// newVUInfo returns a goja.Object with property accessors to retrieve // information about the currently executing VU. -func (mi *ModuleInstance) newVUInfo() (*execInfo, error) { +func (mi *ModuleInstance) newVUInfo() (*goja.Object, error) { ctx := mi.GetContext() vuState := lib.GetState(ctx) if vuState == nil { @@ -189,41 +188,18 @@ func (mi *ModuleInstance) newVUInfo() (*execInfo, error) { }, } - return newExecInfo(rt, vi), nil + return newInfoObj(rt, vi), nil } -// execInfo is a goja.DynamicObject implementation to lazily return data only -// on property access. -type execInfo struct { - rt *goja.Runtime - obj map[string]func() interface{} - keys []string -} - -var _ goja.DynamicObject = &execInfo{} - -func newExecInfo(rt *goja.Runtime, obj map[string]func() interface{}) *execInfo { - keys := make([]string, 0, len(obj)) - for k := range obj { - keys = append(keys, k) - } - return &execInfo{obj: obj, keys: keys, rt: rt} -} +func newInfoObj(rt *goja.Runtime, props map[string]func() interface{}) *goja.Object { + o := rt.NewObject() -func (ei *execInfo) Get(key string) goja.Value { - if fn, ok := ei.obj[key]; ok { - return ei.rt.ToValue(fn()) + for p, get := range props { + err := o.DefineAccessorProperty(p, rt.ToValue(get), nil, goja.FLAG_FALSE, goja.FLAG_TRUE) + if err != nil { + common.Throw(rt, err) + } } - return goja.Undefined() -} -func (ei *execInfo) Set(key string, val goja.Value) bool { return false } - -func (ei *execInfo) Has(key string) bool { - _, has := ei.obj[key] - return has + return o } - -func (ei *execInfo) Delete(key string) bool { return false } - -func (ei *execInfo) Keys() []string { return ei.keys } From 264ba62fd82fb61f572b18ef106f63c947488ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Miri=C4=87?= Date: Fri, 13 Aug 2021 10:32:14 +0200 Subject: [PATCH 8/8] Avoid some common.Throw() usage Resolves https://github.com/grafana/xk6-execution/pull/2#discussion_r688299116 --- pkg/execution/execution.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/execution/execution.go b/pkg/execution/execution.go index 43a7d20..2df44af 100644 --- a/pkg/execution/execution.go +++ b/pkg/execution/execution.go @@ -63,7 +63,7 @@ func (*RootModule) NewModuleInstance(m modules.InstanceCore) modules.Instance { err := o.DefineAccessorProperty(name, rt.ToValue(func() goja.Value { obj, err := newInfo() if err != nil { - common.Throw(mi.GetRuntime(), err) + common.Throw(rt, err) } return obj }), nil, goja.FLAG_FALSE, goja.FLAG_TRUE) @@ -127,7 +127,7 @@ func (mi *ModuleInstance) newScenarioInfo() (*goja.Object, error) { }, } - return newInfoObj(rt, si), nil + return newInfoObj(rt, si) } // newTestInfo returns a goja.Object with property accessors to retrieve @@ -162,7 +162,7 @@ func (mi *ModuleInstance) newTestInfo() (*goja.Object, error) { }, } - return newInfoObj(rt, ti), nil + return newInfoObj(rt, ti) } // newVUInfo returns a goja.Object with property accessors to retrieve @@ -188,18 +188,18 @@ func (mi *ModuleInstance) newVUInfo() (*goja.Object, error) { }, } - return newInfoObj(rt, vi), nil + return newInfoObj(rt, vi) } -func newInfoObj(rt *goja.Runtime, props map[string]func() interface{}) *goja.Object { +func newInfoObj(rt *goja.Runtime, props map[string]func() interface{}) (*goja.Object, error) { o := rt.NewObject() for p, get := range props { err := o.DefineAccessorProperty(p, rt.ToValue(get), nil, goja.FLAG_FALSE, goja.FLAG_TRUE) if err != nil { - common.Throw(rt, err) + return nil, err } } - return o + return o, nil }