Maintenance: Run browser tests for random DB service.

This commit is contained in:
Thorsten Eckel 2019-03-26 01:26:59 +01:00 committed by Martin Edenhofer
parent f72b44234e
commit 50ca3cde9c
2 changed files with 42 additions and 144 deletions

View file

@ -337,21 +337,12 @@ browser:build:
- public/assets/application-* - public/assets/application-*
- public/assets/print-* - public/assets/print-*
.services_browser_postgresql_template: &services_browser_postgresql_definition .services_browser_template: &services_browser_definition
services:
- name: registry.znuny.com/docker/zammad-postgresql:latest
alias: postgresql
- name: registry.znuny.com/docker/zammad-elasticsearch:latest
alias: elasticsearch
- name: docker.io/elgalu/selenium:3.14.0-p17
alias: selenium
- name: registry.znuny.com/docker/docker-imap-devel:latest
alias: mail
.services_browser_mysql_template: &services_browser_mysql_definition
services: services:
- name: registry.znuny.com/docker/zammad-mysql:latest - name: registry.znuny.com/docker/zammad-mysql:latest
alias: mysql alias: mysql
- name: registry.znuny.com/docker/zammad-postgresql:latest
alias: postgresql
- name: registry.znuny.com/docker/zammad-elasticsearch:latest - name: registry.znuny.com/docker/zammad-elasticsearch:latest
alias: elasticsearch alias: elasticsearch
- name: docker.io/elgalu/selenium:3.14.0-p17 - name: docker.io/elgalu/selenium:3.14.0-p17
@ -391,22 +382,13 @@ browser:build:
RAILS_ENV: "test" RAILS_ENV: "test"
BROWSER: "firefox" BROWSER: "firefox"
test:browser:core:capybara_chrome_postgresql: test:browser:core:capybara_chrome:
<<: *variables_capybara_chrome_definition <<: *variables_capybara_chrome_definition
<<: *services_browser_postgresql_definition <<: *services_browser_definition
test:browser:core:capybara_chrome_mysql: test:browser:core:capybara_ff:
<<: *variables_capybara_chrome_definition
<<: *services_browser_mysql_definition
test:browser:core:capybara_ff_postgresql:
<<: *variables_capybara_ff_definition <<: *variables_capybara_ff_definition
<<: *services_browser_postgresql_definition <<: *services_browser_definition
test:browser:core:capybara_ff_mysql:
<<: *variables_capybara_ff_definition
<<: *services_browser_mysql_definition
### API clients ### API clients
@ -460,99 +442,51 @@ test:browser:integration:api_client_php:
- bundle exec rake zammad:ci:test:start[with_elasticsearch] - bundle exec rake zammad:ci:test:start[with_elasticsearch]
- time bundle exec rails test --fail-fast test/browser - time bundle exec rails test --fail-fast test/browser
.test_browser_core_postgresql_template: &test_browser_core_postgresql_definition .test_browser_core_base_template: &test_browser_core_base_definition
<<: *test_browser_core_definition <<: *test_browser_core_definition
<<: *script_browser_slice_definition <<: *script_browser_slice_definition
<<: *services_browser_postgresql_definition <<: *services_browser_definition
.test_browser_core_mysql_template: &test_browser_core_mysql_definition
<<: *test_browser_core_definition
<<: *script_browser_slice_definition
<<: *services_browser_mysql_definition
#### Firefox #### Firefox
test:browser:core:ff_1_mysql: test:browser:core:ff_1:
<<: *test_browser_core_mysql_definition <<: *test_browser_core_base_definition
variables: variables:
<<: *variables_browser_definition <<: *variables_browser_definition
BROWSER: "firefox" BROWSER: "firefox"
TEST_SLICE: "1" TEST_SLICE: "1"
test:browser:core:ff_2_mysql: test:browser:core:ff_2:
<<: *test_browser_core_mysql_definition <<: *test_browser_core_base_definition
variables: variables:
<<: *variables_browser_definition <<: *variables_browser_definition
BROWSER: "firefox" BROWSER: "firefox"
TEST_SLICE: "2" TEST_SLICE: "2"
test:browser:core:ff_3_mysql: test:browser:core:ff_3:
<<: *test_browser_core_mysql_definition <<: *test_browser_core_base_definition
<<: *requires_mail_port_access <<: *requires_mail_port_access
variables: variables:
<<: *variables_browser_definition <<: *variables_browser_definition
BROWSER: "firefox" BROWSER: "firefox"
TEST_SLICE: "3" TEST_SLICE: "3"
test:browser:core:ff_4_mysql: test:browser:core:ff_4:
<<: *test_browser_core_mysql_definition <<: *test_browser_core_base_definition
variables: variables:
<<: *variables_browser_definition <<: *variables_browser_definition
BROWSER: "firefox" BROWSER: "firefox"
TEST_SLICE: "4" TEST_SLICE: "4"
test:browser:core:ff_5_mysql: test:browser:core:ff_5:
<<: *test_browser_core_mysql_definition <<: *test_browser_core_base_definition
variables: variables:
<<: *variables_browser_definition <<: *variables_browser_definition
BROWSER: "firefox" BROWSER: "firefox"
TEST_SLICE: "5" TEST_SLICE: "5"
test:browser:core:ff_6_mysql: test:browser:core:ff_6:
<<: *test_browser_core_mysql_definition <<: *test_browser_core_base_definition
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
TEST_SLICE: "6"
test:browser:core:ff_1_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
TEST_SLICE: "1"
test:browser:core:ff_2_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
TEST_SLICE: "2"
test:browser:core:ff_3_postgresql:
<<: *test_browser_core_postgresql_definition
<<: *requires_mail_port_access
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
TEST_SLICE: "3"
test:browser:core:ff_4_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
TEST_SLICE: "4"
test:browser:core:ff_5_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
TEST_SLICE: "5"
test:browser:core:ff_6_postgresql:
<<: *test_browser_core_postgresql_definition
variables: variables:
<<: *variables_browser_definition <<: *variables_browser_definition
BROWSER: "firefox" BROWSER: "firefox"
@ -560,85 +494,43 @@ test:browser:core:ff_6_postgresql:
### Chrome ### Chrome
test:browser:core:chrome_1_mysql: test:browser:core:chrome_1:
<<: *test_browser_core_mysql_definition <<: *test_browser_core_base_definition
variables: variables:
<<: *variables_browser_definition <<: *variables_browser_definition
BROWSER: "chrome" BROWSER: "chrome"
TEST_SLICE: "1" TEST_SLICE: "1"
test:browser:core:chrome_2_mysql: test:browser:core:chrome_2:
<<: *test_browser_core_mysql_definition <<: *test_browser_core_base_definition
variables: variables:
<<: *variables_browser_definition <<: *variables_browser_definition
BROWSER: "chrome" BROWSER: "chrome"
TEST_SLICE: "2" TEST_SLICE: "2"
test:browser:core:chrome_3_mysql: test:browser:core:chrome_3:
<<: *test_browser_core_mysql_definition <<: *test_browser_core_base_definition
variables: variables:
<<: *variables_browser_definition <<: *variables_browser_definition
BROWSER: "chrome" BROWSER: "chrome"
TEST_SLICE: "3" TEST_SLICE: "3"
test:browser:core:chrome_4_mysql: test:browser:core:chrome_4:
<<: *test_browser_core_mysql_definition <<: *test_browser_core_base_definition
variables: variables:
<<: *variables_browser_definition <<: *variables_browser_definition
BROWSER: "chrome" BROWSER: "chrome"
TEST_SLICE: "4" TEST_SLICE: "4"
test:browser:core:chrome_5_mysql: test:browser:core:chrome_5:
<<: *test_browser_core_mysql_definition <<: *test_browser_core_base_definition
variables: variables:
<<: *variables_browser_definition <<: *variables_browser_definition
BROWSER: "chrome" BROWSER: "chrome"
TEST_SLICE: "5" TEST_SLICE: "5"
test:browser:core:chrome_6_mysql: test:browser:core:chrome_6:
<<: *test_browser_core_mysql_definition <<: *test_browser_core_base_definition
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
TEST_SLICE: "6"
test:browser:core:chrome_1_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
TEST_SLICE: "1"
test:browser:core:chrome_2_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
TEST_SLICE: "2"
test:browser:core:chrome_3_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
TEST_SLICE: "3"
test:browser:core:chrome_4_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
TEST_SLICE: "4"
test:browser:core:chrome_5_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
TEST_SLICE: "5"
test:browser:core:chrome_6_postgresql:
<<: *test_browser_core_postgresql_definition
variables: variables:
<<: *variables_browser_definition <<: *variables_browser_definition
BROWSER: "chrome" BROWSER: "chrome"

View file

@ -4,13 +4,19 @@ cnf = YAML.load_file(File.join(__dir__, '../../config/database/database.yml'))
cnf.delete('default') cnf.delete('default')
database = ENV['ENFORCE_DB_SERVICE']
if !database
hostsfile = '/etc/hosts' hostsfile = '/etc/hosts'
database = %w[postgresql mysql].find do |possible_database| database = %w[postgresql mysql].shuffle.find do |possible_database|
File.foreach(hostsfile).any? { |l| l[possible_database] } File.foreach(hostsfile).any? { |l| l[possible_database] }
end end
end
raise "Can't find any supported database in #{hostsfile}." if database.nil? raise "Can't find any supported database in #{hostsfile}." if database.nil?
puts "NOTICE: Found/selected #{database} Database Service"
db_settings_map = { db_settings_map = {
'postgresql' => { 'postgresql' => {
'adapter' => 'postgresql', 'adapter' => 'postgresql',