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 2cda5e8 commit b22c9de
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/version/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,21 @@ func TestVersionText(t *testing.T) {
}

func TestEnv(t *testing.T) {
if os.Getenv("GITSIGN_LOG") == "" {
os.Setenv("GITSIGN_LOG", "")
}
os.Setenv("GITSIGN_CONNECTOR_ID", "foobar")
os.Setenv("GITSIGN_TEST", "foo")
os.Setenv("TUF_ROOT", "bar")
got := GetVersionInfo()

want := []string{
fmt.Sprintf("GITSIGN_LOG=%s", os.Getenv("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")))
}
got := GetVersionInfo()

if diff := cmp.Diff(got.Env, want); diff != "" {
t.Error(diff)
Expand Down

0 comments on commit b22c9de

Please sign in to comment.