Open
Conversation
Contributor
Author
|
I tested this example: |
K6_SECRET_SOURCE
ankur22
approved these changes
Mar 11, 2026
| stderr := ts.Stderr.String() | ||
| t.Log(stderr) | ||
| assert.NotContains(t, stderr, "level=error") | ||
| assert.Contains(t, stderr, `level=info msg="***SECRET_REDACTED***" source=console`) |
Contributor
There was a problem hiding this comment.
Is it worth asserting that you don't see the secret values?
| }) | ||
|
|
||
| t.Run("commas inside spec are not treated as source separators", func(t *testing.T) { | ||
| // mock=name=mysource,cool=val has a comma, but it belongs to the source |
Contributor
There was a problem hiding this comment.
I don't understand what's going on here, to me this look wrong and should return an error, no?
| t.Parallel() | ||
| ts := NewGlobalTestState(t) | ||
| require.NoError(t, fsext.WriteFile(ts.FS, filepath.Join(ts.Cwd, "script.js"), []byte(script), 0o644)) | ||
| secretFile := filepath.Join(ts.Cwd, "secrets.env") |
Contributor
There was a problem hiding this comment.
What other sources are there? Should there be tests for those too? e.g. url?
|
|
||
| // TestK6SecretSourceEnvVar covers the K6_SECRET_SOURCE environment variable, which is | ||
| // treated as a single complete source spec equivalent to one --secret-source flag value. | ||
| func TestK6SecretSourceEnvVar(t *testing.T) { |
Contributor
There was a problem hiding this comment.
Nit: I would prefer a table test where possible.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Add support for configuring secret sources via the
K6_SECRET_SOURCEenvironment variable, as an alternative to the--secret-sourceCLI flag.K6_SECRET_SOURCEis treated as a single complete source spec — equivalent to one--secret-source flag— so its value follows the exact same syntax.Why?
The
--secret-sourceflag works well for interactive use, but there are cases where having this alternative might be useful.Checklist
make check) and all pass.Checklist: Documentation (only for k6 maintainers and if relevant)
Please do not merge this PR until the following items are filled out.
Related PR(s)/Issue(s)