Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to new k6 module API #28

Merged
merged 1 commit into from
Feb 15, 2022
Merged

Move to new k6 module API #28

merged 1 commit into from
Feb 15, 2022

Conversation

mstoykov
Copy link
Contributor

see grafana/k6#2344 for more info

Copy link
Collaborator

@chaudum chaudum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question, but otherwise LGTM.

batch := newBatch(ctx, c.cfg.Labels, streams, minBatchSize, maxBatchSize)
return c.pushBatch(ctx, batch)
func (c *Client) PushParameterized(streams, minBatchSize, maxBatchSize int) (httpext.Response, error) {
batch := newBatch(c.vu.Context(), c.vu.State(), c.cfg.Labels, streams, minBatchSize, maxBatchSize)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to check for vu.State() here as well:

Suggested change
batch := newBatch(c.vu.Context(), c.vu.State(), c.cfg.Labels, streams, minBatchSize, maxBatchSize)
if state := c.vu.State(); state == nil {
return *httpext.NewResponse(), errors.New("state is nil")
}
batch := newBatch(c.vu.Context(), c.vu.State(), c.cfg.Labels, streams, minBatchSize, maxBatchSize)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also wondered but it's already done in pushBatch so ... I don't think it's needed, but I can add it 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want me to add it so we can merge this ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PushParameterized is the function that is usually called from within the JS test file. So I'd add the check there as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 77cd232

@mstoykov mstoykov linked an issue Feb 11, 2022 that may be closed by this pull request
client.go Outdated Show resolved Hide resolved
@chaudum
Copy link
Collaborator

chaudum commented Feb 15, 2022

@mstoykov Thanks for taking care of this. Could you please squash the changes into a single commit, then it can be merged.

@mstoykov
Copy link
Contributor Author

I was intending on using the github feature but I see it is disabled :(

@mstoykov mstoykov merged commit c58d02e into main Feb 15, 2022
@mstoykov mstoykov deleted the updateToNewModuleAPI branch February 15, 2022 14:39
@mstoykov mstoykov restored the updateToNewModuleAPI branch February 15, 2022 14:39
@mstoykov mstoykov deleted the updateToNewModuleAPI branch February 15, 2022 14:39
@chaudum
Copy link
Collaborator

chaudum commented Feb 23, 2022

I was intending on using the github feature but I see it is disabled :(

@mstoykov I enabled "squash merge" :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate to a k6/js.modules.Module (ModulesV2)
2 participants