Skip to content

Commit

Permalink
Review Changes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
flotter committed Jul 3, 2023
1 parent 9078136 commit 0fddb08
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions internals/daemon/daemon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1175,9 +1175,14 @@ func (s *daemonSuite) TestSyscallPosRebootDelay(c *C) {
})()

period := time.Millisecond * 25
timeout := time.Second * 10
syscallReboot(period)
start := time.Now()
<-wait
select {
case <-wait:
case <-time.After(timeout): // exit test if we fail and get stuck
c.Fail()
}
elapse := time.Now().Sub(start)
c.Assert(elapse >= period, Equals, true)
}
Expand All @@ -1198,7 +1203,11 @@ func (s *daemonSuite) TestSyscallNegRebootDelay(c *C) {
period := time.Second * 10
syscallReboot(-period)
start := time.Now()
<-wait
select {
case <-wait:
case <-time.After(period): // exit test if we fail and get stuck
c.Fail()
}
elapse := time.Now().Sub(start)
c.Assert(elapse < period, Equals, true)
}
Expand All @@ -1222,7 +1231,12 @@ func (s *daemonSuite) TestSetSyscall(c *C) {
err := rebootHandler(0)
c.Assert(err, IsNil)
// This would block forever if the switch did not work.
<-wait
timeout := time.Second * 10
select {
case <-wait:
case <-time.After(timeout): // exit test if we fail and get stuck
c.Fail()
}
}

func (s *daemonSuite) TestCapSysBootFail(c *C) {
Expand Down

0 comments on commit 0fddb08

Please sign in to comment.