Skip to content

Commit 3f68ed3

Browse files
author
Zack Mullaly
committed
Fixing some errors raised by tests
1 parent ff6d7d8 commit 3f68ed3

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

mig-agent/agentcontext/env_linux.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"fmt"
1313
"github.com/mozilla/mig"
1414
"github.com/mozilla/mig/service"
15+
"io"
1516
"io/ioutil"
1617
"os"
1718
"os/exec"

mig-agent/agentcontext/env_linux_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,11 @@ REDHAT_SUPPORT_PRODUCT_VERSION="7"`,
5252

5353
reader := strings.NewReader(testCase.FileContents)
5454
ident, err := getOSRelease(reader)
55-
defer reader.Close()
5655

5756
gotErr := err != nil
5857
if testCase.ExpectError && !gotErr {
5958
t.Errorf("Expected to get an error but did not")
60-
} else if !testCase.ExpectedIdent && gotErr {
59+
} else if !testCase.ExpectError && gotErr {
6160
t.Errorf("Did not expect to get an error, but got %s", err.Error())
6261
} else if ident != testCase.ExpectedIdent {
6362
t.Errorf("Expected to get ident \"%s\" but got \"%s\"", testCase.ExpectedIdent, ident)

pgp/gpgagent/gpgagent_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestPrompt(t *testing.T) {
3737
Desc: "Type 'foo' for testing",
3838
Error: "seriously, or I'll be an error.",
3939
Prompt: "foo",
40-
CacheKey: fmt.Sprintf("gpgagent_test-cachekey-%d", time.Now()),
40+
CacheKey: fmt.Sprintf("gpgagent_test-cachekey-%d", time.Now().Unix()),
4141
}
4242
s1, err := conn.GetPassphrase(req)
4343
if err != nil {
@@ -73,7 +73,7 @@ func TestPrompt(t *testing.T) {
7373
Desc: "Press Cancel for testing",
7474
Error: "seriously, or I'll be an error.",
7575
Prompt: "cancel!",
76-
CacheKey: fmt.Sprintf("gpgagent_test-cachekey-%d", time.Now()),
76+
CacheKey: fmt.Sprintf("gpgagent_test-cachekey-%d", time.Now().Unix()),
7777
})
7878
if err != ErrCancel {
7979
t.Errorf("expected cancel, got %q, %v", s4, err)

0 commit comments

Comments
 (0)