@@ -67,7 +67,7 @@ TEST_F(EventMemoryMonitorTest, TestNonexistentCgroupPathFailsGracefully) {
6767 std::string nonexistent_path = " /nonexistent/cgroup/path" ;
6868 StatusSetOr<std::unique_ptr<EventMemoryMonitor>, StatusT::IOError> result =
6969 EventMemoryMonitor::Create (std::move (nonexistent_path),
70- [](SystemMemorySnapshot) {});
70+ [](SystemMemorySnapshot, int64_t ) {});
7171
7272 ASSERT_TRUE (result.has_error ())
7373 << " Failed to catch invalid cgroup path when creating EventMemoryMonitor" ;
@@ -79,7 +79,8 @@ TEST_F(EventMemoryMonitorTest, TestMissingMemoryEventsFileFailsGracefully) {
7979 RAY_CHECK (empty_dir_or.ok ()) << empty_dir_or.status ().ToString ();
8080 std::unique_ptr<TempDirectory> empty_dir = std::move (empty_dir_or.value ());
8181 StatusSetOr<std::unique_ptr<EventMemoryMonitor>, StatusT::IOError> result =
82- EventMemoryMonitor::Create (empty_dir->GetPath (), [](SystemMemorySnapshot) {});
82+ EventMemoryMonitor::Create (empty_dir->GetPath (),
83+ [](SystemMemorySnapshot, int64_t ) {});
8384
8485 ASSERT_TRUE (result.has_error ())
8586 << " Failed to catch invalid cgroup configuration when creating EventMemoryMonitor" ;
@@ -89,7 +90,7 @@ TEST_F(EventMemoryMonitorTest, TestMissingMemoryEventsFileFailsGracefully) {
8990TEST_F (EventMemoryMonitorTest, TestSuccessfulCreationWithValidPath) {
9091 StatusSetOr<std::unique_ptr<EventMemoryMonitor>, StatusT::IOError> result =
9192 EventMemoryMonitor::Create (mock_cgroup_dir_->GetPath (),
92- [](SystemMemorySnapshot) {});
93+ [](SystemMemorySnapshot, int64_t ) {});
9394 ASSERT_TRUE (result.has_value ())
9495 << " Failed to create EventMemoryMonitor: " << result.message ();
9596 std::unique_ptr<EventMemoryMonitor> monitor = std::move (result.value ());
@@ -100,7 +101,11 @@ TEST_F(EventMemoryMonitorTest, TestCallbackCalledWhenHighEventChanges) {
100101 WriteMemoryEventsFile (events_file_->GetPath (), 0 , 0 );
101102
102103 auto callback_latch = std::make_shared<boost::latch>(1 );
103- KillWorkersCallback callback = [callback_latch](SystemMemorySnapshot) {
104+ KillWorkersCallback callback = [callback_latch](SystemMemorySnapshot,
105+ int64_t threshold_bytes) {
106+ EXPECT_EQ (threshold_bytes, MemoryMonitorInterface::kNull )
107+ << " EventMemoryMonitor is event-driven so it should report kNull as the "
108+ " threshold bytes." ;
104109 callback_latch->count_down ();
105110 };
106111
@@ -120,7 +125,7 @@ TEST_F(EventMemoryMonitorTest, TestNoCallbackWhenValuesUnchanged) {
120125 WriteMemoryEventsFile (events_file_->GetPath (), 0 , 0 );
121126
122127 auto callback_latch = std::make_shared<boost::latch>(1 );
123- KillWorkersCallback callback = [callback_latch](SystemMemorySnapshot) {
128+ KillWorkersCallback callback = [callback_latch](SystemMemorySnapshot, int64_t ) {
124129 callback_latch->count_down ();
125130 };
126131
@@ -139,7 +144,7 @@ TEST_F(EventMemoryMonitorTest, TestNoCallbackWhenIrrelevantEventChanges) {
139144 WriteMemoryEventsFile (events_file_->GetPath (), 0 , 0 );
140145
141146 auto callback_latch = std::make_shared<boost::latch>(1 );
142- KillWorkersCallback callback = [callback_latch](SystemMemorySnapshot) {
147+ KillWorkersCallback callback = [callback_latch](SystemMemorySnapshot, int64_t ) {
143148 callback_latch->count_down ();
144149 };
145150
@@ -161,17 +166,17 @@ TEST_F(EventMemoryMonitorTest, TestMultipleCallbacksOnMultipleChanges) {
161166 auto latch2 = std::make_shared<boost::latch>(1 );
162167 auto latch3 = std::make_shared<boost::latch>(1 );
163168 std::atomic<int > callback_count{0 };
164- KillWorkersCallback callback =
165- [&callback_count, latch1, latch2, latch3]( SystemMemorySnapshot) {
166- int count = ++callback_count;
167- if (count == 1 ) {
168- latch1->count_down ();
169- } else if (count == 2 ) {
170- latch2->count_down ();
171- } else if (count == 3 ) {
172- latch3->count_down ();
173- }
174- };
169+ KillWorkersCallback callback = [&callback_count, latch1, latch2, latch3](
170+ SystemMemorySnapshot, int64_t ) {
171+ int count = ++callback_count;
172+ if (count == 1 ) {
173+ latch1->count_down ();
174+ } else if (count == 2 ) {
175+ latch2->count_down ();
176+ } else if (count == 3 ) {
177+ latch3->count_down ();
178+ }
179+ };
175180
176181 StatusSetOr<std::unique_ptr<EventMemoryMonitor>, StatusT::IOError> result =
177182 EventMemoryMonitor::Create (mock_cgroup_dir_->GetPath (), callback);
0 commit comments