summaryrefslogtreecommitdiff
diff options
authorIan Johnson <ian.johnson@canonical.com>2019-09-24 19:55:16 -0500
committerIan Johnson <ian.johnson@canonical.com>2019-09-24 19:55:16 -0500
commit4d59425baaa39d5d71f52096e7bd21403924eb43 (patch)
tree714570dbc676582945b4cbe467a2e04e6435a8ac
parent19b74b8c2f68fe87e51a909f40227d1237a6338a (diff)
tests/cmd/debug_state: make the test output TZ independent
This currently seems to only have been passing if it was run in a TZ that was GMT+x, which led to the time being formatted as 0001-01-01, while running it in a GMT-x TZ led to the time being formatted as 0000-12-31. Instead just make it an absolute time so it's the same everywhere. Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
-rw-r--r--cmd/snap/cmd_debug_state_test.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/cmd/snap/cmd_debug_state_test.go b/cmd/snap/cmd_debug_state_test.go
index 9a1e9e72a5..517f67627e 100644
--- a/cmd/snap/cmd_debug_state_test.go
+++ b/cmd/snap/cmd_debug_state_test.go
@@ -25,7 +25,7 @@ import (
. "gopkg.in/check.v1"
- "github.com/snapcore/snapd/cmd/snap"
+ main "github.com/snapcore/snapd/cmd/snap"
)
var stateJSON = []byte(`
@@ -102,13 +102,13 @@ func (s *SnapSuite) TestDebugChanges(c *C) {
stateFile := filepath.Join(dir, "test-state.json")
c.Assert(ioutil.WriteFile(stateFile, stateJSON, 0644), IsNil)
- rest, err := main.Parser(main.Client()).ParseArgs([]string{"debug", "state", "--changes", stateFile})
+ rest, err := main.Parser(main.Client()).ParseArgs([]string{"debug", "state", "--abs-time", "--changes", stateFile})
c.Assert(err, IsNil)
c.Assert(rest, DeepEquals, []string{})
c.Check(s.Stdout(), Matches,
- "ID Status Spawn Ready Label Summary\n"+
- "1 Do 0001-01-01 0001-01-01 install-snap install a snap\n"+
- "2 Done 0001-01-01 0001-01-01 revert-snap revert c snap\n")
+ "ID Status Spawn Ready Label Summary\n"+
+ "1 Do 0001-01-01T00:00:00Z 0001-01-01T00:00:00Z install-snap install a snap\n"+
+ "2 Done 0001-01-01T00:00:00Z 0001-01-01T00:00:00Z revert-snap revert c snap\n")
c.Check(s.Stderr(), Equals, "")
}
@@ -188,13 +188,13 @@ func (s *SnapSuite) TestDebugTasks(c *C) {
stateFile := filepath.Join(dir, "test-state.json")
c.Assert(ioutil.WriteFile(stateFile, stateJSON, 0644), IsNil)
- rest, err := main.Parser(main.Client()).ParseArgs([]string{"debug", "state", "--change=1", stateFile})
+ rest, err := main.Parser(main.Client()).ParseArgs([]string{"debug", "state", "--abs-time", "--change=1", stateFile})
c.Assert(err, IsNil)
c.Assert(rest, DeepEquals, []string{})
c.Check(s.Stdout(), Matches,
- "Lanes ID Status Spawn Ready Kind Summary\n"+
- "0 11 Done 0001-01-01 0001-01-01 download-snap Download snap a from channel edge\n"+
- "0 12 Do 0001-01-01 0001-01-01 some-other-task \n")
+ "Lanes ID Status Spawn Ready Kind Summary\n"+
+ "0 11 Done 0001-01-01T00:00:00Z 0001-01-01T00:00:00Z download-snap Download snap a from channel edge\n"+
+ "0 12 Do 0001-01-01T00:00:00Z 0001-01-01T00:00:00Z some-other-task \n")
c.Check(s.Stderr(), Equals, "")
}