Skip to content

Commit

Permalink
Fix metrics registry incompatibility with k6
Browse files Browse the repository at this point in the history
An incompatibility was detected with k6 after grafana/k6#2999.
This commit fixes this incompatibility, which mainly affected structures
defined in k6 browser tests.
  • Loading branch information
ka3de committed Apr 4, 2023
1 parent da9c40b commit f54aec2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
5 changes: 4 additions & 1 deletion browser/mapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

k6common "go.k6.io/k6/js/common"
k6modulestest "go.k6.io/k6/js/modulestest"
k6lib "go.k6.io/k6/lib"
k6metrics "go.k6.io/k6/metrics"
)

Expand Down Expand Up @@ -57,7 +58,9 @@ func TestMappings(t *testing.T) {
vu = &k6modulestest.VU{
RuntimeField: goja.New(),
InitEnvField: &k6common.InitEnvironment{
Registry: k6metrics.NewRegistry(),
TestPreInitState: &k6lib.TestPreInitState{
Registry: k6metrics.NewRegistry(),
},
},
}
customMappings = customMappings()
Expand Down
5 changes: 4 additions & 1 deletion browser/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

k6common "go.k6.io/k6/js/common"
k6modulestest "go.k6.io/k6/js/modulestest"
k6lib "go.k6.io/k6/lib"
k6metrics "go.k6.io/k6/metrics"
)

Expand All @@ -21,7 +22,9 @@ func TestModuleNew(t *testing.T) {
vu := &k6modulestest.VU{
RuntimeField: goja.New(),
InitEnvField: &k6common.InitEnvironment{
Registry: k6metrics.NewRegistry(),
TestPreInitState: &k6lib.TestPreInitState{
Registry: k6metrics.NewRegistry(),
},
},
CtxField: context.Background(),
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa
github.com/sirupsen/logrus v1.9.0
github.com/stretchr/testify v1.8.2
go.k6.io/k6 v0.43.2-0.20230331123120-988f2f6b5f6c
go.k6.io/k6 v0.43.2-0.20230404074422-e40265226b89
golang.org/x/net v0.7.0
golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde
gopkg.in/guregu/null.v3 v3.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.k6.io/k6 v0.43.2-0.20230331123120-988f2f6b5f6c h1:C09qdiSJsWMKPyFUDxUdh39jRbEvggWJpRexADeDyIg=
go.k6.io/k6 v0.43.2-0.20230331123120-988f2f6b5f6c/go.mod h1:Azozhj76R5Fa1pPatdrTgl7+cL5JHBTIqp4aWroBMw4=
go.k6.io/k6 v0.43.2-0.20230404074422-e40265226b89 h1:aJSJixr/yPdHn7/bWP5sh1xrZMPJOjEYDgRNDS1sMbs=
go.k6.io/k6 v0.43.2-0.20230404074422-e40265226b89/go.mod h1:Azozhj76R5Fa1pPatdrTgl7+cL5JHBTIqp4aWroBMw4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
Expand Down

0 comments on commit f54aec2

Please sign in to comment.