Skip to content

Commit

Permalink
Merge renovate/rollup into renovate/update/golang.org-x-sys-0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
cultureamp-renovate[bot] authored Dec 13, 2024
2 parents 66af69f + e67c6ac commit c523435
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILDER_IMAGE=public.ecr.aws/docker/library/golang:1.18-alpine
ARG BUILDER_IMAGE=public.ecr.aws/docker/library/golang:1.23-alpine
ARG DISTROLESS_IMAGE=gcr.io/distroless/static

FROM ${BUILDER_IMAGE} as builder
Expand Down
20 changes: 18 additions & 2 deletions src/plugin/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ func TestFailOnMissingEnvironment(t *testing.T) {
var config plugin.Config
fetcher := plugin.EnvironmentConfigFetcher{}

t.Setenv("BUILDKITE_PLUGIN_EXAMPLE_GO_MESSAGE", "")
os.Unsetenv("BUILDKITE_PLUGIN_EXAMPLE_GO_MESSAGE")
unsetEnv(t, "BUILDKITE_PLUGIN_EXAMPLE_GO_MESSAGE")

err := fetcher.Fetch(&config)

Expand All @@ -33,3 +32,20 @@ func TestFetchConfigFromEnvironment(t *testing.T) {
require.NoError(t, err, "fetch should not error")
assert.Equal(t, "test-message", config.Message, "fetched message should match environment")
}

func unsetEnv(t *testing.T, key string) {
t.Helper()

// ensure state is restored correctly
currValue, exists := os.LookupEnv(key)
t.Cleanup(func() {
if exists {
os.Setenv(key, currValue)
} else {
os.Unsetenv(key)
}
})

// clear the value
os.Unsetenv(key)
}

0 comments on commit c523435

Please sign in to comment.