Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 45 additions & 6 deletions hazelcast/test/src/HazelcastTests5.cpp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dislike the magic 10 but as you've highlighted, it already exists in hazelcast.

Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,13 @@ TEST_P(ClientMapTest, testTryPutRemove)

TEST_P(ClientMapTest, testPutTtl)
{
if (client_.get_client_config().get_near_cache_config(imap_->get_name()) !=
nullptr) {
GTEST_SKIP_(
"Server side expiry does not send near cache invalidations. "
"See https://github.com/hazelcast/hazelcast/issues/10975");
}

validate_expiry_invalidations(imap_, [=]() {
imap_
->put<std::string, std::string>(
Expand All @@ -1182,6 +1189,13 @@ TEST_P(ClientMapTest, testPutTtl)

TEST_P(ClientMapTest, testPutConfigTtl)
{
if (client_.get_client_config().get_near_cache_config(
ONE_SECOND_MAP_NAME) != nullptr) {
GTEST_SKIP_(
"Server side expiry does not send near cache invalidations. "
"See https://github.com/hazelcast/hazelcast/issues/10975");
}

std::shared_ptr<imap> map = client_.get_map(ONE_SECOND_MAP_NAME).get();
validate_expiry_invalidations(map, [=]() {
map->put<std::string, std::string>("key1", "value1").get();
Expand All @@ -1201,9 +1215,16 @@ TEST_P(ClientMapTest, testPutIfAbsent)

TEST_P(ClientMapTest, testPutIfAbsentTtl)
{
if (client_.get_client_config().get_near_cache_config(imap_->get_name()) !=
nullptr) {
GTEST_SKIP_(
"Server side expiry does not send near cache invalidations. "
"See https://github.com/hazelcast/hazelcast/issues/10975");
}

ASSERT_FALSE((imap_
->put_if_absent<std::string, std::string>(
"key1", "value1", std::chrono::seconds(1))
"key1", "value1", std::chrono::seconds(10))
.get()
.has_value()));
ASSERT_EQ("value1",
Expand All @@ -1213,11 +1234,15 @@ TEST_P(ClientMapTest, testPutIfAbsentTtl)
.get()
.value()));

ASSERT_FALSE_EVENTUALLY((imap_
->put_if_absent<std::string, std::string>(
"key1", "value3", std::chrono::seconds(1))
.get()
.has_value()));
ASSERT_FALSE_EVENTUALLY(
(imap_->get<std::string, std::string>("key1").get().has_value()));

ASSERT_FALSE((imap_
->put_if_absent<std::string, std::string>(
"key1", "value3", std::chrono::seconds(10))
.get()
.has_value()));
Comment on lines +1240 to +1244
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this get reformatted?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line changed and used clang-format to format. do you mean the indentation of the lines?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean the indentation of the lines?

Yes.

The codebase should have a consistent format now so this shouldn't have needed to change. If it did, then there must be a tooling difference between our respective clang-formats?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh it changed. From ASSERT_FALSE -> ASSERT_FALSE_EVENTUALLY. Ignore me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


ASSERT_EQ("value3",
(imap_
->put_if_absent<std::string, std::string>(
Expand All @@ -1239,13 +1264,27 @@ TEST_P(ClientMapTest, testSet)

TEST_P(ClientMapTest, testSetTtl)
{
if (client_.get_client_config().get_near_cache_config(imap_->get_name()) !=
nullptr) {
GTEST_SKIP_(
"Server side expiry does not send near cache invalidations. "
"See https://github.com/hazelcast/hazelcast/issues/10975");
}

validate_expiry_invalidations(imap_, [=]() {
imap_->set("key1", "value1", std::chrono::seconds(1)).get();
});
}

TEST_P(ClientMapTest, testSetConfigTtl)
{
if (client_.get_client_config().get_near_cache_config(
ONE_SECOND_MAP_NAME) != nullptr) {
GTEST_SKIP_(
"Server side expiry does not send near cache invalidations. "
"See https://github.com/hazelcast/hazelcast/issues/10975");
}

std::shared_ptr<imap> map = client_.get_map(ONE_SECOND_MAP_NAME).get();
validate_expiry_invalidations(map,
[=]() { map->set("key1", "value1").get(); });
Expand Down
Loading