Skip to content

Commit a315ea6

Browse files
committed
Only run very basic LogCacheTest when V2 is missing
1 parent a98e3bc commit a315ea6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

integration-test/src/test/java/org/cloudfoundry/logcache/v1/LogCacheTest.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.cloudfoundry.ApplicationUtils;
3030
import org.cloudfoundry.CloudFoundryVersion;
3131
import org.cloudfoundry.IfCloudFoundryVersion;
32+
import org.cloudfoundry.RequiresV2Api;
3233
import org.junit.jupiter.api.BeforeEach;
3334
import org.junit.jupiter.api.Disabled;
3435
import org.junit.jupiter.api.Test;
@@ -43,13 +44,15 @@ public class LogCacheTest extends AbstractIntegrationTest {
4344

4445
private ApplicationUtils.ApplicationMetadata testLogCacheAppMetadata;
4546

46-
@Autowired private TestLogCacheEndpoints testLogCacheEndpoints;
47+
@Autowired(required = false) private TestLogCacheEndpoints testLogCacheEndpoints;
4748

4849
private final Random random = new SecureRandom();
4950

5051
@BeforeEach
51-
void setUp(@Autowired Mono<ApplicationUtils.ApplicationMetadata> testLogCacheApp) {
52-
this.testLogCacheAppMetadata = testLogCacheApp.block();
52+
void setUp(@Autowired(required = false) Mono<ApplicationUtils.ApplicationMetadata> testLogCacheApp) {
53+
if (testLogCacheApp != null) {
54+
this.testLogCacheAppMetadata = testLogCacheApp.block();
55+
}
5356
}
5457

5558
@Test
@@ -68,6 +71,7 @@ public void info() {
6871
}
6972

7073
@Test
74+
@RequiresV2Api
7175
public void meta() {
7276
this.logCacheClient
7377
.meta(MetaRequest.builder().build())
@@ -83,6 +87,7 @@ public void meta() {
8387
}
8488

8589
@Test
90+
@RequiresV2Api
8691
public void readCounter() {
8792
final String name = this.nameFactory.getName("counter-");
8893
final int delta = this.random.nextInt(1000);
@@ -102,6 +107,7 @@ public void readCounter() {
102107
}
103108

104109
@Test
110+
@RequiresV2Api
105111
public void readEvent() {
106112
final String title = this.nameFactory.getName("event-");
107113
final String body = "This is the body. " + new BigInteger(1024, this.random).toString(32);
@@ -117,6 +123,7 @@ public void readEvent() {
117123

118124
@Test
119125
@Disabled("fails often for no reasons")
126+
@RequiresV2Api
120127
public void readGauge() {
121128
final String gaugeName = this.nameFactory.getName("gauge-");
122129
final Double value = this.random.nextDouble() % 100;
@@ -138,6 +145,7 @@ public void readGauge() {
138145
}
139146

140147
@Test
148+
@RequiresV2Api
141149
public void readLogs() {
142150
final String logMessage = this.nameFactory.getName("log-");
143151

0 commit comments

Comments
 (0)