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

k6runner: apply empty IP denylist even if it is empty #731

Merged
merged 3 commits into from
Jun 19, 2024

Conversation

nadiamoe
Copy link
Member

@nadiamoe nadiamoe commented Jun 18, 2024

Before this PR, withOpts checked if the IP denylist at opts.BlacklistedIP was empty, and if it was, it didn't override the default value (10.0.0.0/8). Unfortunately, this effectively prevented from clearning that default, as specifying --blocked-nets="" would cause opts.BlacklistedIP to become the empty string, which will not be applied over the default.

To prevent having two defaults (cli flag and in-constructor), with the constructor one being always ignored, this PR gets rid of the constructor default.

The changes here should not cause any functional change, as blocked-nets defaults to 10.0.0.0/8 either way in the CLI code:

Additionally, this PR fixes a bug that made this change ineffective when WithLogger was called on the local runner, as doing so would not copy the IP denylist.

Finally, having a mixture of pointer and non-pointer returns for LocalRunner was making testing hard. This PR also uniforms to non-pointer runners everywhere.

Related to: #730

@nadiamoe nadiamoe requested a review from a team as a code owner June 18, 2024 09:47
@nadiamoe nadiamoe force-pushed the fix-empty-blacklist-ip-arg branch 2 times, most recently from 752abf7 to 76926b4 Compare June 18, 2024 10:35
@nadiamoe nadiamoe merged commit 76b0439 into main Jun 19, 2024
4 checks passed
@nadiamoe nadiamoe deleted the fix-empty-blacklist-ip-arg branch June 19, 2024 07:28
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.

2 participants