Skip to content

Commit d58f083

Browse files
committed
more logging
1 parent 4644198 commit d58f083

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

dd-java-agent/instrumentation/couchbase/couchbase-3.1/src/test/groovy/CouchbaseClient31Test.groovy

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ import datadog.trace.bootstrap.instrumentation.api.Tags
1717
import datadog.trace.core.DDSpan
1818
import org.slf4j.Logger
1919
import org.slf4j.LoggerFactory
20-
21-
import java.time.Duration
2220
import org.testcontainers.couchbase.BucketDefinition
2321
import org.testcontainers.couchbase.CouchbaseContainer
2422
import spock.lang.Shared
2523

24+
import java.time.Duration
25+
2626
import static datadog.trace.agent.test.utils.TraceUtils.basicSpan
2727
import static datadog.trace.agent.test.utils.TraceUtils.runUnderTrace
2828

@@ -39,12 +39,28 @@ abstract class CouchbaseClient31Test extends VersionedNamingTestBase {
3939
Bucket bucket
4040

4141
def setupSpec() {
42+
LOGGER.info("[raph] ${this.getClass().getSimpleName()} setup starting at ${new Date()}")
43+
4244
def arch = System.getProperty("os.arch") == "aarch64" ? "-aarch64" : ""
4345
couchbase = new CouchbaseContainer("couchbase/server:7.1.0${arch}")
4446
.withBucket(new BucketDefinition(BUCKET).withPrimaryIndex(true))
45-
.withStartupTimeout(Duration.ofSeconds(240))
46-
.withStartupAttempts(3)
47-
couchbase.start()
47+
.withStartupTimeout(Duration.ofSeconds(100))
48+
.withStartupAttempts(1)
49+
50+
long startTime = System.nanoTime()
51+
try {
52+
couchbase.start()
53+
}
54+
catch (Exception e) {
55+
double durationSeconds = (System.nanoTime() - startTime) / 1e9
56+
LOGGER.error("[raph] caught error after ${String.format('%.1f', durationSeconds)} s, gonna retry\n" + e.toString())
57+
couchbase.start()
58+
} finally {
59+
double durationSeconds = (System.nanoTime() - startTime) / 1e9
60+
LOGGER.info("[raph] couchbase.start took ${String.format('%.1f', durationSeconds)} s")
61+
}
62+
63+
LOGGER.info("[raph] if this log is printed, then there was no error in starting couchbase")
4864

4965
ClusterEnvironment environment = ClusterEnvironment.builder()
5066
.timeoutConfig(TimeoutConfig.kvTimeout(Duration.ofSeconds(10)))
@@ -63,6 +79,9 @@ abstract class CouchbaseClient31Test extends VersionedNamingTestBase {
6379
insertData(bucket, "$type $it", something, orOther)
6480
}
6581
cluster.queryIndexes().createIndex(BUCKET, 'test-index', Arrays.asList('something', 'or_other'))
82+
83+
double durationSeconds = (System.nanoTime() - startTime) / 1e9
84+
LOGGER.info("[raph] couchbase.start + rest of the setup took ${String.format('%.1f', durationSeconds)} s")
6685
}
6786

6887
def cleanupSpec() {
@@ -83,6 +102,7 @@ abstract class CouchbaseClient31Test extends VersionedNamingTestBase {
83102
}
84103

85104
def "check basic spans"() {
105+
LOGGER.info("[raph] first test is being run")
86106
setup:
87107
def collection = bucket.defaultCollection()
88108

@@ -104,6 +124,7 @@ abstract class CouchbaseClient31Test extends VersionedNamingTestBase {
104124
assertCouchbaseDispatchCall(it, span(0))
105125
}
106126
}
127+
LOGGER.info("[raph] end of first test (if this is printed, I think it means it was successful ?)")
107128
}
108129

109130
def "check basic error spans with internal spans enabled #internalEnabled"() {

0 commit comments

Comments
 (0)