Skip to content

Commit ad9ad05

Browse files
committed
IT: rm unrelevant, less logging in CI
Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
1 parent 0d230f0 commit ad9ad05

File tree

4 files changed

+33
-12
lines changed

4 files changed

+33
-12
lines changed

bmq-sdk/src/main/java/com/bloomberg/bmq/impl/BrokerSession.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,11 @@ public void stopAsync(Duration timeout) {
475475
() ->
476476
brokerConnection.stop(
477477
(BrokerConnection.StopStatus status) -> {
478-
logger.info("Stop callback: {}", status);
478+
if (status == BrokerConnection.StopStatus.SUCCESS) {
479+
logger.debug("Stop callback: {}", status);
480+
} else {
481+
logger.warn("Stop callback: {}", status);
482+
}
479483
// TODO: handle error status
480484
connectionStopFuture.complete(null);
481485
},
@@ -502,7 +506,7 @@ public void stopAsync(Duration timeout) {
502506
},
503507
scheduler);
504508

505-
logger.info("Broker connection is stopping.");
509+
logger.debug("Broker connection is stopping.");
506510
}
507511

508512
private void addHostHealthMonitorHandler() {

bmq-sdk/src/test/java/com/bloomberg/bmq/impl/BrokerSessionTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package com.bloomberg.bmq.impl;
1717

1818
import static org.junit.jupiter.api.Assertions.assertEquals;
19+
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
1920
import static org.junit.jupiter.api.Assertions.assertNotNull;
2021
import static org.junit.jupiter.api.Assertions.assertNull;
2122
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -183,9 +184,9 @@ public void verifySessionEvent(BrokerSessionEvent.Type type) {
183184
Event event = nextEvent();
184185
assertNotNull(event);
185186

186-
logger.info("Verify session event: {}", event);
187+
logger.trace("Verify session event: {}", event);
187188

188-
assertTrue(event instanceof BrokerSessionEvent);
189+
assertInstanceOf(BrokerSessionEvent.class, event);
189190

190191
assertEquals(type, ((BrokerSessionEvent) event).getEventType());
191192
}

bmq-sdk/src/test/java/com/bloomberg/bmq/it/util/BmqBrokerTestServer.java

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,19 +126,28 @@ public static BmqBrokerTestServer createStoppedBroker(int port) {
126126
private void init(int waitTime) throws IOException, InterruptedException {
127127
final String envPath = BmqBroker.brokerDir();
128128

129+
if (envPath.isEmpty()) {
130+
throw new IllegalArgumentException(
131+
"Empty 'it.brokerDir' provided, no path to the broker");
132+
}
133+
129134
// Cleanup from previous run. Delete named pipe if it's there
130135
File np = new File(envPath + "/bmqbrkr.ctl");
131136
if (np.exists()) {
132137
logger.info("Deleting orphan bmqbrkr.ctl");
133-
np.delete();
138+
if (!np.delete()) {
139+
logger.error("Failed to remove orphan bmqbrkr.ctl: {}", np.getPath());
140+
}
134141
}
135142

136143
// Since we run multiple tests at the same time starting instances
137144
// of BlazingMQ broker in the same location (BMQ_PREFIX),
138145
// we need to create a tmp folder for storage, log and stat files
139146
tmpFolder = makeTempDir(envPath, "localBMQ_");
140147

141-
ProcessBuilder pb = new ProcessBuilder("./run");
148+
ProcessBuilder pb =
149+
new ProcessBuilder(
150+
"./run", "-p", Integer.toString(sessionOptions.brokerUri().getPort()));
142151

143152
final Path storagePath = tmpFolder.resolve("storage");
144153

@@ -149,11 +158,6 @@ private void init(int waitTime) throws IOException, InterruptedException {
149158

150159
outputFile = new File(tmpFolder.resolve("output").toString());
151160

152-
// Common environment vars
153-
env.put("BMQ_PORT", String.valueOf(sessionOptions.brokerUri().getPort()));
154-
env.put("BMQ_HOSTTAGS_FILE", "/bb/bin/bbcpu.lst");
155-
env.put("PYTHONPATH", envPath + "/python");
156-
157161
pb.directory(new File(envPath));
158162

159163
logger.info("BlazingMQ Broker BMQ_PREFIX: [{}]", env.get("BMQ_PREFIX"));
@@ -171,7 +175,16 @@ private void init(int waitTime) throws IOException, InterruptedException {
171175
if (!process.isAlive()) {
172176
logger.error(
173177
"Failed to start broker process after waiting for [{}] seconds.", waitTime);
174-
throw new IllegalStateException("Failed to start broker process");
178+
179+
StringBuilder sb = new StringBuilder();
180+
sb.append("Failed to start broker process, rc = ")
181+
.append(process.exitValue())
182+
.append(", dir = [ ")
183+
.append(envPath)
184+
.append(" ], cmd = [ ")
185+
.append(String.join(" ", pb.command()))
186+
.append(" ],");
187+
throw new IllegalStateException(sb.toString());
175188
}
176189

177190
pid = (int) getPidOfProcess(process);

bmq-sdk/src/test/resources/log4j2.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ rootLogger.appenderRef.stdout.ref = STDOUT
99
#logger.applicationData.name = com.bloomberg.bmq.impl.infr.proto.ApplicationData
1010
#logger.applicationData.level = debug
1111

12+
logger.brokerSession.name = com.bloomberg.bmq.impl.BrokerSession
13+
logger.brokerSession.level = warn
14+
1215
# Explicitly set BrokerSession logger to INFO level in order to
1316
# always see stats in log
1417
#logger.brokerSession.name = com.bloomberg.bmq.impl.BrokerSession

0 commit comments

Comments
 (0)