| 224 | } |
| 225 | |
| 226 | class empty_failover_tester : public tester_base, public waiter { |
| 227 | public: |
| 228 | empty_failover_tester() : waiter(1), container_(*this, "reconnect_client") {} |
| 229 | |
| 230 | void on_container_start(proton::container &c) override { |
| 231 | // Server that fails upon connection |
| 232 | s1.reset(new server_connection_handler(c, 0, *this)); |
| 233 | } |
| 234 | |
| 235 | // waiter::ready is called when a listener is ready. |
| 236 | void ready() override { |
| 237 | container_.connect(s1->url(), proton::connection_options().failover_urls({})); |
| 238 | } |
| 239 | |
| 240 | void run() { |
| 241 | container_.run(); |
| 242 | ASSERT_EQUAL(1, start_count); |
| 243 | ASSERT_EQUAL(1, open_count); |
| 244 | // Could be >=0, unpredictable number reconnects while listener comes up. |
| 245 | ASSERT(0 <= transport_error_count); |
| 246 | ASSERT(0 <= link_open_count); |
| 247 | ASSERT_EQUAL(1, transport_close_count); |
| 248 | ASSERT_EQUAL(1, connection_error_count); |
| 249 | } |
| 250 | |
| 251 | private: |
| 252 | std::unique_ptr<server_connection_handler> s1; |
| 253 | proton::container container_; |
| 254 | }; |
| 255 | |
| 256 | int test_empty_failover() { |
| 257 | empty_failover_tester().run(); |
no outgoing calls