Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
arm-stable chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsiaw committed Apr 1, 2024
1 parent 24f7b99 commit ad0a585
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Lint/ConstantDefinitionInBlock:
# Offense count: 11
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 57
Max: 58

# Offense count: 7
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
Expand Down
16 changes: 15 additions & 1 deletion lib/kaiser/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,19 @@ def prepare_cert_volume!
end
end

def selenium_node_image
return ENV['OVERRIDE_SELENIUM_NODE_IMAGE'] unless ENV['OVERRIDE_SELENIUM_NODE_IMAGE'].nil?

if RUBY_PLATFORM.start_with?('arm64') || RUBY_PLATFORM.start_with?('aarch64')
# use the seleniarm image because its more stable in arm procs
# somehow the x64 image does not do well under qemu under arm
return 'seleniarm/standalone-chromium'
end

# default to x64 image
'selenium/standalone-chrome-debug'
end

def ensure_setup
ensure_env

Expand All @@ -544,9 +557,10 @@ def ensure_setup
Config.config[:shared_names][:chrome],
"docker run -d
-p 5900:5900
--shm-size='2g'
--name #{Config.config[:shared_names][:chrome]}
--network #{Config.config[:networkname]}
selenium/standalone-chrome-debug"
#{selenium_node_image}"
)
run_if_dead(
Config.config[:shared_names][:nginx],
Expand Down
20 changes: 20 additions & 0 deletions spec/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,24 @@
expect(cli.send(:db_image)).to eq('postgres:alpine')
end
end

describe '#selenium_node_image' do
it 'for x86 machines returns normal selenium' do
cli = Kaiser::Cli.new
stub_const('RUBY_PLATFORM', 'x86_64-linux')
expect(cli.selenium_node_image).to eq('selenium/standalone-chrome-debug')
end

it 'for arm machines on mac' do
cli = Kaiser::Cli.new
stub_const('RUBY_PLATFORM', 'arm64-darwin23')
expect(cli.selenium_node_image).to eq('seleniarm/standalone-chromium')
end

it 'for arm machines on linux' do
cli = Kaiser::Cli.new
stub_const('RUBY_PLATFORM', 'arch64-linux')
expect(cli.selenium_node_image).to eq('seleniarm/standalone-chromium')
end
end
end

0 comments on commit ad0a585

Please sign in to comment.