Skip to content

Commit

Permalink
Drop direct usage of Group (#296)
Browse files Browse the repository at this point in the history
See grafana/k6#3750 for more info.
  • Loading branch information
mstoykov authored Jun 7, 2024
1 parent 1d8e9ef commit 9fa0159
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions kafka_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package kafka

import (
"context"
"errors"
"testing"

"github.com/dop251/goja"
Expand Down Expand Up @@ -64,31 +63,20 @@ func getTestModuleInstance(tb testing.TB) *kafkaTest {

// moveToVUCode moves to the VU code from the init code (to test certain functions).
func (k *kafkaTest) moveToVUCode() error {
rootGroup, err := lib.NewGroup("", nil)
if err != nil {
return errors.Unwrap(err)
}
samples := make(chan metrics.SampleContainer, 1000)
// Save it, so we can reuse it in other tests
k.samples = samples

registry := metrics.NewRegistry()

state := &lib.State{
Group: rootGroup,
Options: lib.Options{
UserAgent: null.StringFrom("TestUserAgent"),
Paused: null.BoolFrom(false),
},
BufferPool: lib.NewBufferPool(),
Samples: k.samples,
Tags: lib.NewVUStateTags(
registry.RootTagSet().WithTagsFromMap(
map[string]string{
"group": rootGroup.Path,
},
),
),
BufferPool: lib.NewBufferPool(),
Samples: k.samples,
Tags: lib.NewVUStateTags(registry.RootTagSet()),
BuiltinMetrics: metrics.RegisterBuiltinMetrics(registry),
}
k.vu.StateField = state
Expand Down

0 comments on commit 9fa0159

Please sign in to comment.