summaryrefslogtreecommitdiff
diff options
-rw-r--r--daemon/api_test.go10
-rw-r--r--daemon/export_test.go8
2 files changed, 14 insertions, 4 deletions
diff --git a/daemon/api_test.go b/daemon/api_test.go
index 1fe7a16587..24f4f7a5e9 100644
--- a/daemon/api_test.go
+++ b/daemon/api_test.go
@@ -1031,8 +1031,9 @@ func (s *apiSuite) TestSysInfo(c *check.C) {
// reload dirs for release info to have effect
dirs.SetRootDir(dirs.GlobalRootDir)
- buildID, err := osutil.MyBuildID()
- c.Assert(err, check.IsNil)
+ buildID := "this-is-my-build-id"
+ restore = MockBuildID(buildID)
+ defer restore()
sysInfoCmd.GET(sysInfoCmd, nil, nil).ServeHTTP(rec, nil)
c.Check(rec.Code, check.Equals, 200)
@@ -1101,8 +1102,9 @@ func (s *apiSuite) TestSysInfoLegacyRefresh(c *check.C) {
})
c.Assert(err, check.IsNil)
- buildID, err := osutil.MyBuildID()
- c.Assert(err, check.IsNil)
+ buildID := "this-is-my-build-id"
+ restore = MockBuildID(buildID)
+ defer restore()
sysInfoCmd.GET(sysInfoCmd, nil, nil).ServeHTTP(rec, nil)
c.Check(rec.Code, check.Equals, 200)
diff --git a/daemon/export_test.go b/daemon/export_test.go
index bdc0bf58ae..57ac73f5b4 100644
--- a/daemon/export_test.go
+++ b/daemon/export_test.go
@@ -41,3 +41,11 @@ func MockMuxVars(vars func(*http.Request) map[string]string) (restore func()) {
muxVars = old
}
}
+
+func MockBuildID(mock string) (restore func()) {
+ old := buildID
+ buildID = mock
+ return func() {
+ buildID = old
+ }
+}