From ce14e1edf8daf4fe5081b05cfc12896c596c2d0b Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 16 Aug 2018 13:34:05 -0500 Subject: [PATCH 1/8] Integration tests with Hatchet --- .gitignore | 1 + Gemfile | 4 +++ Gemfile.lock | 66 +++++++++++++++++++++++++++++++++++++ hatchet.json | 5 +++ hatchet.lock | 3 ++ spec/hatchet/python_spec.rb | 10 ++++++ spec/spec_helper.rb | 23 +++++++++++++ 7 files changed, 112 insertions(+) create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 hatchet.json create mode 100644 hatchet.lock create mode 100644 spec/hatchet/python_spec.rb create mode 100644 spec/spec_helper.rb diff --git a/.gitignore b/.gitignore index 6d3aa82..a08e2c1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ site .DS_Store /.envrc +repos/* diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..a57a09f --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +source "https://rubygems.org" + +gem "rspec" +gem "heroku_hatchet" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..ad25b4d --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,66 @@ +GEM + remote: https://rubygems.org/ + specs: + activesupport (5.2.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + concurrent-ruby (1.0.5) + diff-lcs (1.3) + erubis (2.7.0) + excon (0.62.0) + heroics (0.0.24) + erubis (~> 2.0) + excon + moneta + multi_json (>= 1.9.2) + heroku_hatchet (4.0.2) + excon (~> 0) + minitest-retry (~> 0.1.9) + platform-api (~> 2) + repl_runner (~> 0.0.3) + rrrretry (~> 1) + thor (~> 0) + threaded (~> 0) + i18n (1.1.0) + concurrent-ruby (~> 1.0) + minitest (5.11.3) + minitest-retry (0.1.9) + minitest (>= 5.0) + moneta (0.8.1) + multi_json (1.13.1) + platform-api (2.1.0) + heroics (~> 0.0.23) + moneta (~> 0.8.1) + repl_runner (0.0.3) + activesupport + rrrretry (1.0.0) + rspec (3.8.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-core (3.8.0) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.0) + thor (0.20.0) + thread_safe (0.3.6) + threaded (0.0.4) + tzinfo (1.2.5) + thread_safe (~> 0.1) + +PLATFORMS + ruby + +DEPENDENCIES + heroku_hatchet + rspec + +BUNDLED WITH + 1.16.2 diff --git a/hatchet.json b/hatchet.json new file mode 100644 index 0000000..20ed7da --- /dev/null +++ b/hatchet.json @@ -0,0 +1,5 @@ +{ + "python": [ + "heroku/python-getting-started" + ] +} diff --git a/hatchet.lock b/hatchet.lock new file mode 100644 index 0000000..1e334cb --- /dev/null +++ b/hatchet.lock @@ -0,0 +1,3 @@ +--- +- - "./repos/python/python-getting-started" + - f56b90499ec11e1c9576da2f8c7331300e189db3 diff --git a/spec/hatchet/python_spec.rb b/spec/hatchet/python_spec.rb new file mode 100644 index 0000000..5ae95ed --- /dev/null +++ b/spec/hatchet/python_spec.rb @@ -0,0 +1,10 @@ +require_relative '../spec_helper' + +describe "Python!!!!!!!!!!!" do + it "🐍" do + Hatchet::Runner.new('python-getting-started', stack: DEFAULT_STACK).deploy do |app| + expect(app.output).to match(/Installing pip/) + expect(app.run('python -V')).to match(/3.6.6/) + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..b94f3bf --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,23 @@ +ENV['HATCHET_BUILDPACK_BASE'] = 'https://github.com/heroku/heroku-buildpack-python.git' + +require 'rspec/core' +require 'rspec/retry' +require 'hatchet' + +require 'date' + +RSpec.configure do |config| + config.full_backtrace = true + config.verbose_retry = true # show retry status in spec process + config.default_retry_count = 2 if ENV['IS_RUNNING_ON_CI'] # retry all tests that fail again + config.expect_with :rspec do |c| + c.syntax = :expect + end +end + +if ENV['TRAVIS'] + # Don't execute tests against "merge" commits + exit 0 if ENV['TRAVIS_PULL_REQUEST'] != 'false' && ENV['TRAVIS_BRANCH'] == 'master' +end + +DEFAULT_STACK = 'heroku-16' \ No newline at end of file From d44256235242b4a0e1d126c7546617accd64949c Mon Sep 17 00:00:00 2001 From: schneems Date: Thu, 16 Aug 2018 14:16:28 -0500 Subject: [PATCH 2/8] Add retry gem --- Gemfile | 1 + Gemfile.lock | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Gemfile b/Gemfile index a57a09f..f131f31 100644 --- a/Gemfile +++ b/Gemfile @@ -2,3 +2,4 @@ source "https://rubygems.org" gem "rspec" gem "heroku_hatchet" +gem 'rspec-retry' diff --git a/Gemfile.lock b/Gemfile.lock index ad25b4d..9a1f358 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,6 +48,8 @@ GEM rspec-mocks (3.8.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) + rspec-retry (0.6.1) + rspec-core (> 3.3) rspec-support (3.8.0) thor (0.20.0) thread_safe (0.3.6) @@ -61,6 +63,7 @@ PLATFORMS DEPENDENCIES heroku_hatchet rspec + rspec-retry BUNDLED WITH 1.16.2 From 2efe514b145b6dd4491b33ef6ab78140b867c1b6 Mon Sep 17 00:00:00 2001 From: Casey Faist Date: Tue, 21 Aug 2018 15:11:26 -0400 Subject: [PATCH 3/8] setup travis rspecting --- .travis.yml | 63 ++++++++++++++++++++++++++++++++++------------------ hatchet.json | 1 + 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index f2e12fe..ad3e42b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,25 +1,44 @@ -language: bash +language: ruby dist: trusty +rvm: +- 2.4.4 +before_script: + - gem install bundler -v 1.16.2 + - bundle exec rake hatchet:setup_travis +addons: + apt: + sources: + - heroku + packages: + - heroku-toolbelt jobs: include: - - stage: "Bash linting (shellcheck)" - sudo: false - before_install: - - wget -c https://goo.gl/ZzKHFv -O - | tar -xvJ -C /tmp/ - - PATH="/tmp/shellcheck-latest:$PATH" - script: make check - - - stage: "Stack Tests" - services: docker - env: STACK=heroku-18 - script: ./tests.sh - - - stage: "Stack Tests" - services: docker - env: STACK=heroku-16 - script: ./tests.sh - - - stage: "Stack Tests" - services: docker - env: STACK=cedar-14 - script: ./tests.sh + - stage: Bash linting (shellcheck) + sudo: false + before_install: + - wget -c https://goo.gl/ZzKHFv -O - | tar -xvJ -C /tmp/ + - PATH="/tmp/shellcheck-latest:$PATH" + script: make check + - stage: Stack Tests + services: docker + env: STACK=heroku-18 + script: "./tests.sh" + - stage: Stack Tests + services: docker + env: STACK=heroku-16 + script: "./tests.sh" + - stage: Stack Tests + services: docker + env: STACK=cedar-14 + script: "./tests.sh" + - stage: Stack Tests + services: docker + env: STACK=heroku-16 + script: "rspec" +env: + global: + - HATCHET_RETRIES=3 + - IS_RUNNING_ON_CI=true + - HATCHET_APP_LIMIT=5 + - secure: yjtlPE5FbVxTKnjUy/tZUBgSEf4qADD3QOxtgziuid73S0U/1IEXlMGFULsQzIjtlHKmHeywZqpVVEpthIH4RuT7uoX1Pb7SSM/g0T8fT3VoEFbFK1uYl0oZQbUS4Klxv9tPiumj8if3m6ULEGIz1X0wZcMOC0tMLwVCnwmap0E= + - secure: ZeFTHWwnpIKE9nAqs88ocmiQh7bKce84lilGm5J23nf3N6V4wNyLwqlkvsM008WGBCaOg9AUx7ZunasT0ANsR5gLP3eV2UUg7ILdRgV2Gy13eNRFheC4PHdN92RqQ3aKoqlIv2K999xlhVjod0NzhkQQXB6PddfQINbuU7ks6As= diff --git a/hatchet.json b/hatchet.json index 20ed7da..cbe7dd4 100644 --- a/hatchet.json +++ b/hatchet.json @@ -1,5 +1,6 @@ { "python": [ "heroku/python-getting-started" + // "pyhatchery/x" <- namespace of python test org ] } From e5830fd50d5c76f10ca4c4445960f840f54d8f94 Mon Sep 17 00:00:00 2001 From: Casey Faist Date: Tue, 21 Aug 2018 15:17:10 -0400 Subject: [PATCH 4/8] correct travisyaml indenting --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ad3e42b..6dbc546 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,8 +37,8 @@ jobs: script: "rspec" env: global: - - HATCHET_RETRIES=3 - - IS_RUNNING_ON_CI=true - - HATCHET_APP_LIMIT=5 + - HATCHET_RETRIES=3 + - IS_RUNNING_ON_CI=true + - HATCHET_APP_LIMIT=5 - secure: yjtlPE5FbVxTKnjUy/tZUBgSEf4qADD3QOxtgziuid73S0U/1IEXlMGFULsQzIjtlHKmHeywZqpVVEpthIH4RuT7uoX1Pb7SSM/g0T8fT3VoEFbFK1uYl0oZQbUS4Klxv9tPiumj8if3m6ULEGIz1X0wZcMOC0tMLwVCnwmap0E= - secure: ZeFTHWwnpIKE9nAqs88ocmiQh7bKce84lilGm5J23nf3N6V4wNyLwqlkvsM008WGBCaOg9AUx7ZunasT0ANsR5gLP3eV2UUg7ILdRgV2Gy13eNRFheC4PHdN92RqQ3aKoqlIv2K999xlhVjod0NzhkQQXB6PddfQINbuU7ks6As= From b53d211d0197a06fb38cb35dd13f0df342655328 Mon Sep 17 00:00:00 2001 From: Casey Faist Date: Tue, 21 Aug 2018 15:21:46 -0400 Subject: [PATCH 5/8] add rake to gemfile --- .travis.yml | 4 +--- Gemfile | 3 ++- Gemfile.lock | 4 +++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6dbc546..5dae543 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,9 +31,7 @@ jobs: services: docker env: STACK=cedar-14 script: "./tests.sh" - - stage: Stack Tests - services: docker - env: STACK=heroku-16 + - stage: Hatchet Integration script: "rspec" env: global: diff --git a/Gemfile b/Gemfile index f131f31..9b33624 100644 --- a/Gemfile +++ b/Gemfile @@ -2,4 +2,5 @@ source "https://rubygems.org" gem "rspec" gem "heroku_hatchet" -gem 'rspec-retry' +gem "rspec-retry" +gem "rake" diff --git a/Gemfile.lock b/Gemfile.lock index 9a1f358..621cd72 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -33,6 +33,7 @@ GEM platform-api (2.1.0) heroics (~> 0.0.23) moneta (~> 0.8.1) + rake (12.3.1) repl_runner (0.0.3) activesupport rrrretry (1.0.0) @@ -62,8 +63,9 @@ PLATFORMS DEPENDENCIES heroku_hatchet + rake rspec rspec-retry BUNDLED WITH - 1.16.2 + 1.16.3 From 3733383ad61f20484b51154b49f03bb82b19112d Mon Sep 17 00:00:00 2001 From: Casey Faist Date: Tue, 21 Aug 2018 15:25:00 -0400 Subject: [PATCH 6/8] add Rakefile --- Rakefile | 1 + 1 file changed, 1 insertion(+) create mode 100644 Rakefile diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..72c0f9e --- /dev/null +++ b/Rakefile @@ -0,0 +1 @@ +require 'hatchet/tasks' \ No newline at end of file From 3835aca004b948ce922df0cb244b3f28c07f19a1 Mon Sep 17 00:00:00 2001 From: Casey Faist Date: Tue, 21 Aug 2018 15:51:11 -0400 Subject: [PATCH 7/8] use bundle syntax to rspec --- .travis.yml | 8 ++++---- hatchet.json | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5dae543..9bdc47a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,20 +19,20 @@ jobs: - wget -c https://goo.gl/ZzKHFv -O - | tar -xvJ -C /tmp/ - PATH="/tmp/shellcheck-latest:$PATH" script: make check - - stage: Stack Tests + - stage: Stack Unit Tests services: docker env: STACK=heroku-18 script: "./tests.sh" - - stage: Stack Tests + - stage: Stack Unit Tests services: docker env: STACK=heroku-16 script: "./tests.sh" - - stage: Stack Tests + - stage: Stack Unit Tests services: docker env: STACK=cedar-14 script: "./tests.sh" - stage: Hatchet Integration - script: "rspec" + script: "bundle exec rspec" env: global: - HATCHET_RETRIES=3 diff --git a/hatchet.json b/hatchet.json index cbe7dd4..20ed7da 100644 --- a/hatchet.json +++ b/hatchet.json @@ -1,6 +1,5 @@ { "python": [ "heroku/python-getting-started" - // "pyhatchery/x" <- namespace of python test org ] } From c61e61c15352eddd7fb0cbefe60cce61a0bdd122 Mon Sep 17 00:00:00 2001 From: Casey Faist Date: Wed, 5 Sep 2018 15:53:42 -0400 Subject: [PATCH 8/8] add missing newline --- spec/spec_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b94f3bf..d8a55da 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -20,4 +20,4 @@ if ENV['TRAVIS'] exit 0 if ENV['TRAVIS_PULL_REQUEST'] != 'false' && ENV['TRAVIS_BRANCH'] == 'master' end -DEFAULT_STACK = 'heroku-16' \ No newline at end of file +DEFAULT_STACK = 'heroku-16'