davsclaus commented on code in PR #27445:
URL: https://github.com/apache/camel/pull/27445#discussion_r4203984026
##########
components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteQueryTestSupport.java:
##########
@@ -78,4 +88,30 @@ public static boolean hasUser(List<User> users, String name,
String surname) {
return false;
}
+ /**
+ * Registers a protobuf schema with the Infinispan server, retrying on
transient errors. Under parallel {@code -T1C}
+ * builds the server's internal {@code ___protobuf_metadata} cache may not
be ready yet, causing connection or
+ * lifecycle state exceptions. The retry loop mirrors the pattern used by
+ * {@link InfinispanRemoteTestSupport#createCache()} for regular cache
creation.
+ *
+ * @param schema the protobuf schema descriptor to register
+ */
+ protected void registerSchema(FileDescriptorSource schema) {
+ final IterationBoundedBudget budget
+ =
Budgets.iterationBudget().withInterval(Duration.ofSeconds(1)).withMaxIterations(30).build();
+ final ForegroundTask task = Tasks.foregroundTask()
+ .withBudget(budget).build();
+
+ final boolean registered = task.run(null, () -> {
+ try {
+ cacheContainer.administration().schemas().create(schema);
+ return true;
+ } catch (Exception e) {
+ LOG.warn("Unable to register protobuf schema (will retry):
{}", e.getMessage(), e);
+ return false;
+ }
+ });
+
+ Assumptions.assumeTrue(registered, "The Infinispan protobuf schema
could not be registered");
Review Comment:
With `assumeTrue`, a persistent failure makes the ITs pass by not running.
The parent class does the same, but a failed assertion would be more honest
here.
##########
components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteQueryTestSupport.java:
##########
@@ -78,4 +88,30 @@ public static boolean hasUser(List<User> users, String name,
String surname) {
return false;
}
+ /**
+ * Registers a protobuf schema with the Infinispan server, retrying on
transient errors. Under parallel {@code -T1C}
+ * builds the server's internal {@code ___protobuf_metadata} cache may not
be ready yet, causing connection or
+ * lifecycle state exceptions. The retry loop mirrors the pattern used by
+ * {@link InfinispanRemoteTestSupport#createCache()} for regular cache
creation.
+ *
+ * @param schema the protobuf schema descriptor to register
+ */
+ protected void registerSchema(FileDescriptorSource schema) {
+ final IterationBoundedBudget budget
+ =
Budgets.iterationBudget().withInterval(Duration.ofSeconds(1)).withMaxIterations(30).build();
+ final ForegroundTask task = Tasks.foregroundTask()
+ .withBudget(budget).build();
+
+ final boolean registered = task.run(null, () -> {
+ try {
+ cacheContainer.administration().schemas().create(schema);
+ return true;
+ } catch (Exception e) {
+ LOG.warn("Unable to register protobuf schema (will retry):
{}", e.getMessage(), e);
Review Comment:
This retries every exception, so a real error such as a bad `.proto` is
retried 30 times and then the test is skipped. Could it catch only the
transient ones (e.g. `TransportException`)? Also, logging the full stack trace
on each of up to 30 attempts is noisy; maybe the message only, and the trace at
debug.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]