bugsnag-maze-runner 7.27.0 → 7.28.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b2158a5376e4ff1d6c63a70eb138c33a2021aa7baff47f28882821e62a09fd0f
4
- data.tar.gz: cd74c9cc69173584b6bf4c28a7fbaffdc3e115db09b38bfc507242f14726689e
3
+ metadata.gz: 4a074f231fdb2489046d9e6ad85f601239d3375edbbffe7de28ad862bc66a881
4
+ data.tar.gz: afe8771d431a5988986ad0ae5982f24c866436eb10edc95afb81af5fb5d2b0a7
5
5
  SHA512:
6
- metadata.gz: 541182a68461d87cb7e2dd118cb6418fec9c4f3f2624622673ea12d16e695b81fd10ad6398e6a04c1446096a4c67e0b067f003687d326053258c20c77fc3e0cb
7
- data.tar.gz: f033d06ba478c06163397026626b180cabdcbf7f2b246878d7415905c0af8a3ca46c26a044dbbf111599cc0860445ace5c8eb89b74d3a0f1d94cb9be907e2573
6
+ metadata.gz: 1091d4188d165f6d1122a5a2a0275eda1ed818a550bf953c9a826f84950691ca86674bda0e11a007260a45742665c3d52630c614f1705daf88dc6ff86dec0b82
7
+ data.tar.gz: 59ec8f4f08c75411e9766c4379b841f39d1a7f3dc9f02988231fc99c229fb7affe226145f86499860a3b005cf2be9261fc0f6a8eea6151ead2515ef7c27b3e96
@@ -44,12 +44,6 @@ BeforeAll do
44
44
  Maze.run_uuid = SecureRandom.uuid
45
45
  $logger.info "UUID for this run: #{Maze.run_uuid}"
46
46
 
47
- # Determine public IP if enabled
48
- if Maze.config.aws_public_ip
49
- Maze.public_address = Maze::AwsPublicIp.new.address
50
- $logger.info "Public address: #{Maze.public_address}"
51
- end
52
-
53
47
  # Start mock server
54
48
  Maze::Server.start
55
49
  Maze::Server.set_response_delay_generator(Maze::Generator.new [Maze::Server::DEFAULT_RESPONSE_DELAY].cycle)
@@ -66,6 +60,18 @@ BeforeAll do
66
60
  # This must happen after any client hooks have run, so that they can set the server root
67
61
  Maze::DocumentServer.start unless Maze.config.document_server_root.nil?
68
62
 
63
+ # Determine public IP if enabled
64
+ if Maze.config.aws_public_ip
65
+ public_ip = Maze::AwsPublicIp.new
66
+ Maze.public_address = public_ip.address
67
+ $logger.info "Public address: #{Maze.public_address}"
68
+
69
+ unless Maze.config.document_server_root.nil?
70
+ Maze.public_document_server_address = public_ip.document_server_address
71
+ $logger.info "Public document server address: #{Maze.public_document_server_address}"
72
+ end
73
+ end
74
+
69
75
  # An initial setup for total success status
70
76
  $success = true
71
77
  end
@@ -1,16 +1,31 @@
1
1
  module Maze
2
2
  # Determines the public IP address and port when running on Buildkite with the Elastic CI Stack for AWS
3
3
  class AwsPublicIp
4
- attr_reader :address
4
+ attr_reader :host
5
+ attr_reader :port
6
+ attr_reader :document_server_port
7
+
8
+ def address
9
+ "#{@ip}:#{@port}"
10
+ end
11
+
12
+ def document_server_address
13
+ return nil if @document_server_port.nil?
14
+
15
+ "#{@ip}:#{@document_server_port}"
16
+ end
5
17
 
6
18
  def initialize
7
19
  # This class is only relevant on Buildkite
8
20
  return unless ENV['BUILDKITE']
9
21
 
10
- ip = determine_public_ip
11
- port = determine_public_port
22
+ @ip = determine_public_ip
23
+ @port = determine_public_port Maze.config.port
24
+
25
+ unless Maze.config.document_server_root.nil?
26
+ @document_server_port = determine_public_port Maze.config.document_server_port
27
+ end
12
28
 
13
- @address = "#{ip}:#{port}"
14
29
  end
15
30
 
16
31
  # Determines the public IP address of the running AWS instance
@@ -20,8 +35,9 @@ module Maze
20
35
  `curl --silent -XGET http://169.254.169.254/latest/meta-data/public-ipv4`
21
36
  end
22
37
 
23
- # Determines the external port of the running Docker container that's associated with the port of the mock server
24
- def determine_public_port
38
+ # Determines the external port of the running Docker container that's associated with the port given
39
+ # @param local_port Local port to find the external port for
40
+ def determine_public_port(local_port)
25
41
  port = 0
26
42
  count = 0
27
43
  max_attempts = 30
@@ -35,7 +51,7 @@ module Maze
35
51
  begin
36
52
  json_string = result[0][0].strip
37
53
  json_result = JSON.parse(json_string)
38
- port = json_result['NetworkSettings']['Ports']["#{Maze.config.port}/tcp"][0]['HostPort']
54
+ port = json_result['NetworkSettings']['Ports']["#{local_port}/tcp"][0]['HostPort']
39
55
  rescue StandardError
40
56
  $logger.error "Unable to parse public port from: #{json_string}"
41
57
  return 0
@@ -6,7 +6,7 @@ module Maze
6
6
  config = Maze.config
7
7
  config.app = Maze::Client::BitBarClientUtils.upload_app config.access_key,
8
8
  config.app
9
- if Maze.config.start_tunnel
9
+ if Maze::Client::BitBarClientUtils.use_local_tunnel?
10
10
  Maze::Client::BitBarClientUtils.start_local_tunnel config.sb_local,
11
11
  config.username,
12
12
  config.access_key
@@ -61,7 +61,7 @@ module Maze
61
61
 
62
62
  def stop_session
63
63
  super
64
- if Maze.config.start_tunnel
64
+ if Maze::Client::BitBarClientUtils.use_local_tunnel?
65
65
  Maze::Client::BitBarClientUtils.stop_local_tunnel
66
66
  end
67
67
  end
@@ -123,6 +123,10 @@ module Maze
123
123
  end
124
124
  end
125
125
 
126
+ def use_local_tunnel?
127
+ Maze.config.start_tunnel && !Maze.config.aws_public_ip
128
+ end
129
+
126
130
  # Starts the BitBar local tunnel
127
131
  #
128
132
  # @param sb_local [String] path to the SBSecureTunnel binary
@@ -4,11 +4,6 @@ module Maze
4
4
  class BitBarClient < BaseClient
5
5
  def start_session
6
6
  config = Maze.config
7
- if ENV['BUILDKITE']
8
- credentials = Maze::Client::BitBarClientUtils.account_credentials config.tms_uri
9
- config.username = credentials[:username]
10
- config.access_key = credentials[:access_key]
11
- end
12
7
  capabilities = ::Selenium::WebDriver::Remote::Capabilities.new
13
8
  capabilities['bitbar_apiKey'] = config.access_key
14
9
  browsers = YAML.safe_load(File.read("#{__dir__}/bb_browsers.yml"))
@@ -16,9 +11,15 @@ module Maze
16
11
  capabilities.merge! JSON.parse(config.capabilities_option)
17
12
  config.capabilities = capabilities
18
13
 
19
- Maze::Client::BitBarClientUtils.start_local_tunnel config.sb_local,
20
- config.username,
21
- config.access_key
14
+ if Maze::Client::BitBarClientUtils.use_local_tunnel?
15
+ credentials = Maze::Client::BitBarClientUtils.account_credentials config.tms_uri
16
+ config.username = credentials[:username]
17
+ config.access_key = credentials[:access_key]
18
+
19
+ Maze::Client::BitBarClientUtils.start_local_tunnel config.sb_local,
20
+ config.username,
21
+ config.access_key
22
+ end
22
23
 
23
24
  selenium_url = Maze.config.selenium_server_url
24
25
  Maze.driver = Maze::Driver::Browser.new :remote, selenium_url, config.capabilities
@@ -36,8 +37,10 @@ module Maze
36
37
 
37
38
  def stop_session
38
39
  super
39
- Maze::Client::BitBarClientUtils.stop_local_tunnel
40
- Maze::Client::BitBarClientUtils.release_account(Maze.config.tms_uri) if ENV['BUILDKITE']
40
+ if Maze::Client::BitBarClientUtils.use_local_tunnel?
41
+ Maze::Client::BitBarClientUtils.stop_local_tunnel
42
+ Maze::Client::BitBarClientUtils.release_account(Maze.config.tms_uri) if ENV['BUILDKITE']
43
+ end
41
44
  end
42
45
  end
43
46
  end
data/lib/maze.rb CHANGED
@@ -7,10 +7,11 @@ require_relative 'maze/timers'
7
7
  # Glues the various parts of MazeRunner together that need to be accessed globally,
8
8
  # providing an alternative to the proliferation of global variables or singletons.
9
9
  module Maze
10
- VERSION = '7.27.0'
10
+ VERSION = '7.28.0'
11
11
 
12
12
  class << self
13
- attr_accessor :check, :driver, :internal_hooks, :mode, :start_time, :dynamic_retry, :public_address, :run_uuid
13
+ attr_accessor :check, :driver, :internal_hooks, :mode, :start_time, :dynamic_retry, :public_address,
14
+ :public_document_server_address, :run_uuid
14
15
 
15
16
  def config
16
17
  @config ||= Maze::Configuration.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag-maze-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.27.0
4
+ version: 7.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Kirkland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-25 00:00:00.000000000 Z
11
+ date: 2023-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber