Disable automatic connection recovery in reactor rabbit test (#8243)
This commit is contained in:
parent
3d020d2f8e
commit
1b6d25e519
|
@ -3,9 +3,6 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* 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.api.trace.SpanKind
|
||||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||||
|
@ -15,27 +12,15 @@ import reactor.rabbitmq.SenderOptions
|
||||||
|
|
||||||
class ReactorRabbitMqTest extends AgentInstrumentationSpecification implements WithRabbitMqTrait {
|
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() {
|
def setupSpec() {
|
||||||
startRabbit()
|
startRabbit()
|
||||||
|
connectionFactory.setAutomaticRecoveryEnabled(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
def cleanupSpec() {
|
def cleanupSpec() {
|
||||||
stopRabbit()
|
stopRabbit()
|
||||||
}
|
}
|
||||||
|
|
||||||
def cleanup() {
|
|
||||||
try {
|
|
||||||
channel.close()
|
|
||||||
conn.close()
|
|
||||||
} catch (ShutdownSignalException ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def "should not fail declaring exchange"() {
|
def "should not fail declaring exchange"() {
|
||||||
given:
|
given:
|
||||||
def sender = RabbitFlux.createSender(new SenderOptions().connectionFactory(connectionFactory))
|
def sender = RabbitFlux.createSender(new SenderOptions().connectionFactory(connectionFactory))
|
||||||
|
|
Loading…
Reference in New Issue