From 777f2ebb1a636cb7891eecf6462ff2ef851bf2c7 Mon Sep 17 00:00:00 2001 From: niceking Date: Tue, 4 Apr 2023 17:04:46 +1200 Subject: [PATCH 1/4] remove websocket dependancy --- Gemfile.lock | 2 -- buildkite-test_collector.gemspec | 1 - 2 files changed, 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 98e6f71..d072ba2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,6 @@ PATH specs: buildkite-test_collector (2.1.0.pre) activesupport (>= 4.2) - websocket (~> 1.2) GEM remote: https://rubygems.org/ @@ -34,7 +33,6 @@ GEM rspec-support (3.10.3) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - websocket (1.2.9) PLATFORMS ruby diff --git a/buildkite-test_collector.gemspec b/buildkite-test_collector.gemspec index 632c3c9..c4d98d2 100644 --- a/buildkite-test_collector.gemspec +++ b/buildkite-test_collector.gemspec @@ -25,7 +25,6 @@ Gem::Specification.new do |spec| spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0") spec.add_dependency "activesupport", ">= 4.2" - spec.add_dependency "websocket", '~> 1.2' spec.add_development_dependency "rspec-core", '~> 3.10' spec.add_development_dependency "rspec-expectations", '~> 3.10' From 0dd23903e8ed14cac3bfff4fe0ca1d0c641b1ce2 Mon Sep 17 00:00:00 2001 From: niceking Date: Tue, 4 Apr 2023 17:05:59 +1200 Subject: [PATCH 2/4] remove request to upload api with websocket format --- lib/buildkite/test_collector/http_client.rb | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/lib/buildkite/test_collector/http_client.rb b/lib/buildkite/test_collector/http_client.rb index e753c04..ae5b6cc 100644 --- a/lib/buildkite/test_collector/http_client.rb +++ b/lib/buildkite/test_collector/http_client.rb @@ -10,24 +10,6 @@ def initialize(url) @authorization_header = "Token token=\"#{Buildkite::TestCollector.api_token}\"" end - def post - contact_uri = URI.parse(url) - - http = Net::HTTP.new(contact_uri.host, contact_uri.port) - http.use_ssl = contact_uri.scheme == "https" - - contact = Net::HTTP::Post.new(contact_uri.path, { - "Authorization" => authorization_header, - "Content-Type" => "application/json", - }) - contact.body = { - run_env: Buildkite::TestCollector::CI.env, - format: "websocket" - }.to_json - - http.request(contact) - end - def post_json(data) contact_uri = URI.parse(url) From 809fb5cf53917e538d2bb7c174afe2b182ce0ef9 Mon Sep 17 00:00:00 2001 From: niceking Date: Tue, 4 Apr 2023 17:06:09 +1200 Subject: [PATCH 3/4] update design doc --- DESIGN.md | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/DESIGN.md b/DESIGN.md index 65c2b29..d0daf35 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -2,17 +2,7 @@ ## Threads -The Buildkite ruby collector uses websockets and ActionCable to send and -receive data with Buildkite. Execution information starts transmitting as soon -as possible, without waiting for the test suite to finish running. - -This gem uses 3 ruby threads: - -* main thread: acts as the producer. It collects span data from the - test suite and enqueues it into the send queue. -* write thread: acts as the consumer. Removes data from the send queue and - sends it to Buildkite. -* read thread: receives and processes messages from Buildkite. +The Buildkite ruby collector uses threads to send data to the Upload API in the background. When the test suite has finished running, the collector waits UPLOAD_SESSION_TIMEOUT seconds for the Upload API requests to finish before exiting. ## Data From 5aea53fee495953744f0bb7302c7cf3815364ea9 Mon Sep 17 00:00:00 2001 From: niceking Date: Tue, 4 Apr 2023 17:17:20 +1200 Subject: [PATCH 4/4] remove socket related things --- lib/buildkite/test_collector.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/buildkite/test_collector.rb b/lib/buildkite/test_collector.rb index e02213f..64d9136 100644 --- a/lib/buildkite/test_collector.rb +++ b/lib/buildkite/test_collector.rb @@ -8,13 +8,10 @@ module TestCollector require "json" require "logger" require "net/http" -require "openssl" require "time" require "timeout" require "tmpdir" require "securerandom" -require "socket" -require "websocket" require "active_support/core_ext/object/blank" require "active_support/core_ext/hash/indifferent_access"