Sha256: 29b16dff82ebfdd1db7d905758f64abaca41888e861ad13ffe401f95f58b7b3e

Contents?: true

Size: 847 Bytes

Versions: 6

Compression:

Stored size: 847 Bytes

Contents

# frozen_string_literal: true

require "test-unit"
require "net/http"
require "json"

module Splunk
  # Rails7BarebonesTest
  class Rails7BarebonesTest < Test::Unit::TestCase
    test "generates spans" do
      app_host = ENV.fetch "APP_HOST", "localhost"
      app_port = ENV.fetch("APP_PORT", "3000").to_i
      collector_host = ENV.fetch "COLLECTOR_HOST", "localhost"
      collector_port = ENV.fetch("COLLECTOR_PORT", "8378").to_i

      Net::HTTP.get(app_host, "/", app_port)

      response = Net::HTTP.get(collector_host, "/?timeout=20&count=1", collector_port)
      spans = JSON.parse(response)
      assert spans.count >= 1

      assert(spans.all? { |span| span["traceId"].to_s != "" })
      assert(spans.all? { |span| span["spanId"].to_s != "" })
      assert(spans.all? { |span| span["operationName"].to_s != "" })
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
splunk-otel-1.3.0 examples/rails-7-barebones/tests-e2e/rails_7_barebones_test.rb
splunk-otel-1.1.3 examples/rails-7-barebones/tests-e2e/rails_7_barebones_test.rb
splunk-otel-1.1.0 examples/rails-7-barebones/tests-e2e/rails_7_barebones_test.rb
splunk-otel-1.0.0 examples/rails-7-barebones/tests-e2e/rails_7_barebones_test.rb
splunk-otel-0.2.0 examples/rails-7-barebones/tests-e2e/rails_7_barebones_test.rb
splunk-otel-0.1.0 examples/rails-7-barebones/tests-e2e/rails_7_barebones_test.rb