Sha256: fa7de9793111ef4729723133e3ae21ec272a918b015502a64a2842d96e2fc0bc

Contents?: true

Size: 973 Bytes

Versions: 1

Compression:

Stored size: 973 Bytes

Contents

describe Faraday::Zipkin::TraceHeaders do
  let(:middleware) { described_class.new(lambda{|env| env}) }

  def process(body, headers={})
    env = {
      :body => body,
      :request_headers => Faraday::Utils::Headers.new(headers),
    }
    middleware.call(env)
  end

  context 'request' do
    context 'with tracing id' do
      let(:trace_id) { ::Trace::TraceId.new(1, 2, 3, true, ::Trace::Flags::EMPTY) }

      it 'sets the X-B3 request headers' do
        result = nil
        ::Trace.push(trace_id) do
          result = process('')
        end
        expect(result[:request_headers]['X-B3-TraceId']).to eq('0000000000000001')
        expect(result[:request_headers]['X-B3-ParentSpanId']).to eq('0000000000000002')
        expect(result[:request_headers]['X-B3-SpanId']).to eq('0000000000000003')
        expect(result[:request_headers]['X-B3-Sampled']).to eq('true')
        expect(result[:request_headers]['X-B3-Flags']).to eq('0')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
faraday-zipkin-0.0.1 spec/zipkin_trace_headers_spec.rb