• Home
Name Date Size #Lines LOC

..--

posix/04-Jul-2025-787643

tests/04-Jul-2025-1,7001,320

tools/04-Jul-2025-318222

BUILDD04-Jul-20254.4 KiB147135

README.mdD04-Jul-20252.4 KiB7255

cf_event_engine_test.ccD04-Jul-20251.8 KiB5330

event_engine_test_framework.ccD04-Jul-20251.3 KiB3819

event_engine_test_framework.hD04-Jul-20252.9 KiB9362

fuzzing_event_engine_test.ccD04-Jul-20251.3 KiB3516

posix_event_engine_native_dns_test.ccD04-Jul-20251.8 KiB5232

posix_event_engine_test.ccD04-Jul-20251.8 KiB5030

thready_posix_event_engine_test.ccD04-Jul-20252.1 KiB5535

windows_event_engine_test.ccD04-Jul-20251.5 KiB4724

README.md

1A reusable test suite for EventEngine implementations.
2
3# Customizing tests for your EventEngine implementation
4
5To exercise a custom EventEngine, create a new bazel test target that links
6against some set of targets in the `//test/core/event_engine/test_suite/tests/...`
7folder, and provide a testing `main` function that sets a custom EventEngine factory.
8
9Your custom test target will look something like:
10
11```
12grpc_cc_test(
13    name = "my_custom_event_engine_test",
14    srcs = ["my_custom_event_engine_test.cc"],
15    uses_polling = False,
16    deps = ["//test/core/event_engine/test_suite/tests:timer"],
17)
18```
19
20And the main function will be similar to:
21
22```
23#include "path/to/my_custom_event_engine.h"
24#include "test/core/event_engine/test_suite/event_engine_test_framework.h"
25
26int main(int argc, char** argv) {
27  testing::InitGoogleTest(&argc, argv);
28  SetEventEngineFactory(
29      []() { return absl::make_unique<MyCustomEventEngine>(); });
30  auto result = RUN_ALL_TESTS();
31  return result;
32}
33```
34
35Alternatively, if you only want to exercise a subset of the conformance tests,
36you could depend on any subset of the following:
37
38* `//test/core/event_engine/test_suite/tests:timer`
39* `//test/core/event_engine/test_suite/tests:dns`
40* `//test/core/event_engine/test_suite/tests:client`
41* `//test/core/event_engine/test_suite/tests:server`
42
43# Useful testing tools
44
45The suite also provides [tools](tools/) that let you exercise your custom EventEngine in other ways.
46For example, the `echo_client` library allows you to prop up a TCP echo client based on your EventEngine::Connect and ::Endpoint implementations, and communicate with a remote TCP listener of your choosing.
47
48You'll need to provide the following code
49
50```
51# tools/BUILD:
52grpc_cc_binary(
53    name = "my_event_engine_echo_client",
54    srcs = ["my_event_engine_factory.cc"],
55    deps = ["echo_client"],
56)
57
58# tools/my_event_engine_factory.cc: an implementation of CustomEventEngineFactory
59absl::AnyInvocable<
60    std::unique_ptr<grpc_event_engine::experimental::EventEngine>(void)>
61CustomEventEngineFactory() {
62  return []() {
63    return std::make_unique<
64        grpc_event_engine::experimental::WindowsEventEngine>();
65  };
66}
67```
68
69To exercise the echo client, run `bazel run //test/core/event_engine/test_suite/tools:my_event_engine_echo_client`, and in a separate terminal, open something like netcat to run a TCP listener and communicate with the client.
70
71Each tool is documented more fully in its source file.
72