diff --git a/.travis.yml b/.travis.yml index 6d1498b..6c13f28 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,6 @@ install: script: - "export EXCEPT_DEPLOYED=true" - - "if [[ $TRAVIS_PULL_REQUEST == 'false' ]]; then export EXCEPT_DEPLOYED=false; fi" - "bundle exec rspec spec" matrix: diff --git a/spec/helpers.rb b/spec/helpers.rb index 7577419..a53a714 100644 --- a/spec/helpers.rb +++ b/spec/helpers.rb @@ -37,8 +37,33 @@ def initialize(version = "4.2") @base_url = "https://#{WEB_ENV_HOST}/" end + def launch_eb_environemnts + run_in_rails_app_root_dir do + unless system("./launch_eb.sh") + raise "Could not create eb environments" + end + end + + end + + def terminate_eb_environments + env = WEB_ENV_NAME + run_in_rails_app_root_dir do + unless system("eb terminate --force #{env}") + raise "Could not terminate environment #{env}" + end + end + env = WORKER_ENV_NAME + run_in_rails_app_root_dir do + unless system("eb terminate --force #{env}") + raise "Could not terminate environment #{env}" + end + end + end + def deploy use_gem do + launch_eb_environemnts deploy_to_environment(WEB_ENV_NAME) deploy_to_environment(WORKER_ENV_NAME) end diff --git a/spec/integration/rails-app-4.2/.ebextensions/set_worker_queue.config b/spec/integration/rails-app-4.2/.ebextensions/set_worker_queue.config new file mode 100644 index 0000000..1c78002 --- /dev/null +++ b/spec/integration/rails-app-4.2/.ebextensions/set_worker_queue.config @@ -0,0 +1,4 @@ +option_settings: + - namespace: aws:elasticbeanstalk:sqsd + option_name: WorkerQueueURL + value: https://sqs.eu-central-1.amazonaws.com/103493342764/active_elastic_job_integration_testing diff --git a/spec/integration/rails-app-4.2/launch_eb.sh b/spec/integration/rails-app-4.2/launch_eb.sh new file mode 100755 index 0000000..8c0b056 --- /dev/null +++ b/spec/integration/rails-app-4.2/launch_eb.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +eb create -v -t web -s -c active-elastic-job web-env +eb create -v -t worker -s worker-env +eb setenv -e web-env SECRET_KEY_BASE=secret AWS_REGION=eu-central-1 +eb setenv -e worker-env SECRET_KEY_BASE=secret AWS_REGION=eu-central-1 WEB_ENV_HOST=active-elastic-job.eu-central-1.elasticbeanstalk.com WEB_ENV_PORT=443 PROCESS_ACTIVE_ELASTIC_JOBS=true diff --git a/spec/integration/rails-app-5.1/.ebextensions/set_worker_queue.config b/spec/integration/rails-app-5.1/.ebextensions/set_worker_queue.config new file mode 100644 index 0000000..1c78002 --- /dev/null +++ b/spec/integration/rails-app-5.1/.ebextensions/set_worker_queue.config @@ -0,0 +1,4 @@ +option_settings: + - namespace: aws:elasticbeanstalk:sqsd + option_name: WorkerQueueURL + value: https://sqs.eu-central-1.amazonaws.com/103493342764/active_elastic_job_integration_testing diff --git a/spec/integration/rails-app-5.1/.elasticbeanstalk/config.yml b/spec/integration/rails-app-5.1/.elasticbeanstalk/config.yml index 65f20e8..fef64d9 100644 --- a/spec/integration/rails-app-5.1/.elasticbeanstalk/config.yml +++ b/spec/integration/rails-app-5.1/.elasticbeanstalk/config.yml @@ -1,6 +1,6 @@ branch-defaults: default: - environment: web-env + environment: null group_suffix: null global: application_name: active_elastic_job diff --git a/spec/integration/rails-app-5.1/launch_eb.sh b/spec/integration/rails-app-5.1/launch_eb.sh new file mode 100755 index 0000000..8c0b056 --- /dev/null +++ b/spec/integration/rails-app-5.1/launch_eb.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +eb create -v -t web -s -c active-elastic-job web-env +eb create -v -t worker -s worker-env +eb setenv -e web-env SECRET_KEY_BASE=secret AWS_REGION=eu-central-1 +eb setenv -e worker-env SECRET_KEY_BASE=secret AWS_REGION=eu-central-1 WEB_ENV_HOST=active-elastic-job.eu-central-1.elasticbeanstalk.com WEB_ENV_PORT=443 PROCESS_ACTIVE_ELASTIC_JOBS=true diff --git a/spec/integration/standard_scenarios_spec.rb b/spec/integration/standard_scenarios_spec.rb index 89d8d16..4b82e6e 100644 --- a/spec/integration/standard_scenarios_spec.rb +++ b/spec/integration/standard_scenarios_spec.rb @@ -9,6 +9,10 @@ @rails_app.deploy end + after(:all) do + @rails_app.terminate_eb_environments + end + it "posts a job to the queue and processes it" do expect(@rails_app.fetch_random_strings).to_not include(random_string) @rails_app.create_random_string(random_string)