MCPcopy
hub / github.com/vulcand/vulcand / TestTransferFiles

Method TestTransferFiles

supervisor/supervisor_test.go:135–166  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

133}
134
135func (s *SupervisorSuite) TestTransferFiles(c *C) {
136 e := testutils.NewResponder("Hi, I'm endpoint")
137 defer e.Close()
138
139 b := MakeBatch(Batch{Addr: "localhost:11800", Route: `Path("/")`, URL: e.URL})
140 c.Assert(s.ng.UpsertBackend(b.B), IsNil)
141 c.Assert(s.ng.UpsertServer(b.BK, b.S, engine.NoTTL), IsNil)
142 c.Assert(s.ng.UpsertFrontend(b.F, engine.NoTTL), IsNil)
143 c.Assert(s.ng.UpsertListener(b.L), IsNil)
144
145 sup := New(newProxy, s.ng, Options{Clock: s.clock})
146 err := sup.Start()
147 c.Assert(err, IsNil)
148
149 time.Sleep(10 * time.Millisecond)
150
151 c.Assert(GETResponse(c, b.FrontendURL("/")), Equals, "Hi, I'm endpoint")
152
153 files, err := sup.GetFiles()
154 c.Assert(err, IsNil)
155
156 sup2 := New(newProxy, s.ng, Options{Clock: s.clock, Files: files})
157 err = sup2.Start()
158 c.Assert(err, IsNil)
159 defer sup2.Stop()
160
161 sup.Stop()
162
163 time.Sleep(10 * time.Millisecond)
164
165 c.Assert(GETResponse(c, b.FrontendURL("/")), Equals, "Hi, I'm endpoint")
166}
167
168func GETResponse(c *C, url string, opts ...testutils.ReqOption) string {
169 response, body, err := testutils.Get(url, opts...)

Callers

nothing calls this directly

Calls 12

MakeBatchFunction · 0.85
FrontendURLMethod · 0.80
NewFunction · 0.70
GETResponseFunction · 0.70
CloseMethod · 0.65
UpsertBackendMethod · 0.65
UpsertServerMethod · 0.65
UpsertFrontendMethod · 0.65
UpsertListenerMethod · 0.65
StartMethod · 0.65
GetFilesMethod · 0.65
StopMethod · 0.65

Tested by

no test coverage detected