MCPcopy
hub / github.com/vulcand/vulcand / TestUpdateSettings

Method TestUpdateSettings

stapler/stapler_test.go:70–106  ·  view source on GitHub ↗

Update of the settings re-initializes staple

(c *C)

Source from the content-addressed store, hash-verified

68
69// Update of the settings re-initializes staple
70func (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
109func (s *StaplerSuite) TestUpdateStapleResult(c *C) {

Callers

nothing calls this directly

Calls 4

NewOCSPResponderFunction · 0.92
NewHostFunction · 0.92
CloseMethod · 0.65
StapleHostMethod · 0.65

Tested by

no test coverage detected