From 03192b5149beac7507fd90ba64693113cbe428cd Mon Sep 17 00:00:00 2001 From: druidliu Date: Tue, 18 Jul 2023 16:53:05 +0800 Subject: [PATCH 1/9] Add bookkeeperDeleted in topic internal stats. --- .../mledger/impl/ManagedLedgerImpl.java | 1 + .../service/persistent/PersistentTopic.java | 2 ++ .../data/ManagedLedgerInternalStats.java | 1 + .../integration/offload/TestBaseOffload.java | 24 +++++++++++++++++++ 4 files changed, 28 insertions(+) diff --git a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java index 10f7948f553cb..8df619650317f 100644 --- a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java +++ b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java @@ -4312,6 +4312,7 @@ public CompletableFuture getManagedLedgerInternalSta info.entries = li.getEntries(); info.size = li.getSize(); info.offloaded = li.hasOffloadContext() && li.getOffloadContext().getComplete(); + info.bookkeeperDeleted = li.hasOffloadContext() && li.getOffloadContext().getBookkeeperDeleted(); if (includeLedgerMetadata) { // lookup metadata from the hashmap which contains completed async operations info.metadata = ledgerMetadataFutures.get(li.getLedgerId()).getNow(null); diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java index 1e055eccc42f6..a66eab06413ad 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java @@ -2383,6 +2383,8 @@ public CompletableFuture getInternalStats(boolean info.entries = li.getEntries(); info.size = li.getSize(); info.offloaded = li.hasOffloadContext() && li.getOffloadContext().getComplete(); + info.bookkeeperDeleted = + li.hasOffloadContext() && li.getOffloadContext().getBookkeeperDeleted(); stats.ledgers.add(info); if (includeLedgerMetadata) { futures.add(ml.getLedgerMetadata(li.getLedgerId()).handle((lMetadata, ex) -> { diff --git a/pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/ManagedLedgerInternalStats.java b/pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/ManagedLedgerInternalStats.java index 95a45d37d9556..50db0e19d50f9 100644 --- a/pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/ManagedLedgerInternalStats.java +++ b/pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/ManagedLedgerInternalStats.java @@ -77,6 +77,7 @@ public static class LedgerInfo { public boolean offloaded; public String metadata; public boolean underReplicated; + public boolean bookkeeperDeleted; } /** diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/offload/TestBaseOffload.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/offload/TestBaseOffload.java index 7d38aa77bf027..0b9a8673ff668 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/offload/TestBaseOffload.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/offload/TestBaseOffload.java @@ -32,6 +32,7 @@ import org.apache.pulsar.client.api.Message; import org.apache.pulsar.client.api.Producer; import org.apache.pulsar.client.api.PulsarClient; +import org.apache.pulsar.common.policies.data.ManagedLedgerInternalStats; import org.apache.pulsar.common.policies.data.PersistentTopicInternalStats; import org.apache.pulsar.tests.integration.suites.PulsarTieredStorageTestSuite; import org.awaitility.Awaitility; @@ -304,12 +305,21 @@ protected void testPublishOffloadAndConsumeDeletionLag(String serviceUrl, String "namespaces", "get-offload-deletion-lag", namespace).getStdout(); Assert.assertTrue(output.contains("Unset for namespace")); + PulsarAdmin admin = PulsarAdmin.builder().serviceHttpUrl(adminUrl).build(); + long offloadedLedger = writeAndWaitForOffload(serviceUrl, adminUrl, topic); // give it up to 5 seconds to delete, it shouldn't // so we wait this every time Thread.sleep(5000); Assert.assertTrue(ledgerExistsInBookKeeper(offloadedLedger)); + long finalOffloadedLedger1 = offloadedLedger; + ManagedLedgerInternalStats.LedgerInfo offloadedLedgerInfo = + admin.topics().getInternalStats(topic).ledgers.stream() + .filter((x) -> x.ledgerId == finalOffloadedLedger1).findFirst().get(); + Assert.assertTrue(offloadedLedgerInfo.offloaded); + Assert.assertFalse(offloadedLedgerInfo.bookkeeperDeleted); + pulsarCluster.runAdminCommandOnAnyBroker("namespaces", "set-offload-deletion-lag", namespace, "--lag", "0m"); output = pulsarCluster.runAdminCommandOnAnyBroker( @@ -324,6 +334,12 @@ protected void testPublishOffloadAndConsumeDeletionLag(String serviceUrl, String } Assert.assertFalse(ledgerExistsInBookKeeper(offloadedLedger)); + long finalOffloadedLedger2 = offloadedLedger; + offloadedLedgerInfo = admin.topics().getInternalStats(topic).ledgers.stream() + .filter((x) -> x.ledgerId == finalOffloadedLedger2).findFirst().get(); + Assert.assertTrue(offloadedLedgerInfo.offloaded); + Assert.assertTrue(offloadedLedgerInfo.bookkeeperDeleted); + pulsarCluster.runAdminCommandOnAnyBroker("namespaces", "clear-offload-deletion-lag", namespace); Thread.sleep(5); // wait 5 seconds to allow broker to see update @@ -338,6 +354,14 @@ protected void testPublishOffloadAndConsumeDeletionLag(String serviceUrl, String // so we wait this every time Thread.sleep(5000); Assert.assertTrue(ledgerExistsInBookKeeper(offloadedLedger)); + + long finalOffloadedLedger3 = offloadedLedger; + offloadedLedgerInfo = admin.topics().getInternalStats(topic).ledgers.stream() + .filter((x) -> x.ledgerId == finalOffloadedLedger3).findFirst().get(); + Assert.assertTrue(offloadedLedgerInfo.offloaded); + Assert.assertFalse(offloadedLedgerInfo.bookkeeperDeleted); + + admin.close(); } protected void testDeleteOffloadedTopic(String serviceUrl, String adminUrl, From c6ca528244e5fe464bc0be4852b76e4b2b737923 Mon Sep 17 00:00:00 2001 From: druidliu Date: Wed, 17 Apr 2024 20:25:10 +0800 Subject: [PATCH 2/9] Add backward test cases. --- .../ClientOffloadTest3_0.java | 54 +++++++++++++++++++ .../containers/PulsarContainer.java | 1 + 2 files changed, 55 insertions(+) create mode 100644 tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/ClientOffloadTest3_0.java diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/ClientOffloadTest3_0.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/ClientOffloadTest3_0.java new file mode 100644 index 0000000000000..5c7fa87f01071 --- /dev/null +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/ClientOffloadTest3_0.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.pulsar.tests.integration.backwardscompatibility; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Supplier; +import org.apache.pulsar.tests.integration.containers.BrokerContainer; +import org.apache.pulsar.tests.integration.containers.PulsarContainer; +import org.apache.pulsar.tests.integration.offload.TestBaseOffload; +import org.testng.annotations.Test; + +public class ClientOffloadTest3_0 extends TestBaseOffload { + @Override + protected Map getEnv() { + Map result = new HashMap<>(); + result.put("managedLedgerMaxEntriesPerLedger", String.valueOf(getNumEntriesPerLedger())); + result.put("managedLedgerMinLedgerRolloverTimeMinutes", "0"); + result.put("managedLedgerOffloadDriver", "filesystem"); + result.put("fileSystemURI", "file:///tmp"); + + return result; + } + + @Override + protected void beforeStartCluster() throws Exception { + super.beforeStartCluster(); + for (BrokerContainer brokerContainer : pulsarCluster.getBrokers()) { + brokerContainer.setDockerImageName(PulsarContainer.PULSAR_3_0_IMAGE_NAME); + } + } + + @Test(dataProvider = "ServiceAndAdminUrls") + public void testPublishOffloadAndConsumeDeletionLag(Supplier serviceUrl, Supplier adminUrl) + throws Exception { + super.testPublishOffloadAndConsumeDeletionLag(serviceUrl.get(), adminUrl.get()); + } +} diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/PulsarContainer.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/PulsarContainer.java index 77cdc1bfd28a9..585da32f985d7 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/PulsarContainer.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/PulsarContainer.java @@ -54,6 +54,7 @@ public abstract class PulsarContainer> exte public static final String DEFAULT_IMAGE_NAME = System.getenv().getOrDefault("PULSAR_TEST_IMAGE_NAME", "apachepulsar/pulsar-test-latest-version:latest"); public static final String DEFAULT_HTTP_PATH = "/metrics"; + public static final String PULSAR_3_0_IMAGE_NAME = "apachepulsar/pulsar:3.0.0"; public static final String PULSAR_2_5_IMAGE_NAME = "apachepulsar/pulsar:2.5.0"; public static final String PULSAR_2_4_IMAGE_NAME = "apachepulsar/pulsar:2.4.0"; public static final String PULSAR_2_3_IMAGE_NAME = "apachepulsar/pulsar:2.3.0"; From 5a1668e2db8d671038c2294190d4624a9fd217e5 Mon Sep 17 00:00:00 2001 From: druidliu Date: Thu, 18 Apr 2024 11:19:04 +0800 Subject: [PATCH 3/9] Add backward test cases. --- .../ClientOffloadTest3_0.java | 84 ++++++++++++++++++- .../integration/offload/TestBaseOffload.java | 2 +- .../pulsar-backwards-compatibility.xml | 1 + 3 files changed, 85 insertions(+), 2 deletions(-) diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/ClientOffloadTest3_0.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/ClientOffloadTest3_0.java index 5c7fa87f01071..08ca81f590580 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/ClientOffloadTest3_0.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/ClientOffloadTest3_0.java @@ -21,9 +21,13 @@ import java.util.HashMap; import java.util.Map; import java.util.function.Supplier; + +import org.apache.pulsar.client.admin.PulsarAdmin; +import org.apache.pulsar.common.policies.data.ManagedLedgerInternalStats; import org.apache.pulsar.tests.integration.containers.BrokerContainer; import org.apache.pulsar.tests.integration.containers.PulsarContainer; import org.apache.pulsar.tests.integration.offload.TestBaseOffload; +import org.testng.Assert; import org.testng.annotations.Test; public class ClientOffloadTest3_0 extends TestBaseOffload { @@ -49,6 +53,84 @@ protected void beforeStartCluster() throws Exception { @Test(dataProvider = "ServiceAndAdminUrls") public void testPublishOffloadAndConsumeDeletionLag(Supplier serviceUrl, Supplier adminUrl) throws Exception { - super.testPublishOffloadAndConsumeDeletionLag(serviceUrl.get(), adminUrl.get()); + final String tenant = "offload-test-deletion-lag-" + randomName(4); + final String namespace = tenant + "/ns1"; + final String topic = "persistent://" + namespace + "/topic1"; + + pulsarCluster.runAdminCommandOnAnyBroker("tenants", + "create", "--allowed-clusters", pulsarCluster.getClusterName(), + "--admin-roles", "offload-admin", tenant); + + pulsarCluster.runAdminCommandOnAnyBroker("namespaces", + "create", "--clusters", pulsarCluster.getClusterName(), namespace); + + // set threshold to offload runs immediately after role + pulsarCluster.runAdminCommandOnAnyBroker("namespaces", + "set-offload-threshold", "--size", "0", namespace); + + String output = pulsarCluster.runAdminCommandOnAnyBroker( + "namespaces", "get-offload-deletion-lag", namespace).getStdout(); + Assert.assertTrue(output.contains("Unset for namespace")); + + PulsarAdmin admin = PulsarAdmin.builder().serviceHttpUrl(adminUrl.get()).build(); + + long offloadedLedger = writeAndWaitForOffload(serviceUrl.get(), adminUrl.get(), topic); + // give it up to 5 seconds to delete, it shouldn't + // so we wait this every time + Thread.sleep(5000); + Assert.assertTrue(ledgerExistsInBookKeeper(offloadedLedger)); + + long finalOffloadedLedger1 = offloadedLedger; + ManagedLedgerInternalStats.LedgerInfo offloadedLedgerInfo = + admin.topics().getInternalStats(topic).ledgers.stream() + .filter((x) -> x.ledgerId == finalOffloadedLedger1).findFirst().get(); + Assert.assertTrue(offloadedLedgerInfo.offloaded); + Assert.assertFalse(offloadedLedgerInfo.bookkeeperDeleted); + + pulsarCluster.runAdminCommandOnAnyBroker("namespaces", "set-offload-deletion-lag", namespace, + "--lag", "0m"); + output = pulsarCluster.runAdminCommandOnAnyBroker( + "namespaces", "get-offload-deletion-lag", namespace).getStdout(); + Assert.assertTrue(output.contains("0 minute(s)")); + + offloadedLedger = writeAndWaitForOffload(serviceUrl.get(), adminUrl.get(), topic); + // wait up to 10 seconds for ledger to be deleted + for (int i = 0; i < 10 && ledgerExistsInBookKeeper(offloadedLedger); i++) { + writeAndWaitForOffload(serviceUrl.get(), adminUrl.get(), topic); + Thread.sleep(1000); + } + Assert.assertFalse(ledgerExistsInBookKeeper(offloadedLedger)); + + long finalOffloadedLedger2 = offloadedLedger; + offloadedLedgerInfo = admin.topics().getInternalStats(topic).ledgers.stream() + .filter((x) -> x.ledgerId == finalOffloadedLedger2).findFirst().get(); + Assert.assertTrue(offloadedLedgerInfo.offloaded); + + // old version server, new version client + // the new field `bookkeeperDeleted` should always be false + Assert.assertFalse(offloadedLedgerInfo.bookkeeperDeleted); + + pulsarCluster.runAdminCommandOnAnyBroker("namespaces", "clear-offload-deletion-lag", namespace); + + Thread.sleep(5); // wait 5 seconds to allow broker to see update + + output = pulsarCluster.runAdminCommandOnAnyBroker( + "namespaces", "get-offload-deletion-lag", namespace).getStdout(); + Assert.assertTrue(output.contains("Unset for namespace")); + + offloadedLedger = writeAndWaitForOffload(serviceUrl.get(), adminUrl.get(), topic); + + // give it up to 5 seconds to delete, it shouldn't + // so we wait this every time + Thread.sleep(5000); + Assert.assertTrue(ledgerExistsInBookKeeper(offloadedLedger)); + + long finalOffloadedLedger3 = offloadedLedger; + offloadedLedgerInfo = admin.topics().getInternalStats(topic).ledgers.stream() + .filter((x) -> x.ledgerId == finalOffloadedLedger3).findFirst().get(); + Assert.assertTrue(offloadedLedgerInfo.offloaded); + Assert.assertFalse(offloadedLedgerInfo.bookkeeperDeleted); + + admin.close(); } } diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/offload/TestBaseOffload.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/offload/TestBaseOffload.java index 0b9a8673ff668..65815c1a05dbc 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/offload/TestBaseOffload.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/offload/TestBaseOffload.java @@ -220,7 +220,7 @@ private boolean ledgerOffloaded(List le .map(l -> l.offloaded).findFirst().get(); } - private long writeAndWaitForOffload(String serviceUrl, String adminUrl, String topic) + protected long writeAndWaitForOffload(String serviceUrl, String adminUrl, String topic) throws Exception { return writeAndWaitForOffload(serviceUrl, adminUrl, topic, -1); } diff --git a/tests/integration/src/test/resources/pulsar-backwards-compatibility.xml b/tests/integration/src/test/resources/pulsar-backwards-compatibility.xml index b50af74ed17f0..ba3cdfeb38d08 100644 --- a/tests/integration/src/test/resources/pulsar-backwards-compatibility.xml +++ b/tests/integration/src/test/resources/pulsar-backwards-compatibility.xml @@ -30,6 +30,7 @@ + \ No newline at end of file From 5411b3d1e389ee03be6ec4f6d90a539f406f7eb9 Mon Sep 17 00:00:00 2001 From: druidliu Date: Tue, 23 Apr 2024 16:49:09 +0800 Subject: [PATCH 4/9] Add backward test cases. --- ...> TestFileSystemOffloadWithClient3_0.java} | 17 +- .../TestFileSystemOffloadWithServer3_0.java | 162 ++++++++++++++++++ .../integration/containers/NoopContainer.java | 48 ++++++ .../pulsar-backwards-compatibility.xml | 2 +- 4 files changed, 218 insertions(+), 11 deletions(-) rename tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/{ClientOffloadTest3_0.java => TestFileSystemOffloadWithClient3_0.java} (94%) create mode 100644 tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithServer3_0.java create mode 100644 tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/NoopContainer.java diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/ClientOffloadTest3_0.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithClient3_0.java similarity index 94% rename from tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/ClientOffloadTest3_0.java rename to tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithClient3_0.java index 08ca81f590580..df539bbb696de 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/ClientOffloadTest3_0.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithClient3_0.java @@ -18,19 +18,18 @@ */ package org.apache.pulsar.tests.integration.backwardscompatibility; -import java.util.HashMap; -import java.util.Map; -import java.util.function.Supplier; - import org.apache.pulsar.client.admin.PulsarAdmin; import org.apache.pulsar.common.policies.data.ManagedLedgerInternalStats; -import org.apache.pulsar.tests.integration.containers.BrokerContainer; import org.apache.pulsar.tests.integration.containers.PulsarContainer; import org.apache.pulsar.tests.integration.offload.TestBaseOffload; import org.testng.Assert; import org.testng.annotations.Test; -public class ClientOffloadTest3_0 extends TestBaseOffload { +import java.util.HashMap; +import java.util.Map; +import java.util.function.Supplier; + +public class TestFileSystemOffloadWithClient3_0 extends TestBaseOffload { @Override protected Map getEnv() { Map result = new HashMap<>(); @@ -45,9 +44,7 @@ protected Map getEnv() { @Override protected void beforeStartCluster() throws Exception { super.beforeStartCluster(); - for (BrokerContainer brokerContainer : pulsarCluster.getBrokers()) { - brokerContainer.setDockerImageName(PulsarContainer.PULSAR_3_0_IMAGE_NAME); - } + pulsarCluster.getProxy().setDockerImageName(PulsarContainer.PULSAR_3_0_IMAGE_NAME); } @Test(dataProvider = "ServiceAndAdminUrls") @@ -106,7 +103,7 @@ public void testPublishOffloadAndConsumeDeletionLag(Supplier serviceUrl, .filter((x) -> x.ledgerId == finalOffloadedLedger2).findFirst().get(); Assert.assertTrue(offloadedLedgerInfo.offloaded); - // old version server, new version client + // old version (3.0.0) server, new version client // the new field `bookkeeperDeleted` should always be false Assert.assertFalse(offloadedLedgerInfo.bookkeeperDeleted); diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithServer3_0.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithServer3_0.java new file mode 100644 index 0000000000000..8432a6df59377 --- /dev/null +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithServer3_0.java @@ -0,0 +1,162 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.pulsar.tests.integration.backwardscompatibility; + +import static org.apache.pulsar.tests.integration.containers.PulsarContainer.CS_PORT; +import static org.apache.pulsar.tests.integration.containers.PulsarContainer.PULSAR_3_0_IMAGE_NAME; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Supplier; + +import org.apache.pulsar.client.admin.PulsarAdmin; +import org.apache.pulsar.common.policies.data.ManagedLedgerInternalStats; +import org.apache.pulsar.common.policies.data.PersistentTopicInternalStats; +import org.apache.pulsar.tests.integration.containers.CSContainer; +import org.apache.pulsar.tests.integration.containers.NoopContainer; +import org.apache.pulsar.tests.integration.containers.ZKContainer; +import org.apache.pulsar.tests.integration.offload.TestBaseOffload; +import org.apache.pulsar.tests.integration.topologies.PulsarCluster; +import org.apache.pulsar.tests.integration.topologies.PulsarClusterSpec; +import org.testng.Assert; +import org.testng.annotations.Test; + +/** + * Test new version server and old version client. + */ +public class TestFileSystemOffloadWithServer3_0 extends TestBaseOffload { + + private NoopContainer toolsetContainer; + + @Override + protected Map getEnv() { + Map result = new HashMap<>(); + result.put("managedLedgerMaxEntriesPerLedger", String.valueOf(getNumEntriesPerLedger())); + result.put("managedLedgerMinLedgerRolloverTimeMinutes", "0"); + result.put("managedLedgerOffloadDriver", "filesystem"); + result.put("fileSystemURI", "file:///tmp"); + + return result; + } + + @Override + protected void beforeStartCluster() throws Exception { + super.beforeStartCluster(); + + PulsarClusterSpec spec = this.getPulsarCluster().getSpec(); + String clusterName = spec.clusterName(); + + toolsetContainer = new NoopContainer(clusterName, clusterName + "-" + NoopContainer.NAME, PULSAR_3_0_IMAGE_NAME) + .withEnv("metadataStoreUrl", ZKContainer.NAME) + .withEnv("configurationMetadataStoreUrl", CSContainer.NAME + ":" + CS_PORT) + .withEnv("clusterName", clusterName); + toolsetContainer.start(); + } + + @Test(dataProvider = "ServiceAndAdminUrls") + public void testPublishOffloadAndConsumeDeletionLag(Supplier serviceUrl, Supplier adminUrl) + throws Exception { + final String tenant = "offload-test-deletion-lag-" + randomName(4); + final String namespace = tenant + "/ns1"; + final String topic = "persistent://" + namespace + "/topic1"; + + pulsarCluster.runAdminCommandOnAnyBroker("tenants", + "create", "--allowed-clusters", pulsarCluster.getClusterName(), + "--admin-roles", "offload-admin", tenant); + + pulsarCluster.runAdminCommandOnAnyBroker("namespaces", + "create", "--clusters", pulsarCluster.getClusterName(), namespace); + + // set threshold to offload runs immediately after role + pulsarCluster.runAdminCommandOnAnyBroker("namespaces", + "set-offload-threshold", "--size", "0", namespace); + + String output = pulsarCluster.runAdminCommandOnAnyBroker( + "namespaces", "get-offload-deletion-lag", namespace).getStdout(); + Assert.assertTrue(output.contains("Unset for namespace")); + + PulsarAdmin admin = PulsarAdmin.builder().serviceHttpUrl(adminUrl.get()).build(); + + long offloadedLedger = writeAndWaitForOffload(serviceUrl.get(), adminUrl.get(), topic); + // give it up to 5 seconds to delete, it shouldn't + // so we wait this every time + Thread.sleep(5000); + Assert.assertTrue(ledgerExistsInBookKeeper(offloadedLedger)); + + long finalOffloadedLedger1 = offloadedLedger; + ManagedLedgerInternalStats.LedgerInfo offloadedLedgerInfo = + admin.topics().getInternalStats(topic).ledgers.stream() + .filter((x) -> x.ledgerId == finalOffloadedLedger1).findFirst().get(); + Assert.assertTrue(offloadedLedgerInfo.offloaded); + Assert.assertFalse(offloadedLedgerInfo.bookkeeperDeleted); + + pulsarCluster.runAdminCommandOnAnyBroker("namespaces", "set-offload-deletion-lag", namespace, + "--lag", "0m"); + output = pulsarCluster.runAdminCommandOnAnyBroker( + "namespaces", "get-offload-deletion-lag", namespace).getStdout(); + Assert.assertTrue(output.contains("0 minute(s)")); + + offloadedLedger = writeAndWaitForOffload(serviceUrl.get(), adminUrl.get(), topic); + // wait up to 10 seconds for ledger to be deleted + for (int i = 0; i < 10 && ledgerExistsInBookKeeper(offloadedLedger); i++) { + writeAndWaitForOffload(serviceUrl.get(), adminUrl.get(), topic); + Thread.sleep(1000); + } + Assert.assertFalse(ledgerExistsInBookKeeper(offloadedLedger)); + + long finalOffloadedLedger2 = offloadedLedger; + offloadedLedgerInfo = admin.topics().getInternalStats(topic).ledgers.stream() + .filter((x) -> x.ledgerId == finalOffloadedLedger2).findFirst().get(); + Assert.assertTrue(offloadedLedgerInfo.offloaded); + Assert.assertTrue(offloadedLedgerInfo.bookkeeperDeleted); + + output = toolsetContainer.execCmd(PulsarCluster.ADMIN_SCRIPT, "topics", "stats-internal", topic).getStdout(); + // old version client should not recognize `bookkeeperDeleted` + Assert.assertFalse(output.contains("bookkeeperDeleted")); + PersistentTopicInternalStats topicInternalStats = + jsonMapper().readValue(output, PersistentTopicInternalStats.class); + offloadedLedgerInfo = topicInternalStats.ledgers.stream() + .filter((x) -> x.ledgerId == finalOffloadedLedger2).findFirst().get(); + Assert.assertTrue(offloadedLedgerInfo.offloaded); + // old version client should not recognize `bookkeeperDeleted`, so should be default value `False` + Assert.assertFalse(offloadedLedgerInfo.bookkeeperDeleted); + + pulsarCluster.runAdminCommandOnAnyBroker("namespaces", "clear-offload-deletion-lag", namespace); + + Thread.sleep(5); // wait 5 seconds to allow broker to see update + + output = pulsarCluster.runAdminCommandOnAnyBroker( + "namespaces", "get-offload-deletion-lag", namespace).getStdout(); + Assert.assertTrue(output.contains("Unset for namespace")); + + offloadedLedger = writeAndWaitForOffload(serviceUrl.get(), adminUrl.get(), topic); + + // give it up to 5 seconds to delete, it shouldn't + // so we wait this every time + Thread.sleep(5000); + Assert.assertTrue(ledgerExistsInBookKeeper(offloadedLedger)); + + long finalOffloadedLedger3 = offloadedLedger; + offloadedLedgerInfo = admin.topics().getInternalStats(topic).ledgers.stream() + .filter((x) -> x.ledgerId == finalOffloadedLedger3).findFirst().get(); + Assert.assertTrue(offloadedLedgerInfo.offloaded); + Assert.assertFalse(offloadedLedgerInfo.bookkeeperDeleted); + + admin.close(); + } +} diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/NoopContainer.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/NoopContainer.java new file mode 100644 index 0000000000000..aa0a9ece4d2a1 --- /dev/null +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/NoopContainer.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.pulsar.tests.integration.containers; + +/** + * A pulsar container that runs nothing. + */ +public class NoopContainer extends PulsarContainer { + + public static final String NAME = "toolset"; + + public NoopContainer(String clusterName, String hostName, String imageName) { + this(clusterName, hostName, false, imageName); + } + + + public NoopContainer(String clusterName, String hostName) { + this(clusterName, hostName, false, DEFAULT_IMAGE_NAME); + } + + public NoopContainer(String clusterName, String hostName, boolean enableTls, String imageName) { + super(clusterName, hostName, hostName, "sleep infinity", BROKER_PORT, + enableTls ? BROKER_PORT_TLS : 0, BROKER_HTTP_PORT, + enableTls ? BROKER_HTTPS_PORT : 0, DEFAULT_HTTP_PATH, imageName); + tailContainerLog(); + } + + public String getHostName() { + return super.hostname; + } + +} diff --git a/tests/integration/src/test/resources/pulsar-backwards-compatibility.xml b/tests/integration/src/test/resources/pulsar-backwards-compatibility.xml index ba3cdfeb38d08..48a2a800745e8 100644 --- a/tests/integration/src/test/resources/pulsar-backwards-compatibility.xml +++ b/tests/integration/src/test/resources/pulsar-backwards-compatibility.xml @@ -30,7 +30,7 @@ - + \ No newline at end of file From 16009758398e6fdfe5fb9f9fb9b24e6e3eb81457 Mon Sep 17 00:00:00 2001 From: druidliu Date: Tue, 23 Apr 2024 18:27:09 +0800 Subject: [PATCH 5/9] Add backward test cases. --- .../TestFileSystemOffloadWithServer3_0.java | 6 ++-- ...opContainer.java => ToolsetContainer.java} | 34 ++++++++++--------- 2 files changed, 21 insertions(+), 19 deletions(-) rename tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/{NoopContainer.java => ToolsetContainer.java} (55%) diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithServer3_0.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithServer3_0.java index 8432a6df59377..cfe88bb5da207 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithServer3_0.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithServer3_0.java @@ -28,7 +28,7 @@ import org.apache.pulsar.common.policies.data.ManagedLedgerInternalStats; import org.apache.pulsar.common.policies.data.PersistentTopicInternalStats; import org.apache.pulsar.tests.integration.containers.CSContainer; -import org.apache.pulsar.tests.integration.containers.NoopContainer; +import org.apache.pulsar.tests.integration.containers.ToolsetContainer; import org.apache.pulsar.tests.integration.containers.ZKContainer; import org.apache.pulsar.tests.integration.offload.TestBaseOffload; import org.apache.pulsar.tests.integration.topologies.PulsarCluster; @@ -41,7 +41,7 @@ */ public class TestFileSystemOffloadWithServer3_0 extends TestBaseOffload { - private NoopContainer toolsetContainer; + private ToolsetContainer toolsetContainer; @Override protected Map getEnv() { @@ -61,7 +61,7 @@ protected void beforeStartCluster() throws Exception { PulsarClusterSpec spec = this.getPulsarCluster().getSpec(); String clusterName = spec.clusterName(); - toolsetContainer = new NoopContainer(clusterName, clusterName + "-" + NoopContainer.NAME, PULSAR_3_0_IMAGE_NAME) + toolsetContainer = new ToolsetContainer(clusterName, PULSAR_3_0_IMAGE_NAME) .withEnv("metadataStoreUrl", ZKContainer.NAME) .withEnv("configurationMetadataStoreUrl", CSContainer.NAME + ":" + CS_PORT) .withEnv("clusterName", clusterName); diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/NoopContainer.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ToolsetContainer.java similarity index 55% rename from tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/NoopContainer.java rename to tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ToolsetContainer.java index aa0a9ece4d2a1..442873d069d8f 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/NoopContainer.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ToolsetContainer.java @@ -18,31 +18,33 @@ */ package org.apache.pulsar.tests.integration.containers; +import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy; + /** * A pulsar container that runs nothing. */ -public class NoopContainer extends PulsarContainer { +public class ToolsetContainer extends ChaosContainer { public static final String NAME = "toolset"; - public NoopContainer(String clusterName, String hostName, String imageName) { - this(clusterName, hostName, false, imageName); + public ToolsetContainer(String clusterName, String imageName) { + super(clusterName, imageName); } - - public NoopContainer(String clusterName, String hostName) { - this(clusterName, hostName, false, DEFAULT_IMAGE_NAME); + @Override + public String getContainerName() { + return clusterName + "-" + NAME; } - public NoopContainer(String clusterName, String hostName, boolean enableTls, String imageName) { - super(clusterName, hostName, hostName, "sleep infinity", BROKER_PORT, - enableTls ? BROKER_PORT_TLS : 0, BROKER_HTTP_PORT, - enableTls ? BROKER_HTTPS_PORT : 0, DEFAULT_HTTP_PATH, imageName); - tailContainerLog(); + @Override + protected void configure() { + super.configure(); + this.withNetworkAliases(NAME) + .withCreateContainerCmdModifier(createContainerCmd -> { + createContainerCmd.withHostName(NAME); + createContainerCmd.withName(getContainerName()); + createContainerCmd.withCmd("sleep", "infinity"); + }) + .waitingFor(new HostPortWaitStrategy()); } - - public String getHostName() { - return super.hostname; - } - } From 800af2570993c11c8bf2a5444724319fdaf0ac6a Mon Sep 17 00:00:00 2001 From: druidliu Date: Tue, 23 Apr 2024 19:15:07 +0800 Subject: [PATCH 6/9] Add backward test cases. --- .../pulsar/tests/integration/containers/ToolsetContainer.java | 2 +- .../src/test/resources/pulsar-backwards-compatibility.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ToolsetContainer.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ToolsetContainer.java index 442873d069d8f..75d2606287bab 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ToolsetContainer.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ToolsetContainer.java @@ -43,7 +43,7 @@ protected void configure() { .withCreateContainerCmdModifier(createContainerCmd -> { createContainerCmd.withHostName(NAME); createContainerCmd.withName(getContainerName()); - createContainerCmd.withCmd("sleep", "infinity"); + createContainerCmd.withEntrypoint("sleep", "infinity"); }) .waitingFor(new HostPortWaitStrategy()); } diff --git a/tests/integration/src/test/resources/pulsar-backwards-compatibility.xml b/tests/integration/src/test/resources/pulsar-backwards-compatibility.xml index 48a2a800745e8..dd5755c78e78c 100644 --- a/tests/integration/src/test/resources/pulsar-backwards-compatibility.xml +++ b/tests/integration/src/test/resources/pulsar-backwards-compatibility.xml @@ -22,6 +22,7 @@ + @@ -30,7 +31,6 @@ - \ No newline at end of file From 84597d82f202f555562a9de687d5b0a6ee759304 Mon Sep 17 00:00:00 2001 From: druidliu Date: Wed, 24 Apr 2024 10:16:28 +0800 Subject: [PATCH 7/9] Add backward test cases. --- .../tests/integration/containers/ToolsetContainer.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ToolsetContainer.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ToolsetContainer.java index 75d2606287bab..8997c232ef560 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ToolsetContainer.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ToolsetContainer.java @@ -18,7 +18,7 @@ */ package org.apache.pulsar.tests.integration.containers; -import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy; +import static org.apache.pulsar.tests.integration.containers.PulsarContainer.DEFAULT_IMAGE_NAME; /** * A pulsar container that runs nothing. @@ -27,6 +27,10 @@ public class ToolsetContainer extends ChaosContainer { public static final String NAME = "toolset"; + public ToolsetContainer(String clusterName) { + super(clusterName, DEFAULT_IMAGE_NAME); + } + public ToolsetContainer(String clusterName, String imageName) { super(clusterName, imageName); } @@ -44,7 +48,6 @@ protected void configure() { createContainerCmd.withHostName(NAME); createContainerCmd.withName(getContainerName()); createContainerCmd.withEntrypoint("sleep", "infinity"); - }) - .waitingFor(new HostPortWaitStrategy()); + }); } } From 52e3aca86f3dd72358111234fe8b20eeb9fa9255 Mon Sep 17 00:00:00 2001 From: druidliu Date: Wed, 24 Apr 2024 10:55:07 +0800 Subject: [PATCH 8/9] Add backward test cases. --- .../TestFileSystemOffload2.java | 57 +++++++++++++++++++ .../TestFileSystemOffloadWithServer3_0.java | 10 +++- .../containers/ToolsetContainer.java | 9 +++ .../suites/PulsarTieredStorageTestSuite.java | 2 +- .../pulsar-backwards-compatibility.xml | 1 + 5 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffload2.java diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffload2.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffload2.java new file mode 100644 index 0000000000000..49ce19fdb5edb --- /dev/null +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffload2.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.pulsar.tests.integration.backwardscompatibility; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Supplier; +import lombok.extern.slf4j.Slf4j; +import org.apache.pulsar.tests.integration.offload.TestBaseOffload; +import org.testng.annotations.Test; + +@Slf4j +public class TestFileSystemOffload2 extends TestBaseOffload { + + @Test(dataProvider = "ServiceAndAdminUrls") + public void testPublishOffloadAndConsumeViaCLI(Supplier serviceUrl, Supplier adminUrl) throws Exception { + super.testPublishOffloadAndConsumeViaCLI(serviceUrl.get(), adminUrl.get()); + } + + @Test(dataProvider = "ServiceAndAdminUrls") + public void testPublishOffloadAndConsumeViaThreshold(Supplier serviceUrl, Supplier adminUrl) throws Exception { + super.testPublishOffloadAndConsumeViaThreshold(serviceUrl.get(), adminUrl.get()); + } + + @Test(dataProvider = "ServiceAndAdminUrls") + public void testPublishOffloadAndConsumeDeletionLag(Supplier serviceUrl, Supplier adminUrl) throws Exception { + super.testPublishOffloadAndConsumeDeletionLag(serviceUrl.get(), adminUrl.get()); + } + + @Override + protected Map getEnv() { + Map result = new HashMap<>(); + result.put("managedLedgerMaxEntriesPerLedger", String.valueOf(getNumEntriesPerLedger())); + result.put("managedLedgerMinLedgerRolloverTimeMinutes", "0"); + result.put("managedLedgerOffloadDriver", "filesystem"); + result.put("fileSystemURI", "file:///tmp"); + + return result; + } + +} diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithServer3_0.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithServer3_0.java index cfe88bb5da207..7abb73b16f111 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithServer3_0.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithServer3_0.java @@ -68,6 +68,14 @@ protected void beforeStartCluster() throws Exception { toolsetContainer.start(); } + @Override + public void tearDownCluster() throws Exception { + super.tearDownCluster(); + if (toolsetContainer != null) { + toolsetContainer.stop(); + } + } + @Test(dataProvider = "ServiceAndAdminUrls") public void testPublishOffloadAndConsumeDeletionLag(Supplier serviceUrl, Supplier adminUrl) throws Exception { @@ -125,7 +133,7 @@ public void testPublishOffloadAndConsumeDeletionLag(Supplier serviceUrl, Assert.assertTrue(offloadedLedgerInfo.offloaded); Assert.assertTrue(offloadedLedgerInfo.bookkeeperDeleted); - output = toolsetContainer.execCmd(PulsarCluster.ADMIN_SCRIPT, "topics", "stats-internal", topic).getStdout(); + output = toolsetContainer.runAdminCommand("topics", "stats-internal", topic).getStdout(); // old version client should not recognize `bookkeeperDeleted` Assert.assertFalse(output.contains("bookkeeperDeleted")); PersistentTopicInternalStats topicInternalStats = diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ToolsetContainer.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ToolsetContainer.java index 8997c232ef560..2a58e794b1043 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ToolsetContainer.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ToolsetContainer.java @@ -19,6 +19,8 @@ package org.apache.pulsar.tests.integration.containers; import static org.apache.pulsar.tests.integration.containers.PulsarContainer.DEFAULT_IMAGE_NAME; +import static org.apache.pulsar.tests.integration.topologies.PulsarCluster.ADMIN_SCRIPT; +import org.apache.pulsar.tests.integration.docker.ContainerExecResult; /** * A pulsar container that runs nothing. @@ -50,4 +52,11 @@ protected void configure() { createContainerCmd.withEntrypoint("sleep", "infinity"); }); } + + public ContainerExecResult runAdminCommand(String... commands) throws Exception { + String[] cmds = new String[commands.length + 1]; + cmds[0] = ADMIN_SCRIPT; + System.arraycopy(commands, 0, cmds, 1, commands.length); + return this.execCmd(cmds); + } } diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/suites/PulsarTieredStorageTestSuite.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/suites/PulsarTieredStorageTestSuite.java index 6bf4061760b01..6668a01299340 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/suites/PulsarTieredStorageTestSuite.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/suites/PulsarTieredStorageTestSuite.java @@ -53,7 +53,7 @@ public final void setupCluster() throws Exception { @AfterClass(alwaysRun = true) @Override - public final void tearDownCluster() throws Exception { + public void tearDownCluster() throws Exception { super.tearDownCluster(); } diff --git a/tests/integration/src/test/resources/pulsar-backwards-compatibility.xml b/tests/integration/src/test/resources/pulsar-backwards-compatibility.xml index dd5755c78e78c..87f8276b147ba 100644 --- a/tests/integration/src/test/resources/pulsar-backwards-compatibility.xml +++ b/tests/integration/src/test/resources/pulsar-backwards-compatibility.xml @@ -22,6 +22,7 @@ + From fe144e78ba62cf631b682111bcfda00c2fe4f927 Mon Sep 17 00:00:00 2001 From: druidliu Date: Wed, 24 Apr 2024 11:08:15 +0800 Subject: [PATCH 9/9] Add backward test cases. --- .../TestFileSystemOffloadWithServer3_0.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithServer3_0.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithServer3_0.java index 7abb73b16f111..1555b45693cc5 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithServer3_0.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/TestFileSystemOffloadWithServer3_0.java @@ -31,8 +31,6 @@ import org.apache.pulsar.tests.integration.containers.ToolsetContainer; import org.apache.pulsar.tests.integration.containers.ZKContainer; import org.apache.pulsar.tests.integration.offload.TestBaseOffload; -import org.apache.pulsar.tests.integration.topologies.PulsarCluster; -import org.apache.pulsar.tests.integration.topologies.PulsarClusterSpec; import org.testng.Assert; import org.testng.annotations.Test; @@ -58,8 +56,7 @@ protected Map getEnv() { protected void beforeStartCluster() throws Exception { super.beforeStartCluster(); - PulsarClusterSpec spec = this.getPulsarCluster().getSpec(); - String clusterName = spec.clusterName(); + String clusterName = this.getPulsarCluster().getSpec().clusterName(); toolsetContainer = new ToolsetContainer(clusterName, PULSAR_3_0_IMAGE_NAME) .withEnv("metadataStoreUrl", ZKContainer.NAME)