From 2cda5e8a098ab100ad9bb86f75f3413ad9ec0ac4 Mon Sep 17 00:00:00 2001 From: cpanato Date: Mon, 4 Mar 2024 05:45:18 -0500 Subject: [PATCH] update test Signed-off-by: cpanato --- internal/config/config_test.go | 5 ++++- pkg/version/version_test.go | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 0d1ffcf6..f13e0c6e 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -86,7 +86,10 @@ func TestGet(t *testing.T) { RedirectURL: "example.com", ConnectorID: "bar", RekorMode: "online", - LogPath: "/tmp/gitsign.log", + } + + if os.Getenv("GITSIGN_LOG") != "" { + want.LogPath = os.Getenv("GITSIGN_LOG") } execFn = func() (io.Reader, error) { diff --git a/pkg/version/version_test.go b/pkg/version/version_test.go index ccaf67ec..1920f3c2 100644 --- a/pkg/version/version_test.go +++ b/pkg/version/version_test.go @@ -16,6 +16,7 @@ package version import ( + "fmt" "os" "testing" @@ -35,12 +36,15 @@ func TestEnv(t *testing.T) { os.Setenv("TUF_ROOT", "bar") got := GetVersionInfo() want := []string{ - "GITSIGN_LOG=/tmp/gitsign.log", "GITSIGN_CONNECTOR_ID=foobar", "GITSIGN_TEST=foo", "TUF_ROOT=bar", } + if os.Getenv("GITSIGN_LOG") != "" { + want = append(want, fmt.Sprintf("GITSIGN_LOG=%s", os.Getenv("GITSIGN_LOG"))) + } + if diff := cmp.Diff(got.Env, want); diff != "" { t.Error(diff) }