Fix flakiness in DefaultVhalImpl_test.
Test: atest android.hardware.automotive.vehicle@2.0-default-impl-unit-tests
Bug: 272569067
Change-Id: I54c45d80cf09d314cafbd30844e9fbe296de4986
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp
index b5026a6..edd4484 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp
@@ -756,8 +756,9 @@
// Clear existing events.
mEventQueue.flush();
std::this_thread::sleep_for(std::chrono::milliseconds(500));
- // There should be no new events generated.
- EXPECT_EQ((size_t)0, mEventQueue.flush().size());
+ // Technically there should be no new events generated, however, there might still be one event
+ // in the queue while we are stopping the generator.
+ EXPECT_LE(mEventQueue.flush().size(), 1u);
}
std::string getTestFilePath(const char* filename) {