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

refactor: Avoid param reassignment in group_snippet #303

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

going-confetti
Copy link
Collaborator

@going-confetti going-confetti commented Nov 8, 2024

Description

How to Test

⚠️ Please check that Validator works with different test scripts

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have commented on my code, particularly in hard-to-understand areas.

Screenshots (if appropriate):

Related PR(s)/Issue(s)

@going-confetti going-confetti requested a review from a team as a code owner November 8, 2024 10:10
@going-confetti going-confetti requested review from cristianoventura, e-fisher and Llandy3d and removed request for a team November 8, 2024 10:10
Comment on lines +51 to +53
const updatedParams = Object.assign({}, params, {
headers: Object.assign({}, params.headers || {}, groupHeaders),
})
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TIL that our version of k6 doesn't support the spread operator. It was added to a newer version (grafana/k6#3456)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not quite happy with this snippet "polluting" the global namespace, essentially making it impossible to create user-defined variables with names like Client, trimAndRemovePrefix, etc - it's only possible in custom code snippets (and I'm still not sure whether those should have their own scope - let's have a separate discussion on that)

Copy link
Member

Choose a reason for hiding this comment

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

good point!
We should definitely not reserve those names 🤔

Copy link
Collaborator

@e-fisher e-fisher left a comment

Choose a reason for hiding this comment

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

LGTM 👌

Copy link
Collaborator

@cristianoventura cristianoventura left a comment

Choose a reason for hiding this comment

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

🧹 ✨

@going-confetti going-confetti merged commit a5a672c into main Nov 8, 2024
2 checks passed
@going-confetti going-confetti deleted the refactor/group_snippet branch November 8, 2024 15:51
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.

4 participants