Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
Signed-off-by: cpanato <ctadeu@gmail.com>
  • Loading branch information
cpanato committed Mar 4, 2024
1 parent 33e2631 commit 2cda5e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion internal/config/config_test.go
Expand Up @@ -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) {
Expand Down
6 changes: 5 additions & 1 deletion pkg/version/version_test.go
Expand Up @@ -16,6 +16,7 @@
package version

import (
"fmt"
"os"
"testing"

Expand All @@ -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)
}
Expand Down

0 comments on commit 2cda5e8

Please sign in to comment.