Remove unnecessary method in test harness (#3016)

This commit is contained in:
Trask Stalnaker 2021-05-17 12:12:56 -07:00 committed by GitHub
parent 32399ea7a9
commit e54a007dc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 14 deletions

View File

@ -6,6 +6,7 @@
package io.opentelemetry.javaagent.instrumentation.jaxws.v2_0 package io.opentelemetry.javaagent.instrumentation.jaxws.v2_0
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
import io.opentelemetry.test.SoapProvider import io.opentelemetry.test.SoapProvider
class JaxWsAnnotationsTest extends AgentInstrumentationSpecification { class JaxWsAnnotationsTest extends AgentInstrumentationSpecification {
@ -18,10 +19,10 @@ class JaxWsAnnotationsTest extends AgentInstrumentationSpecification {
assertTraces(1) { assertTraces(1) {
trace(0, 1) { trace(0, 1) {
span(0) { span(0) {
name 'SoapProvider.invoke' name "SoapProvider.invoke"
attributes { attributes {
attribute('code.namespace', 'io.opentelemetry.test.SoapProvider') "${SemanticAttributes.CODE_NAMESPACE.key}" "io.opentelemetry.test.SoapProvider"
attribute('code.function', 'invoke') "${SemanticAttributes.CODE_FUNCTION.key}" "invoke"
} }
} }
} }

View File

@ -6,6 +6,7 @@
package io.opentelemetry.javaagent.instrumentation.jaxws.jws.v1_1 package io.opentelemetry.javaagent.instrumentation.jaxws.jws.v1_1
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
import io.opentelemetry.test.WebServiceClass import io.opentelemetry.test.WebServiceClass
import io.opentelemetry.test.WebServiceDefinitionInterface import io.opentelemetry.test.WebServiceDefinitionInterface
import io.opentelemetry.test.WebServiceFromInterface import io.opentelemetry.test.WebServiceFromInterface
@ -25,8 +26,8 @@ class JwsAnnotationsTest extends AgentInstrumentationSpecification {
span(0) { span(0) {
name "WebServiceClass.doSomethingPublic" name "WebServiceClass.doSomethingPublic"
attributes { attributes {
attribute('code.function', 'doSomethingPublic') "${SemanticAttributes.CODE_NAMESPACE.key}" "io.opentelemetry.test.WebServiceClass"
attribute('code.namespace', 'io.opentelemetry.test.WebServiceClass') "${SemanticAttributes.CODE_FUNCTION.key}" "doSomethingPublic"
} }
} }
} }
@ -45,8 +46,8 @@ class JwsAnnotationsTest extends AgentInstrumentationSpecification {
span(0) { span(0) {
name "WebServiceFromInterface.partOfPublicInterface" name "WebServiceFromInterface.partOfPublicInterface"
attributes { attributes {
attribute('code.function', 'partOfPublicInterface') "${SemanticAttributes.CODE_NAMESPACE.key}" "io.opentelemetry.test.WebServiceFromInterface"
attribute('code.namespace', 'io.opentelemetry.test.WebServiceFromInterface') "${SemanticAttributes.CODE_FUNCTION.key}" "partOfPublicInterface"
} }
} }
} }
@ -69,8 +70,8 @@ class JwsAnnotationsTest extends AgentInstrumentationSpecification {
span(0) { span(0) {
name "WebServiceFromInterface.partOfPublicInterface" name "WebServiceFromInterface.partOfPublicInterface"
attributes { attributes {
attribute('code.function', 'partOfPublicInterface') "${SemanticAttributes.CODE_NAMESPACE.key}" "io.opentelemetry.test.WebServiceFromInterface"
attribute('code.namespace', 'io.opentelemetry.test.WebServiceFromInterface') "${SemanticAttributes.CODE_FUNCTION.key}" "partOfPublicInterface"
} }
} }
} }

View File

@ -375,7 +375,7 @@ class RabbitMQTest extends AgentInstrumentationSpecification {
"rabbitmq.record.queue_time_ms" { it instanceof Long && it >= 0 } "rabbitmq.record.queue_time_ms" { it instanceof Long && it >= 0 }
} }
switch (attribute("rabbitmq.command")) { switch (trace.span(index).attributes.get(AttributeKey.stringKey("rabbitmq.command"))) {
case "basic.publish": case "basic.publish":
"rabbitmq.command" "basic.publish" "rabbitmq.command" "basic.publish"
"rabbitmq.routing_key" { "rabbitmq.routing_key" {

View File

@ -45,10 +45,6 @@ class AttributesAssert {
} }
} }
def attribute(String name) {
return attributes[name]
}
def methodMissing(String name, args) { def methodMissing(String name, args) {
if (args.length == 0) { if (args.length == 0) {
throw new IllegalArgumentException(args.toString()) throw new IllegalArgumentException(args.toString())
@ -56,6 +52,7 @@ class AttributesAssert {
attribute(name, args[0]) attribute(name, args[0])
} }
// this could be private, but then codenarc fails, thinking (incorrectly) that it's unused
void assertAttributesAllVerified() { void assertAttributesAllVerified() {
Set<String> allAttributes = new TreeSet<>(attributes.keySet()) Set<String> allAttributes = new TreeSet<>(attributes.keySet())
Set<String> unverifiedAttributes = new TreeSet(allAttributes) Set<String> unverifiedAttributes = new TreeSet(allAttributes)