You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2025/02/22 08:27:16 UTC

(pulsar) branch master updated: [improve][ci] Upgrade Gradle Develocity Maven Extension to 1.23.1 (#24004)

This is an automated email from the ASF dual-hosted git repository.

lhotari 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 35c9fec7891 [improve][ci] Upgrade Gradle Develocity Maven Extension to 1.23.1 (#24004)
35c9fec7891 is described below

commit 35c9fec78917cc2e03247f9a447d8464c91e7878
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Sat Feb 22 10:27:10 2025 +0200

    [improve][ci] Upgrade Gradle Develocity Maven Extension to 1.23.1 (#24004)
---
 .mvn/extensions.xml                                |  2 +-
 .../pulsar/metadata/BaseMetadataStoreTest.java     | 38 +++++++++++++++-------
 2 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml
index 8ceede33b9c..22eaa6a1779 100644
--- a/.mvn/extensions.xml
+++ b/.mvn/extensions.xml
@@ -24,7 +24,7 @@
   <extension>
     <groupId>com.gradle</groupId>
     <artifactId>develocity-maven-extension</artifactId>
-    <version>1.22.2</version>
+    <version>1.23.1</version>
   </extension>
   <extension>
     <groupId>com.gradle</groupId>
diff --git a/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/BaseMetadataStoreTest.java b/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/BaseMetadataStoreTest.java
index 03a6b91b62d..4bdb379d823 100644
--- a/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/BaseMetadataStoreTest.java
+++ b/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/BaseMetadataStoreTest.java
@@ -26,6 +26,7 @@ import io.streamnative.oxia.testcontainers.OxiaContainer;
 import java.io.File;
 import java.net.URI;
 import java.util.Arrays;
+import java.util.Optional;
 import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.CompletionException;
@@ -136,12 +137,12 @@ public abstract class BaseMetadataStoreTest extends TestRetrySupport {
         // The new connection string won't be available to the test method unless a
         // Supplier<String> lambda is used for providing the value.
         return new Object[][]{
-                {"ZooKeeper", stringSupplier(() -> zksConnectionString)},
-                {"Memory", stringSupplier(() -> memoryConnectionString)},
-                {"RocksDB", stringSupplier(() -> rocksdbConnectionString)},
-                {"Etcd", stringSupplier(() -> "etcd:" + getEtcdClusterConnectString())},
-                {"Oxia", stringSupplier(() -> "oxia://" + getOxiaServerConnectString())},
-                {"MockZooKeeper", stringSupplier(() -> mockZkUrl)},
+                {"ZooKeeper", providerUrlSupplier(() -> zksConnectionString)},
+                {"Memory", providerUrlSupplier(() -> memoryConnectionString)},
+                {"RocksDB", providerUrlSupplier(() -> rocksdbConnectionString)},
+                {"Etcd", providerUrlSupplier(() -> "etcd:" + getEtcdClusterConnectString(), "etcd:...")},
+                {"Oxia", providerUrlSupplier(() -> "oxia://" + getOxiaServerConnectString(), "oxia://...")},
+                {"MockZooKeeper", providerUrlSupplier(() -> mockZkUrl)},
         };
     }
 
@@ -185,16 +186,29 @@ public abstract class BaseMetadataStoreTest extends TestRetrySupport {
         return etcdCluster.clientEndpoints().stream().map(URI::toString).collect(Collectors.joining(","));
     }
 
-    public static Supplier<String> stringSupplier(Supplier<String> supplier) {
-        return new StringSupplier(supplier);
+    private static Supplier<String> providerUrlSupplier(Supplier<String> supplier) {
+        return new ProviderUrlSupplier(supplier);
+    }
+
+    // Use this method to provide a custom toString value for the Supplier<String>. Use this when Testcontainers is used
+    // so that a toString call doesn't eagerly trigger container initialization which could cause a deadlock
+    // with Gradle Develocity Maven Extension.
+    private static Supplier<String> providerUrlSupplier(Supplier<String> supplier, String toStringValue) {
+        return new ProviderUrlSupplier(supplier, Optional.ofNullable(toStringValue));
     }
 
     // Implements toString() so that the test name is more descriptive
-    private static class StringSupplier implements Supplier<String> {
+    private static class ProviderUrlSupplier implements Supplier<String> {
         private final Supplier<String> supplier;
+        private final Optional<String> toStringValue;
+
+        ProviderUrlSupplier(Supplier<String> supplier) {
+            this(supplier, Optional.empty());
+        }
 
-        public StringSupplier(Supplier<String> supplier) {
+        ProviderUrlSupplier(Supplier<String> supplier, Optional<String> toStringValue) {
             this.supplier = supplier;
+            this.toStringValue = toStringValue;
         }
 
         @Override
@@ -204,7 +218,9 @@ public abstract class BaseMetadataStoreTest extends TestRetrySupport {
 
         @Override
         public String toString() {
-            return get();
+            // toStringValue is used to prevent deadlocks which could occur if toString method call eagerly triggers
+            // Testcontainers initialization. This is the case when Gradle Develocity Maven Extension is used.
+            return toStringValue.orElseGet(this::get);
         }
     }