Update of the settings re-initializes staple
(c *C)
| 68 | |
| 69 | // Update of the settings re-initializes staple |
| 70 | func (s *StaplerSuite) TestUpdateSettings(c *C) { |
| 71 | srv := testutils.NewOCSPResponder() |
| 72 | defer srv.Close() |
| 73 | |
| 74 | h, err := engine.NewHost("localhost", |
| 75 | engine.HostSettings{ |
| 76 | KeyPair: &engine.KeyPair{Key: testutils.LocalhostKey, Cert: testutils.LocalhostCertChain}, |
| 77 | OCSP: engine.OCSPSettings{Enabled: true, Period: "1h", Responders: []string{srv.URL}, SkipSignatureCheck: true}, |
| 78 | }) |
| 79 | c.Assert(err, IsNil) |
| 80 | |
| 81 | re, err := s.st.StapleHost(h) |
| 82 | c.Assert(err, IsNil) |
| 83 | c.Assert(re, NotNil) |
| 84 | |
| 85 | c.Assert(re.Response.Status, Equals, ocsp.Good) |
| 86 | |
| 87 | id := s.st.v[h.Name].id |
| 88 | |
| 89 | h2, err := engine.NewHost("localhost", |
| 90 | engine.HostSettings{ |
| 91 | KeyPair: &engine.KeyPair{Key: testutils.LocalhostKey, Cert: testutils.LocalhostCertChain}, |
| 92 | OCSP: engine.OCSPSettings{Enabled: true, Period: "2h", Responders: []string{srv.URL}, SkipSignatureCheck: true}, |
| 93 | }) |
| 94 | c.Assert(err, IsNil) |
| 95 | |
| 96 | re2, err := s.st.StapleHost(h2) |
| 97 | c.Assert(err, IsNil) |
| 98 | c.Assert(re2, NotNil) |
| 99 | c.Assert(re2.Response.Status, Equals, ocsp.Good) |
| 100 | |
| 101 | // the host stapler has been updated |
| 102 | id2 := s.st.v[h.Name].id |
| 103 | |
| 104 | c.Assert(re2, Not(Equals), re) |
| 105 | c.Assert(id2, Not(Equals), id) |
| 106 | } |
| 107 | |
| 108 | // Periodic update updated the staple value, we got the notification |
| 109 | func (s *StaplerSuite) TestUpdateStapleResult(c *C) { |
nothing calls this directly
no test coverage detected