Skip to content

Commit

Permalink
Fix ClientDeduplicationTest intermittent failure with parallel tests (a…
Browse files Browse the repository at this point in the history
…pache#777)

* Fix ClientDeduplicationTest intermittent failure with parallel tests

Fix apache#776

* Fixed url for creating namespace
  • Loading branch information
merlimat authored and rdhabalia committed Sep 21, 2017
1 parent c8487ef commit 79a7790
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions pulsar-client-cpp/tests/ClientDeduplicationTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ static std::string adminUrl = "http://localhost:8765/";
TEST(ClientDeduplicationTest, testProducerSequenceAfterReconnect) {
Client client(serviceUrl);

std::string topicName = "persistent://sample/standalone/ns1/testProducerSequenceAfterReconnect-"
std::string topicName = "persistent://sample/standalone/ns-dedup-1/testProducerSequenceAfterReconnect-"
+ boost::lexical_cast<std::string>(time(NULL));

// call admin api to make enable deduplication
std::string url = adminUrl + "admin/namespaces/sample/standalone/ns1/deduplication";
int res = makePostRequest(url, "true");
// call admin api to create namespace and enable deduplication
std::string url = adminUrl + "admin/namespaces/sample/standalone/ns-dedup-1";
int res = makePutRequest(url, "");
ASSERT_EQ(res, 204);

url = adminUrl + "admin/namespaces/sample/standalone/ns-dedup-1/deduplication";
res = makePostRequest(url, "true");
ASSERT_EQ(res, 204);

ReaderConfiguration readerConf;
Expand Down Expand Up @@ -77,12 +81,16 @@ TEST(ClientDeduplicationTest, testProducerSequenceAfterReconnect) {
TEST(ClientDeduplicationTest, testProducerDeduplication) {
Client client(serviceUrl);

std::string topicName = "persistent://sample/standalone/ns1/testProducerDeduplication-"
std::string topicName = "persistent://sample/standalone/ns-dedup-2/testProducerDeduplication-"
+ boost::lexical_cast<std::string>(time(NULL));

// call admin api to make enable deduplication
std::string url = adminUrl + "admin/namespaces/sample/standalone/ns1/deduplication";
int res = makePostRequest(url, "true");
// call admin api to create namespace and enable deduplication
std::string url = adminUrl + "admin/namespaces/sample/standalone/ns-dedup-2";
int res = makePutRequest(url, "");
ASSERT_EQ(res, 204);

url = adminUrl + "admin/namespaces/sample/standalone/ns-dedup-2/deduplication";
res = makePostRequest(url, "true");
ASSERT_EQ(res, 204);

ReaderConfiguration readerConf;
Expand Down Expand Up @@ -139,4 +147,3 @@ TEST(ClientDeduplicationTest, testProducerDeduplication) {

client.close();
}

0 comments on commit 79a7790

Please sign in to comment.