From 17cbac8c39715aff638879efd1ece18b3c41645a Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 27 May 2016 09:47:31 +0200 Subject: [PATCH] Improved restarting zammad after object attribute changes. --- .gitlab-ci.yml | 196 ++++++++---------- app/models/object_manager/attribute.rb | 9 +- .../observer/app_version_restart_job.rb | 10 + script/build/test_cleanup.sh | 4 + script/build/test_shutdown.sh | 7 +- script/build/test_startup.sh | 5 + 6 files changed, 111 insertions(+), 120 deletions(-) create mode 100644 app/models/observer/app_version_restart_job.rb create mode 100755 script/build/test_cleanup.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b1471d4a8..b2ccc4b11 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -337,10 +337,9 @@ test:browser:twitter_ff: - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT" - RAILS_ENV=test rake db:create - cp contrib/auto_wizard_test.json auto_wizard.json - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - ruby -I test/ test/integration/twitter_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - ruby -I test/ test/integration/twitter_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:facebook_ff: stage: browser @@ -354,10 +353,9 @@ test:browser:facebook_ff: - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT" - RAILS_ENV=test rake db:create - cp contrib/auto_wizard_test.json auto_wizard.json - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - ruby -I test/ test/integration/facebook_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - ruby -I test/ test/integration/facebook_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:autowizard_ff: stage: browser @@ -370,10 +368,9 @@ test:browser:autowizard_ff: - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT" - RAILS_ENV=test rake db:create - cp contrib/auto_wizard_example.json auto_wizard.json - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - ruby -I test/ test/integration/auto_wizard_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - ruby -I test/ test/integration/auto_wizard_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:ff_1_mysql: stage: browser @@ -391,10 +388,9 @@ test:browser:core:ff_1_mysql: - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 1 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:ff_2_mysql: stage: browser @@ -412,10 +408,9 @@ test:browser:core:ff_2_mysql: - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 2 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:ff_3_mysql: stage: browser @@ -429,10 +424,9 @@ test:browser:core:ff_3_mysql: - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT" - script/build/test_slice_tests.sh 3 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:ff_4_mysql: stage: browser @@ -450,10 +444,9 @@ test:browser:core:ff_4_mysql: - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 4 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:ff_5_mysql: stage: browser @@ -471,10 +464,9 @@ test:browser:core:ff_5_mysql: - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 5 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:ff_1_postgresql: stage: browser @@ -492,10 +484,9 @@ test:browser:core:ff_1_postgresql: - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 1 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:ff_2_postgresql: stage: browser @@ -513,10 +504,9 @@ test:browser:core:ff_2_postgresql: - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 2 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:ff_3_postgresql: stage: browser @@ -530,10 +520,9 @@ test:browser:core:ff_3_postgresql: - export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT" - script/build/test_slice_tests.sh 3 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:ff_4_postgresql: stage: browser @@ -551,10 +540,9 @@ test:browser:core:ff_4_postgresql: - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 4 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:ff_5_postgresql: stage: browser @@ -572,10 +560,9 @@ test:browser:core:ff_5_postgresql: - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 5 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:chrome_1_mysql: stage: browser @@ -593,10 +580,9 @@ test:browser:core:chrome_1_mysql: - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 1 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:chrome_2_mysql: stage: browser @@ -614,10 +600,9 @@ test:browser:core:chrome_2_mysql: - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 2 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:chrome_3_mysql: stage: browser @@ -635,10 +620,9 @@ test:browser:core:chrome_3_mysql: - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 3 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:chrome_4_mysql: stage: browser @@ -656,10 +640,9 @@ test:browser:core:chrome_4_mysql: - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 4 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:chrome_5_mysql: stage: browser @@ -677,10 +660,9 @@ test:browser:core:chrome_5_mysql: - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 5 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:chrome_1_postgresql: stage: browser @@ -698,10 +680,9 @@ test:browser:core:chrome_1_postgresql: - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 1 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:chrome_2_postgresql: stage: browser @@ -719,10 +700,9 @@ test:browser:core:chrome_2_postgresql: - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 2 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:chrome_3_postgresql: stage: browser @@ -740,10 +720,9 @@ test:browser:core:chrome_3_postgresql: - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 3 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 test:browser:core:chrome_4_postgresql: stage: browser @@ -761,10 +740,9 @@ test:browser:core:chrome_4_postgresql: - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 4 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:core:chrome_5_postgresql: stage: browser @@ -782,10 +760,9 @@ test:browser:core:chrome_5_postgresql: - unset MAILBOX_MANUAL2 - script/build/test_slice_tests.sh 5 - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - rake test:browser || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:integration:twitter_chrome: stage: browser @@ -798,10 +775,9 @@ test:browser:integration:twitter_chrome: - export BROWSER_URL=http://$IP:$BROWSER_PORT - RAILS_ENV=test rake db:create - cp contrib/auto_wizard_test.json auto_wizard.json - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - ruby -I test/ test/integration/twitter_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - ruby -I test/ test/integration/twitter_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:integration:facebook_chrome: stage: browser @@ -814,10 +790,9 @@ test:browser:integration:facebook_chrome: - export BROWSER_URL=http://$IP:$BROWSER_PORT - RAILS_ENV=test rake db:create - cp contrib/auto_wizard_test.json auto_wizard.json - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - ruby -I test/ test/integration/facebook_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - ruby -I test/ test/integration/facebook_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:integration:otrs_chrome: stage: browser @@ -828,10 +803,9 @@ test:browser:integration:otrs_chrome: script: - export BROWSER_URL=http://$IP:$BROWSER_PORT - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - ruby -I test/ test/integration/otrs_import_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - ruby -I test/ test/integration/otrs_import_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:integration:autowizard_chrome: stage: browser @@ -843,10 +817,9 @@ test:browser:integration:autowizard_chrome: - export BROWSER_URL=http://$IP:$BROWSER_PORT - RAILS_ENV=test rake db:create - cp contrib/auto_wizard_example.json auto_wizard.json - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - ruby -I test/ test/integration/auto_wizard_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - ruby -I test/ test/integration/auto_wizard_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 test:browser:integration:zendesk_chrome: stage: browser @@ -857,7 +830,6 @@ test:browser:integration:zendesk_chrome: script: - export BROWSER_URL=http://$IP:$BROWSER_PORT - RAILS_ENV=test rake db:create - - script/bootstrap.sh - - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT - - ruby -I test/ test/integration/zendesk_import_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT + - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 + - ruby -I test/ test/integration/zendesk_import_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 + - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 diff --git a/app/models/object_manager/attribute.rb b/app/models/object_manager/attribute.rb index fe774102b..67cf7e7e9 100644 --- a/app/models/object_manager/attribute.rb +++ b/app/models/object_manager/attribute.rb @@ -595,11 +595,8 @@ returns if execute_count != 0 if ENV['APP_RESTART_CMD'] AppVersion.set(true, 'restart_auto') - pid = fork do - sleep 5 - system(ENV['APP_RESTART_CMD']) - Process.exit!(true) - end + sleep 4 + Delayed::Job.enqueue(Observer::AppVersionRestartJob.new(ENV['APP_RESTART_CMD'])) else AppVersion.set(true, 'restart_manual') end @@ -622,7 +619,7 @@ returns raise 'Only letters from a-z, numbers from 0-9, and _ are allowed' elsif name !~ /[a-z]/ raise 'At least one letters is needed' - elsif name =~ /^(destroy|true|false|integer|select|drop|create|alter|index|table)$/i + elsif name =~ /^(destroy|true|false|integer|select|drop|create|alter|index|table)$/ raise "#{name} is a reserved word, please choose a different one" end true diff --git a/app/models/observer/app_version_restart_job.rb b/app/models/observer/app_version_restart_job.rb new file mode 100644 index 000000000..a30f6c531 --- /dev/null +++ b/app/models/observer/app_version_restart_job.rb @@ -0,0 +1,10 @@ +class Observer::AppVersionRestartJob + def initialize(cmd) + @cmd = cmd + end + + def perform + output = `#{@cmd}` + Rails.logger.info "CMD: #{@cmd} -> #{output}" + end +end diff --git a/script/build/test_cleanup.sh b/script/build/test_cleanup.sh new file mode 100755 index 000000000..f614a27e9 --- /dev/null +++ b/script/build/test_cleanup.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +rake db:drop RAILS_ENV=test +rake db:drop RAILS_ENV=production \ No newline at end of file diff --git a/script/build/test_shutdown.sh b/script/build/test_shutdown.sh index 9486c4344..b2da7e105 100755 --- a/script/build/test_shutdown.sh +++ b/script/build/test_shutdown.sh @@ -3,6 +3,8 @@ RAILS_ENV=$1 APP_PORT=$2 WS_PORT=$3 EXIT=$4 || 0 +WITH_DB=$5 || 0 + SERVER_PID='tmp/pids/server.pid' script/scheduler.rb stop @@ -13,7 +15,8 @@ if [ -f $SERVER_PID ]; then kill -9 $(cat $SERVER_PID) fi -rake db:drop RAILS_ENV=test -rake db:drop RAILS_ENV=production +if WITH_DB; then + script/build/test_cleanup.sh +fi exit $EXIT diff --git a/script/build/test_startup.sh b/script/build/test_startup.sh index f12d731df..6e9ca69c8 100755 --- a/script/build/test_startup.sh +++ b/script/build/test_startup.sh @@ -2,6 +2,11 @@ RAILS_ENV=$1 APP_PORT=$2 WS_PORT=$3 +WITH_DB=$4 || 0 + +if WITH_DB; then + script/bootstrap.sh +fi export ZAMMAD_SETTING_TTL=15