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

Use k6 LookupEnv instead of os.GetEnv and os.LookupEnv #822

Closed
inancgumus opened this issue Mar 10, 2023 · 0 comments · Fixed by #918
Closed

Use k6 LookupEnv instead of os.GetEnv and os.LookupEnv #822

inancgumus opened this issue Mar 10, 2023 · 0 comments · Fixed by #918
Assignees
Labels
breaking PRs that need to be mentioned in the breaking changes section of the release notes compatibility k6 core compatibility refactor
Milestone

Comments

@inancgumus
Copy link
Member

inancgumus commented Mar 10, 2023

k6-core upgraded to a new API in v0.43 to get the environment variables without depending on the operating system. We can switch to it to stay compatible and prevent possible clashes. It can also be helpful in testing.

We can update os.Getenv and os.LookupEnv. Click on the links to see where we use them.

Breaking change: The following are all the environment variables and options that the k6-browser module supports. The outdated XK6_* will be removed and aligned with the new browser options we have.

// Execution specific.
const (
	// InstanceScenarios is an environment variable that can be used to
	// define the extra scenarios details to use when running remotely.
	InstanceScenarios = "K6_INSTANCE_SCENARIOS"

	// WebSocketURLs is an environment variable that can be used to
	// define the WS URLs to connect to when running remotely.
	WebSocketURLs = "K6_BROWSER_WS_URL"

	// BrowserArguments is an environment variable that can be used to
	// pass extra arguments to the browser process.
	BrowserArguments = "K6_BROWSER_ARGS"

	// BrowserExecutablePath is an environment variable that can be used
	// to define the path to the browser to execute.
	BrowserExecutablePath = "K6_BROWSER_EXECUTABLE_PATH"

	// BrowserEnableDebugging is an environment variable that can be used to
	// define if the browser should be launched with debugging enabled.
	BrowserEnableDebugging = "K6_BROWSER_DEBUG"

	// BrowserHeadless is an environment variable that can be used to
	// define if the browser should be launched in headless mode.
	BrowserHeadless = "K6_BROWSER_HEADLESS"

	// BrowserIgnoreDefaultArgs is an environment variable that can be
	// used to define if the browser should ignore default arguments.
	BrowserIgnoreDefaultArgs = "K6_BROWSER_IGNORE_DEFAULT_ARGS"

	// BrowserGlobalTimeout is an environment variable that can be used
	// to set the global timeout for the browser.
	BrowserGlobalTimeout = "K6_BROWSER_TIMEOUT"
)

// Logging and debugging.
const (
	// EnableProfiling is an environment variable that can be used to
	// enable profiling for the browser. It will start up a debugging
	// server on ProfilingServerAddr.
	EnableProfiling = "K6_BROWSER_ENABLE_PPROF"

	// ProfilingServerAddr is the address of the profiling server.
	ProfilingServerAddr = "localhost:6060"

	// LogCaller is an environment variable that can be used to enable
	// the caller function information in the browser logs.
	LogCaller = "K6_BROWSER_LOG_CALLER"

	// LogLevel is an environment variable that can be used to set the
	// log level for the browser logs.
	LogLevel = "K6_BROWSER_LOG"

	// LogCategoryFilter is an environment variable that can be used to
	// filter the browser logs based on their category. It supports
	// regular expressions.
	LogCategoryFilter = "K6_BROWSER_LOG_CATEGORY_FILTER"
)
@inancgumus inancgumus added the compatibility k6 core compatibility label Mar 10, 2023
@inancgumus inancgumus added this to the v0.9.0 milestone Mar 10, 2023
@inancgumus inancgumus self-assigned this Mar 10, 2023
@inancgumus inancgumus changed the title Use k6 LookupEnv instead of os.GetEnv Use k6 LookupEnv instead of os.GetEnv and os.LookupEnv Mar 10, 2023
@inancgumus inancgumus modified the milestones: v0.9.0, v0.10.0 Mar 31, 2023
@inancgumus inancgumus removed their assignment Apr 10, 2023
@inancgumus inancgumus self-assigned this May 29, 2023
@inancgumus inancgumus linked a pull request Jun 1, 2023 that will close this issue
@inancgumus inancgumus added enhancement New feature or request breaking PRs that need to be mentioned in the breaking changes section of the release notes and removed enhancement New feature or request labels Jun 2, 2023
@inancgumus inancgumus modified the milestones: v0.10.0, v0.11.0 Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking PRs that need to be mentioned in the breaking changes section of the release notes compatibility k6 core compatibility refactor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant