(c *C)
| 133 | } |
| 134 | |
| 135 | func (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 | |
| 168 | func GETResponse(c *C, url string, opts ...testutils.ReqOption) string { |
| 169 | response, body, err := testutils.Get(url, opts...) |
nothing calls this directly
no test coverage detected