buildkite-test_collector 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +2 -2
- data/buildkite.yaml +1 -1
- data/lib/buildkite/test_collector/ci.rb +2 -2
- data/lib/buildkite/test_collector/http_client.rb +10 -1
- data/lib/buildkite/test_collector/library_hooks/rspec.rb +1 -1
- data/lib/buildkite/test_collector/minitest_plugin/reporter.rb +4 -2
- data/lib/buildkite/test_collector/minitest_plugin/trace.rb +1 -3
- data/lib/buildkite/test_collector/rspec_plugin/trace.rb +1 -3
- data/lib/buildkite/test_collector/uploader.rb +4 -1
- data/lib/buildkite/test_collector/uuid.rb +12 -0
- data/lib/buildkite/test_collector/version.rb +1 -1
- data/lib/buildkite/test_collector.rb +1 -1
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: cecd9e001e4e3ead60507d46635e48fbe2468c183e215896ae4c92e69d207aee
         | 
| 4 | 
            +
              data.tar.gz: da88dde37e16f1ef279f05f84434fdefe1edc8488e864b669cba0741cc0799ca
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 7d8a965f5a1897a0ddce0ac3a03a527fbfb8d2683ce9555961ef1ba597742e7070cdd187d48f97b8e3111769e837eca69e1b65b52708515b7c87357811bc2c8f
         | 
| 7 | 
            +
              data.tar.gz: 00caaf80206b97b39d4f4f0e67c15e1b8b77ee5f7df85f74b4a569bff3cb0ec1e4f2a248eda5c0d302277e0fe44421c52a32d65e114d162334971af9fad03e75
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,5 +1,13 @@ | |
| 1 1 | 
             
            # CHANGELOG
         | 
| 2 2 |  | 
| 3 | 
            +
            ## v2.3.0
         | 
| 4 | 
            +
            - Stop sending execution id and safeguard SecureRandom.uuid #192 - @niceking
         | 
| 5 | 
            +
            - Rescue from StandardError when sending upload request #191 - @niceking
         | 
| 6 | 
            +
            - Fix nil pointer #188 - @ChrisBr
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            ## v2.2.0
         | 
| 9 | 
            +
            - Gzip payload of request to Upload API #183 - @niceking
         | 
| 10 | 
            +
             | 
| 3 11 | 
             
            ## v2.1.0
         | 
| 4 12 | 
             
            - Major change: deprecates websocket connection in favour of sending HTTP requests to the Upload API. In future, websocket support will be completely removed from Buildkite and only version 2.1+ of this gem will continue to work.
         | 
| 5 13 |  | 
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            PATH
         | 
| 2 2 | 
             
              remote: .
         | 
| 3 3 | 
             
              specs:
         | 
| 4 | 
            -
                buildkite-test_collector (2. | 
| 4 | 
            +
                buildkite-test_collector (2.3.0)
         | 
| 5 5 | 
             
                  activesupport (>= 4.2)
         | 
| 6 6 |  | 
| 7 7 | 
             
            GEM
         | 
| @@ -14,7 +14,7 @@ GEM | |
| 14 14 | 
             
                  tzinfo (~> 2.0)
         | 
| 15 15 | 
             
                concurrent-ruby (1.2.2)
         | 
| 16 16 | 
             
                diff-lcs (1.4.4)
         | 
| 17 | 
            -
                i18n (1. | 
| 17 | 
            +
                i18n (1.13.0)
         | 
| 18 18 | 
             
                  concurrent-ruby (~> 1.0)
         | 
| 19 19 | 
             
                minitest (5.18.0)
         | 
| 20 20 | 
             
                rake (13.0.6)
         | 
    
        data/buildkite.yaml
    CHANGED
    
    
| @@ -21,7 +21,7 @@ class Buildkite::TestCollector::CI | |
| 21 21 |  | 
| 22 22 | 
             
                {
         | 
| 23 23 | 
             
                  "CI" => nil,
         | 
| 24 | 
            -
                  "key" =>  | 
| 24 | 
            +
                  "key" => Buildkite::TestCollector::UUID.call,
         | 
| 25 25 | 
             
                }
         | 
| 26 26 | 
             
              end
         | 
| 27 27 |  | 
| @@ -44,7 +44,7 @@ class Buildkite::TestCollector::CI | |
| 44 44 | 
             
              def generic
         | 
| 45 45 | 
             
                {
         | 
| 46 46 | 
             
                  "CI" => "generic",
         | 
| 47 | 
            -
                  "key" =>  | 
| 47 | 
            +
                  "key" => Buildkite::TestCollector::UUID.call,
         | 
| 48 48 | 
             
                }
         | 
| 49 49 | 
             
              end
         | 
| 50 50 |  | 
| @@ -19,16 +19,25 @@ module Buildkite::TestCollector | |
| 19 19 | 
             
                  contact = Net::HTTP::Post.new(contact_uri.path, {
         | 
| 20 20 | 
             
                    "Authorization" => authorization_header,
         | 
| 21 21 | 
             
                    "Content-Type" => "application/json",
         | 
| 22 | 
            +
                    "Content-Encoding" => "gzip",
         | 
| 22 23 | 
             
                  })
         | 
| 23 24 |  | 
| 24 25 | 
             
                  data_set = data.map(&:as_hash)
         | 
| 25 26 |  | 
| 26 | 
            -
                   | 
| 27 | 
            +
                  body = {
         | 
| 27 28 | 
             
                    run_env: Buildkite::TestCollector::CI.env,
         | 
| 28 29 | 
             
                    format: "json",
         | 
| 29 30 | 
             
                    data: data_set
         | 
| 30 31 | 
             
                  }.to_json
         | 
| 31 32 |  | 
| 33 | 
            +
                  compressed_body = StringIO.new
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                  writer = Zlib::GzipWriter.new(compressed_body)
         | 
| 36 | 
            +
                  writer.write(body)
         | 
| 37 | 
            +
                  writer.close
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                  contact.body = compressed_body.string
         | 
| 40 | 
            +
             | 
| 32 41 | 
             
                  http.request(contact)
         | 
| 33 42 | 
             
                end
         | 
| 34 43 |  | 
| @@ -30,7 +30,7 @@ RSpec.configure do |config| | |
| 30 30 |  | 
| 31 31 | 
             
              config.after(:suite) do
         | 
| 32 32 | 
             
                if Buildkite::TestCollector.artifact_path
         | 
| 33 | 
            -
                  filename = File.join(Buildkite::TestCollector.artifact_path, "buildkite-test-collector-rspec-#{ | 
| 33 | 
            +
                  filename = File.join(Buildkite::TestCollector.artifact_path, "buildkite-test-collector-rspec-#{Buildkite::TestCollector::UUID.call}.json.gz")
         | 
| 34 34 | 
             
                  data_set = { results: Buildkite::TestCollector.uploader.traces.values.map(&:as_hash) }
         | 
| 35 35 | 
             
                  File.open(filename, "wb") do |f|
         | 
| 36 36 | 
             
                    gz = Zlib::GzipWriter.new(f)
         | 
| @@ -21,8 +21,10 @@ module Buildkite::TestCollector::MinitestPlugin | |
| 21 21 | 
             
                def report
         | 
| 22 22 | 
             
                  super
         | 
| 23 23 |  | 
| 24 | 
            -
                  Buildkite::TestCollector.session | 
| 25 | 
            -
             | 
| 24 | 
            +
                  if Buildkite::TestCollector.session
         | 
| 25 | 
            +
                    Buildkite::TestCollector.session.send_remaining_data
         | 
| 26 | 
            +
                    Buildkite::TestCollector.session.close
         | 
| 27 | 
            +
                  end
         | 
| 26 28 | 
             
                end
         | 
| 27 29 | 
             
              end
         | 
| 28 30 | 
             
            end
         | 
| @@ -4,7 +4,7 @@ module Buildkite::TestCollector::MinitestPlugin | |
| 4 4 | 
             
              class Trace
         | 
| 5 5 | 
             
                attr_accessor :example
         | 
| 6 6 | 
             
                attr_writer :failure_reason, :failure_expanded
         | 
| 7 | 
            -
                attr_reader : | 
| 7 | 
            +
                attr_reader :history
         | 
| 8 8 |  | 
| 9 9 | 
             
                RESULT_CODES = {
         | 
| 10 10 | 
             
                  '.' => 'passed',
         | 
| @@ -16,7 +16,6 @@ module Buildkite::TestCollector::MinitestPlugin | |
| 16 16 | 
             
                FILE_PATH_REGEX = /^(.*?\.(rb|feature))/
         | 
| 17 17 |  | 
| 18 18 | 
             
                def initialize(example, history:)
         | 
| 19 | 
            -
                  @id = SecureRandom.uuid
         | 
| 20 19 | 
             
                  @example = example
         | 
| 21 20 | 
             
                  @history = history
         | 
| 22 21 | 
             
                end
         | 
| @@ -31,7 +30,6 @@ module Buildkite::TestCollector::MinitestPlugin | |
| 31 30 |  | 
| 32 31 | 
             
                def as_hash
         | 
| 33 32 | 
             
                  strip_invalid_utf8_chars(
         | 
| 34 | 
            -
                    id: id,
         | 
| 35 33 | 
             
                    scope: example.class.name,
         | 
| 36 34 | 
             
                    name: example.name,
         | 
| 37 35 | 
             
                    location: location,
         | 
| @@ -3,12 +3,11 @@ | |
| 3 3 | 
             
            module Buildkite::TestCollector::RSpecPlugin
         | 
| 4 4 | 
             
              class Trace
         | 
| 5 5 | 
             
                attr_accessor :example, :failure_reason, :failure_expanded
         | 
| 6 | 
            -
                attr_reader : | 
| 6 | 
            +
                attr_reader :history
         | 
| 7 7 |  | 
| 8 8 | 
             
                FILE_PATH_REGEX = /^(.*?\.(rb|feature))/
         | 
| 9 9 |  | 
| 10 10 | 
             
                def initialize(example, history:, failure_reason: nil, failure_expanded: [])
         | 
| 11 | 
            -
                  @id = SecureRandom.uuid
         | 
| 12 11 | 
             
                  @example = example
         | 
| 13 12 | 
             
                  @history = history
         | 
| 14 13 | 
             
                  @failure_reason = failure_reason
         | 
| @@ -25,7 +24,6 @@ module Buildkite::TestCollector::RSpecPlugin | |
| 25 24 |  | 
| 26 25 | 
             
                def as_hash
         | 
| 27 26 | 
             
                  strip_invalid_utf8_chars(
         | 
| 28 | 
            -
                    id: id,
         | 
| 29 27 | 
             
                    scope: example.example_group.metadata[:full_description],
         | 
| 30 28 | 
             
                    name: example.description,
         | 
| 31 29 | 
             
                    location: example.location,
         | 
| @@ -24,7 +24,8 @@ module Buildkite::TestCollector | |
| 24 24 | 
             
                  Net::OpenTimeout,
         | 
| 25 25 | 
             
                  OpenSSL::SSL::SSLError,
         | 
| 26 26 | 
             
                  OpenSSL::SSL::SSLErrorWaitReadable,
         | 
| 27 | 
            -
                  EOFError
         | 
| 27 | 
            +
                  EOFError,
         | 
| 28 | 
            +
                  Errno::ETIMEDOUT
         | 
| 28 29 | 
             
                ]
         | 
| 29 30 |  | 
| 30 31 | 
             
                def self.tracer
         | 
| @@ -44,6 +45,8 @@ module Buildkite::TestCollector | |
| 44 45 | 
             
                      if (upload_attempts += 1) < MAX_UPLOAD_ATTEMPTS
         | 
| 45 46 | 
             
                        retry
         | 
| 46 47 | 
             
                      end
         | 
| 48 | 
            +
                    rescue StandardError => e
         | 
| 49 | 
            +
                      $stderr.puts "#{Buildkite::TestCollector::NAME} #{Buildkite::TestCollector::VERSION} experienced an error when sending your data, you may be missing some executions for this run."
         | 
| 47 50 | 
             
                    end
         | 
| 48 51 | 
             
                  end
         | 
| 49 52 | 
             
                end
         | 
| @@ -11,7 +11,6 @@ require "net/http" | |
| 11 11 | 
             
            require "time"
         | 
| 12 12 | 
             
            require "timeout"
         | 
| 13 13 | 
             
            require "tmpdir"
         | 
| 14 | 
            -
            require "securerandom"
         | 
| 15 14 |  | 
| 16 15 | 
             
            require "active_support/core_ext/object/blank"
         | 
| 17 16 | 
             
            require "active_support/core_ext/hash/indifferent_access"
         | 
| @@ -26,6 +25,7 @@ require_relative "test_collector/network" | |
| 26 25 | 
             
            require_relative "test_collector/object"
         | 
| 27 26 | 
             
            require_relative "test_collector/tracer"
         | 
| 28 27 | 
             
            require_relative "test_collector/session"
         | 
| 28 | 
            +
            require_relative "test_collector/uuid"
         | 
| 29 29 |  | 
| 30 30 | 
             
            module Buildkite
         | 
| 31 31 | 
             
              module TestCollector
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: buildkite-test_collector
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2. | 
| 4 | 
            +
              version: 2.3.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Buildkite
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2023- | 
| 11 | 
            +
            date: 2023-05-24 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         | 
| @@ -90,6 +90,7 @@ files: | |
| 90 90 | 
             
            - lib/buildkite/test_collector/session.rb
         | 
| 91 91 | 
             
            - lib/buildkite/test_collector/tracer.rb
         | 
| 92 92 | 
             
            - lib/buildkite/test_collector/uploader.rb
         | 
| 93 | 
            +
            - lib/buildkite/test_collector/uuid.rb
         | 
| 93 94 | 
             
            - lib/buildkite/test_collector/version.rb
         | 
| 94 95 | 
             
            - lib/minitest/buildkite_collector_plugin.rb
         | 
| 95 96 | 
             
            homepage: https://github.com/buildkite/test-collector-ruby
         |