CI jobs have no $USER, fix tests

This commit is contained in:
2025-09-04 14:25:11 +02:00
parent ac609a54c2
commit 6cdc738917
2 changed files with 22 additions and 3 deletions

View File

@@ -7,17 +7,31 @@ import (
)
func TestEnvironment(t *testing.T) {
key := "USER"
if testInPipeline() {
key = "CI"
}
testProvider(t, Environment(),
testProviderCase{
Key: "USER",
Key: key,
Test: testNotEmpty,
})
}
func TestEnvironmentPrefix(t *testing.T) {
testProvider(t, EnvironmentPrefix("US"),
var (
prefix = "US"
key = "ER"
)
if testInPipeline() {
prefix = "CI_"
key = "JOB_ID"
}
testProvider(t, EnvironmentPrefix(prefix),
testProviderCase{
Key: "ER",
Key: key,
Test: testNotEmpty,
})
}