Sha256: 6eb28191e4a0ee8b025955062fe131429b7a63e00b7bac81bffa7af796272e50

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

require_relative "test_v1"
require_relative "../../ext/test"

module Datadog
  module CI
    module TestVisibility
      module Serializers
        class TestV2 < TestV1
          CONTENT_FIELDS = (["test_session_id", "test_module_id", "test_suite_id"] + TestV1::CONTENT_FIELDS).freeze

          CONTENT_FIELDS_WITH_ITR_CORRELATION_ID = (CONTENT_FIELDS + ["itr_correlation_id"]).freeze

          CONTENT_MAP_SIZE = calculate_content_map_size(CONTENT_FIELDS)

          CONTENT_MAP_SIZE_WITH_ITR_CORRELATION_ID = calculate_content_map_size(CONTENT_FIELDS_WITH_ITR_CORRELATION_ID)

          REQUIRED_FIELDS = (["test_session_id", "test_module_id", "test_suite_id"] + TestV1::REQUIRED_FIELDS).freeze

          def content_fields
            return CONTENT_FIELDS if itr_correlation_id.nil?

            CONTENT_FIELDS_WITH_ITR_CORRELATION_ID
          end

          def content_map_size
            return CONTENT_MAP_SIZE if itr_correlation_id.nil?

            CONTENT_MAP_SIZE_WITH_ITR_CORRELATION_ID
          end

          def version
            2
          end

          def itr_correlation_id
            options[:itr_correlation_id]
          end

          private

          def required_fields
            REQUIRED_FIELDS
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
datadog-ci-1.0.0.beta6 lib/datadog/ci/test_visibility/serializers/test_v2.rb
datadog-ci-1.0.0.beta3 lib/datadog/ci/test_visibility/serializers/test_v2.rb