Made the tests better

This commit is contained in:
Marcin Grzejszczak
2021-11-22 15:56:02 +01:00
parent a08f94cb21
commit eab9079e9b
2 changed files with 13 additions and 3 deletions

View File

@@ -17,6 +17,8 @@
package org.springframework.cloud.sleuth.brave.instrument.redis;
import brave.sampler.Sampler;
import io.lettuce.core.tracing.BraveTracing;
import io.lettuce.core.tracing.Tracing;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.sleuth.brave.BraveTestSpanHandler;
@@ -30,6 +32,11 @@ import org.springframework.test.context.ContextConfiguration;
public class BraveLettuceIntegrationTests
extends org.springframework.cloud.sleuth.instrument.redis.LettuceIntegrationTests {
@Override
protected Class<? extends Tracing> tracing() {
return BraveTracing.class;
}
@Configuration(proxyBeanMethods = false)
static class Config {

View File

@@ -17,7 +17,7 @@
package org.springframework.cloud.sleuth.instrument.redis;
import io.lettuce.core.resource.ClientResources;
import io.lettuce.core.tracing.BraveTracing;
import io.lettuce.core.tracing.Tracing;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -42,15 +42,18 @@ public abstract class LettuceIntegrationTests {
TraceLettuceClientResourcesBuilderCustomizer customizer;
@Autowired
BraveTracing braveTracing;
Tracing tracing;
@Test
void tracing_should_be_set() {
then(this.clientResources).isNull();
then(this.customizer).isNotNull();
then(this.braveTracing.isEnabled()).isTrue();
then(this.tracing.isEnabled()).isTrue();
then(this.tracing).isInstanceOf(tracing());
}
protected abstract Class<? extends Tracing> tracing();
@Configuration(proxyBeanMethods = false)
@EnableAutoConfiguration
protected static class TestConfig {