You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2022/08/13 23:11:13 UTC
[pulsar] branch master updated: test: print detail failure for testDeleteTopicAndSchemaForV1 (#17083)
This is an automated email from the ASF dual-hosted git repository.
penghui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new bedece7263c test: print detail failure for testDeleteTopicAndSchemaForV1 (#17083)
bedece7263c is described below
commit bedece7263c5cf437eaef1463f427c31e012f78e
Author: tison <wa...@gmail.com>
AuthorDate: Sun Aug 14 07:11:05 2022 +0800
test: print detail failure for testDeleteTopicAndSchemaForV1 (#17083)
---
.../src/test/java/org/apache/pulsar/schema/SchemaTest.java | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/schema/SchemaTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/schema/SchemaTest.java
index 46e0f5dfc73..5da60b800f7 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/schema/SchemaTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/schema/SchemaTest.java
@@ -20,6 +20,7 @@ package org.apache.pulsar.schema;
import static org.apache.pulsar.common.naming.TopicName.PUBLIC_TENANT;
import static org.apache.pulsar.schema.compatibility.SchemaCompatibilityCheckTest.randomName;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull;
@@ -37,6 +38,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
@@ -816,7 +818,7 @@ public class SchemaTest extends MockedPulsarServiceBaseTest {
} catch (Exception e) {
return null;
}
- }).collect(Collectors.toList());
+ }).filter(Objects::nonNull).toList();
assertEquals(schemas1.size(), 2);
for (SchemaRegistry.SchemaAndMetadata schema : schemas1) {
assertNotNull(schema);
@@ -831,7 +833,7 @@ public class SchemaTest extends MockedPulsarServiceBaseTest {
} catch (Exception e) {
return null;
}
- }).collect(Collectors.toList());
+ }).filter(Objects::nonNull).toList();
assertEquals(schemas2.size(), 1);
for (SchemaRegistry.SchemaAndMetadata schema : schemas2) {
assertNotNull(schema);
@@ -842,7 +844,9 @@ public class SchemaTest extends MockedPulsarServiceBaseTest {
admin.topics().delete(topic1, false);
fail();
} catch (Exception e) {
- assertTrue(e.getMessage().startsWith("Topic has active producers/subscriptions"));
+ assertThat(e.getMessage())
+ .isNotNull()
+ .startsWith("Topic has active producers/subscriptions");
}
assertEquals(this.getPulsar().getSchemaRegistryService()
.trimDeletedSchemaAndGetList(TopicName.get(topic1).getSchemaName()).get().size(), 2);
@@ -850,7 +854,9 @@ public class SchemaTest extends MockedPulsarServiceBaseTest {
admin.topics().deletePartitionedTopic(topic2, false);
fail();
} catch (Exception e) {
- assertTrue(e.getMessage().startsWith("Topic has active producers/subscriptions"));
+ assertThat(e.getMessage())
+ .isNotNull()
+ .startsWith("Topic has active producers/subscriptions");
}
assertEquals(this.getPulsar().getSchemaRegistryService()
.trimDeletedSchemaAndGetList(TopicName.get(topic2).getSchemaName()).get().size(), 1);