Disable automatic connection recovery in reactor rabbit test (#8243)

This commit is contained in:
Lauri Tulmin 2023-04-07 16:41:40 +03:00 committed by GitHub
parent 3d020d2f8e
commit 1b6d25e519
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 16 deletions

View File

@ -3,9 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/
import com.rabbitmq.client.Channel
import com.rabbitmq.client.Connection
import com.rabbitmq.client.ShutdownSignalException
import io.opentelemetry.api.trace.SpanKind
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
@ -15,27 +12,15 @@ import reactor.rabbitmq.SenderOptions
class ReactorRabbitMqTest extends AgentInstrumentationSpecification implements WithRabbitMqTrait {
// Open connection outside of the test method to ensure that connection can be successfully
// established inside the test method without producing extra spans for connection recovery
Connection conn = connectionFactory.newConnection()
Channel channel = conn.createChannel()
def setupSpec() {
startRabbit()
connectionFactory.setAutomaticRecoveryEnabled(false)
}
def cleanupSpec() {
stopRabbit()
}
def cleanup() {
try {
channel.close()
conn.close()
} catch (ShutdownSignalException ignored) {
}
}
def "should not fail declaring exchange"() {
given:
def sender = RabbitFlux.createSender(new SenderOptions().connectionFactory(connectionFactory))