environment

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2026 License: Apache-2.0 Imports: 3 Imported by: 51

Documentation

Overview

Package environment provides utility functions for interacting with the OS environment (e.g environment variables).

Deprecated: The environment package is scheduled for removal in Terratest v2. Most uses are os.Getenv with a literal default; call the standard library directly instead. See the Terratest v2 migration notes for details.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFirstNonEmptyEnvVarOrEmptyString deprecated

func GetFirstNonEmptyEnvVarOrEmptyString(t testing.TestingT, envVarNames []string) string

GetFirstNonEmptyEnvVarOrEmptyString returns the first non-empty environment variable from envVarNames, or returns the empty string

Deprecated: scheduled for removal in Terratest v2. Range over os.Getenv at the call site, e.g.:

for _, name := range envVarNames {
	if value := os.Getenv(name); value != "" {
		return value
	}
}

func GetFirstNonEmptyEnvVarOrFatal deprecated

func GetFirstNonEmptyEnvVarOrFatal(t testing.TestingT, envVarNames []string) string

GetFirstNonEmptyEnvVarOrFatal returns the first non-empty environment variable from envVarNames, or fails the test if all of them are empty.

Deprecated: scheduled for removal in Terratest v2. Range over os.Getenv at the call site, e.g.:

var value string
for _, name := range envVarNames {
	if value = os.Getenv(name); value != "" {
		break
	}
}
require.NotEmptyf(t, value, "all of %v are empty", envVarNames)

func RequireEnvVar deprecated added in v0.40.1

func RequireEnvVar(t testing.TestingT, envVarName string)

RequireEnvVar fails the test if the specified environment variable is not defined or is blank.

Deprecated: scheduled for removal in Terratest v2. Use require with os.Getenv at the call site, e.g.:

require.NotEmptyf(t, os.Getenv(name), "environment variable %s must be set", name)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL