Test case when you have two hosts on the same socket
(c *C)
| 127 | |
| 128 | // Test case when you have two hosts on the same socket |
| 129 | func (s *ServerSuite) TestTwoHosts(c *C) { |
| 130 | e := testutils.NewResponder("Hi, I'm endpoint 1") |
| 131 | defer e.Close() |
| 132 | |
| 133 | e2 := testutils.NewResponder("Hi, I'm endpoint 2") |
| 134 | defer e2.Close() |
| 135 | |
| 136 | c.Assert(s.mux.Start(), IsNil) |
| 137 | |
| 138 | b := MakeBatch(Batch{Addr: "localhost:41000", Route: `Host("localhost") && Path("/")`, URL: e.URL}) |
| 139 | b2 := MakeBatch(Batch{Addr: "localhost:41000", Route: `Host("otherhost") && Path("/")`, URL: e2.URL}) |
| 140 | |
| 141 | c.Assert(s.mux.UpsertServer(b.BK, b.S), IsNil) |
| 142 | c.Assert(s.mux.UpsertServer(b2.BK, b2.S), IsNil) |
| 143 | |
| 144 | c.Assert(s.mux.UpsertFrontend(b.F), IsNil) |
| 145 | c.Assert(s.mux.UpsertFrontend(b2.F), IsNil) |
| 146 | |
| 147 | c.Assert(s.mux.UpsertListener(b.L), IsNil) |
| 148 | |
| 149 | c.Assert(GETResponse(c, b.FrontendURL("/"), testutils.Host("localhost")), Equals, "Hi, I'm endpoint 1") |
| 150 | c.Assert(GETResponse(c, b.FrontendURL("/"), testutils.Host("otherhost")), Equals, "Hi, I'm endpoint 2") |
| 151 | } |
| 152 | |
| 153 | func (s *ServerSuite) TestListenerCRUD(c *C) { |
| 154 | e := testutils.NewResponder("Hi, I'm endpoint") |
nothing calls this directly
no test coverage detected