Fixing test failures
This commit is contained in:
@@ -91,9 +91,7 @@ public class HystrixStreamTests {
|
||||
assertThat(this.registration.getServiceId()).isEqualTo("mytestapp");
|
||||
this.task.gatherMetrics();
|
||||
Message<?> message = this.collector.forChannel(output).take();
|
||||
// TODO: possible regression with Edgware?
|
||||
assertThat(message.getPayload()).isInstanceOf(byte[].class);
|
||||
JsonNode tree = mapper.readTree(new String((byte[]) message.getPayload()));
|
||||
JsonNode tree = mapper.readTree((String)message.getPayload());
|
||||
assertThat(tree.hasNonNull("origin"));
|
||||
assertThat(tree.hasNonNull("data"));
|
||||
}
|
||||
|
||||
@@ -155,8 +155,7 @@ public abstract class StreamSourceTestBase {
|
||||
if (message == null) {
|
||||
return message;
|
||||
}
|
||||
Object fromMessage = converter().fromMessage(message, String.class);
|
||||
return MessageBuilder.createMessage(fromMessage, message.getHeaders());
|
||||
return MessageBuilder.createMessage(message.getPayload(), message.getHeaders());
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error("Exception occurred while trying to read a message from "
|
||||
|
||||
@@ -32,10 +32,13 @@ import com.netflix.zuul.exception.ZuulException;
|
||||
import com.netflix.zuul.monitoring.CounterFactory;
|
||||
import com.netflix.zuul.monitoring.TracerFactory;
|
||||
|
||||
import static io.micrometer.core.instrument.MockClock.clock;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
||||
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import io.micrometer.core.instrument.MockClock;
|
||||
import io.micrometer.core.instrument.simple.SimpleConfig;
|
||||
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@@ -68,6 +71,7 @@ public class ZuulMetricsApplicationTests {
|
||||
new ZuulException("any", 500, "cause");
|
||||
new ZuulException("any", 500, "cause");
|
||||
|
||||
clock(meterRegistry).add(SimpleConfig.DEFAULT_STEP);
|
||||
Double count = meterRegistry.counter("ZUUL::EXCEPTION:cause:500").count();
|
||||
assertEquals(count.longValue(), 2L);
|
||||
|
||||
@@ -75,6 +79,7 @@ public class ZuulMetricsApplicationTests {
|
||||
new ZuulException("any", 404, "cause2");
|
||||
new ZuulException("any", 404, "cause2");
|
||||
|
||||
clock(meterRegistry).add(SimpleConfig.DEFAULT_STEP);
|
||||
count = meterRegistry.counter("ZUUL::EXCEPTION:cause2:404").count();
|
||||
assertEquals(count.longValue(), 3L);
|
||||
}
|
||||
@@ -92,7 +97,7 @@ public class ZuulMetricsApplicationTests {
|
||||
|
||||
@Bean
|
||||
public MeterRegistry meterRegistry() {
|
||||
return new SimpleMeterRegistry();
|
||||
return new SimpleMeterRegistry(SimpleConfig.DEFAULT, new MockClock());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user