|
6 | 6 | #include "console_backend.hpp"
|
7 | 7 | #include "context_builder.hpp"
|
8 | 8 | #include "events/detail/asio_event_processor.hpp"
|
9 |
| -#include "null_logger.hpp" |
| 9 | + |
10 | 10 | using namespace launchdarkly;
|
11 | 11 | class EventProcessorTests : public ::testing::Test {};
|
12 | 12 |
|
13 |
| -TEST_F(EventProcessorTests, thing) { |
| 13 | +// This test is a temporary test that exists only to ensure the event processor |
| 14 | +// compiles; it should be replaced by more robust tests (and contract tests.) |
| 15 | +TEST_F(EventProcessorTests, ProcessorCompiles) { |
14 | 16 | Logger logger{std::make_unique<ConsoleBackend>(LogLevel::kDebug, "test")};
|
15 | 17 | boost::asio::io_context io;
|
16 | 18 |
|
17 | 19 | auto config = client::EventsBuilder()
|
18 | 20 | .capacity(10)
|
19 |
| - .flush_interval(std::chrono::seconds(3)) |
| 21 | + .flush_interval(std::chrono::seconds(1)) |
20 | 22 | .build();
|
21 | 23 |
|
22 | 24 | auto endpoints = client::HostsBuilder().build();
|
23 | 25 |
|
24 | 26 | events::detail::AsioEventProcessor ep(io.get_executor(), *config,
|
25 | 27 | *endpoints, "password", logger);
|
26 |
| - |
27 |
| - std::thread t([&]() { |
28 |
| - io.run(); |
29 |
| - std::cout << "exiting"; |
30 |
| - }); |
31 |
| - std::this_thread::sleep_for(std::chrono::seconds(2)); |
| 28 | + std::thread t([&]() { io.run(); }); |
32 | 29 |
|
33 | 30 | auto c = launchdarkly::ContextBuilder().kind("org", "ld").build();
|
34 | 31 | ASSERT_TRUE(c.valid());
|
| 32 | + |
35 | 33 | auto ev = events::client::IdentifyEventParams{
|
36 | 34 | std::chrono::system_clock::now(),
|
37 | 35 | c,
|
38 | 36 | };
|
39 | 37 |
|
40 |
| - for (std::size_t i = 0; i < 3; i++) { |
| 38 | + for (std::size_t i = 0; i < 10; i++) { |
41 | 39 | ep.AsyncSend(ev);
|
42 | 40 | }
|
43 | 41 |
|
44 |
| - std::this_thread::sleep_for(std::chrono::seconds(2)); |
45 |
| - |
46 | 42 | ep.AsyncClose();
|
47 | 43 | t.join();
|
48 | 44 | }
|
0 commit comments