Skip to content

Commit

Permalink
Merge pull request #1692 from newrelic/NR1434_resolve_cross_agent_tes…
Browse files Browse the repository at this point in the history
…t_todo

Update test and test case 'vendors' key
  • Loading branch information
fallwith authored Dec 13, 2022
2 parents 0b89d57 + df4bace commit 0d6d8a2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@
"tracestate.sampled",
"tracestate.priority"
],
"vendors": [
"tracingVendors": [
"foo",
"bar"
]
Expand Down Expand Up @@ -1476,7 +1476,7 @@
"tracestate.sampled",
"tracestate.priority"
],
"vendors": [
"tracingVendors": [
]
}
],
Expand Down Expand Up @@ -1559,7 +1559,7 @@
"tracestate.parent_application_id",
"tracestate.timestamp"
],
"vendors": [
"tracingVendors": [
"44@nr"
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,15 @@ def verify_attributes(test_case_attributes, actual_attributes, event_type)

(test_case_attributes['exact'] || []).each do |k, v|
assert_equal v,
actual_attributes[k.to_s],
%Q(Wrong "#{k}" #{event_type} attribute; expected #{v.inspect}, was #{actual_attributes[k.to_s].inspect})
actual_attributes[k],
%Q(Wrong "#{k}" #{event_type} attribute; expected #{v}, was #{actual_attributes[k]})
end

(test_case_attributes['notequal'] || []).each do |k, v|
refute_equal(
v,
actual_attributes[k.to_s],
"#{event_type} #{k.to_s.inspect} attribute should not equal #{v.inspect}"
actual_attributes[k],
"#{event_type} #{k} attribute should not equal #{v}"
)
end

Expand All @@ -253,10 +253,14 @@ def verify_attributes(test_case_attributes, actual_attributes, event_type)
%Q(Unexpected #{event_type} attribute "#{key}")
end

(test_case_attributes['vendors'] || []).each do |k, v|
assert_equal v,
actual_attributes[k.to_s],
%Q(Wrong "#{k}" #{event_type} attribute; expected #{v.inspect}, was #{actual_attributes[k.to_s].inspect})
test_key = 'tracingVendors'
actual_key = "tracestate.#{test_key}"

if test_case_attributes.key?(test_key)
vendors = Array(test_case_attributes[test_key]).join(',')

assert_equal vendors, actual_attributes[actual_key],
%Q(Wrong "#{test_key}" #{event_type} attribute; expected #{vendors}, was #{actual_attributes[actual_key]})
end
end

Expand Down Expand Up @@ -350,6 +354,7 @@ def trace_context_headers_to_hash(carrier)
tracestate['sampled'] = tracestate_values[6]
tracestate['priority'] = tracestate_values[7].chomp("0")
tracestate['timestamp'] = tracestate_values[8]
tracestate['tracingVendors'] = header_data.trace_state_vendors
else
tracestate = nil
end
Expand Down

0 comments on commit 0d6d8a2

Please sign in to comment.