-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: App-type fixtures #532
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c04a56e
app_type testing: Added e2e app_type tests to existing features
Cawllec 2f20329
Fixtures: Add Mailman fixture
Cawllec 4ef55eb
Fixtures: Add Rack fixture
Cawllec 8dfa691
Fixtures: Added Rake fixture
Cawllec 0ad396a
Fixtures: Add Que fixture
Cawllec 3486ed2
Fixtures: Use existing Rack fixtures
Cawllec 832e9d4
Fixtures: Ensure environment variables are correct
Cawllec 7fda6c3
Fixutres: Clean-up unneccessary args
Cawllec d5f6c51
Fixtures: Update mailman fixture
Cawllec File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Gemfile.lock | ||
imjoehaines marked this conversation as resolved.
Show resolved
Hide resolved
|
||
payloads/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
ARG RUBY_VERSION | ||
FROM ruby:$RUBY_VERSION | ||
|
||
WORKDIR /bugsnag | ||
COPY temp-bugsnag-lib ./ | ||
|
||
ARG APP_PATH | ||
|
||
WORKDIR $APP_PATH | ||
|
||
COPY app/Gemfile . | ||
RUN bundle install | ||
|
||
COPY app/ . | ||
|
||
CMD ["./run.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'bugsnag', path: '/bugsnag' | ||
gem 'mailman' | ||
gem 'hitimes', '~> 1.2.6' | ||
gem 'i18n', '~> 0.9.5' | ||
gem 'rb-inotify', '0.9.8' | ||
gem 'maildir', '~> 2.1.0' | ||
gem 'activesupport', '~> 3.2' | ||
gem 'rack', '~> 1.6.11' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require 'mailman' | ||
require 'bugsnag' | ||
|
||
Bugsnag.configure do |conf| | ||
puts "Configuring `api_key` to #{ENV['BUGSNAG_API_KEY']}" | ||
conf.api_key = ENV['BUGSNAG_API_KEY'] | ||
puts "Configuring `endpoint` to #{ENV['BUGSNAG_ENDPOINT']}" | ||
conf.endpoint = ENV['BUGSNAG_ENDPOINT'] | ||
end | ||
|
||
Mailman.config.ignore_stdin = false | ||
|
||
Mailman::Application.run do | ||
subject "Unhandled" do | ||
raise RuntimeError.new("Unhandled exception") | ||
end | ||
|
||
subject "Handled" do | ||
begin | ||
raise RuntimeError.new("Handled exception") | ||
rescue => exception | ||
Bugsnag.notify(exception) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
MIME-Version: 1.0 | ||
imjoehaines marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Date: Mon, 4 Feb 2019 17:54:01 +0000 | ||
Message-ID: <CABpr-1gRk_ueV0LBvFVdeWPG5Tt4feVvB14iMB_FTfKgKrwt-w@mail.gmail.com> | ||
Subject: Handled | ||
From: Test <Test@maze-runner.mail> | ||
To: "Test@maze-runner.mail" <Test@maze-runner.mail> | ||
Content-Type: multipart/alternative; boundary="0000000000008ead860581152db1" | ||
|
||
--0000000000008ead860581152db1 | ||
Content-Type: text/plain; charset="UTF-8" | ||
|
||
test | ||
|
||
--0000000000008ead860581152db1 | ||
Content-Type: text/html; charset="UTF-8" | ||
|
||
<div dir="ltr">test</div> | ||
|
||
--0000000000008ead860581152db1-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
MIME-Version: 1.0 | ||
imjoehaines marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Date: Mon, 4 Feb 2019 17:54:01 +0000 | ||
Message-ID: <CABpr-1gRk_ueV0LBvFVdeWPG5Tt4feVvB14iMB_FTfKgKrwt-w@mail.gmail.com> | ||
Subject: Unhandled | ||
From: Test <Test@maze-runner.mail> | ||
To: "Test@maze-runner.mail" <Test@maze-runner.mail> | ||
Content-Type: multipart/alternative; boundary="0000000000008ead860581152db1" | ||
|
||
--0000000000008ead860581152db1 | ||
Content-Type: text/plain; charset="UTF-8" | ||
|
||
test | ||
|
||
--0000000000008ead860581152db1 | ||
Content-Type: text/html; charset="UTF-8" | ||
|
||
<div dir="ltr">test</div> | ||
|
||
--0000000000008ead860581152db1-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
cat $TARGET_EMAIL | bundle exec ruby app.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
app/Gemfile.lock | ||
imjoehaines marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ARG RUBY_VERSION | ||
FROM ruby:$RUBY_VERSION | ||
|
||
WORKDIR /bugsnag | ||
COPY temp-bugsnag-lib ./ | ||
|
||
WORKDIR /usr/src/app | ||
COPY app/Gemfile /usr/src/app/ | ||
RUN bundle install | ||
|
||
COPY app/ /usr/src/app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
source "https://rubygems.org" | ||
|
||
gem "bugsnag", path: "/bugsnag" | ||
|
||
gem "que", "~> 0.14.3" | ||
|
||
gem "pg", RUBY_VERSION < "2.2.0" ? "0.21.0" : "> 0.21.0" | ||
|
||
gem "activerecord", RUBY_VERSION < "2.2.0" ? "4.2.11" : "> 4.2.11" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
require 'pg' | ||
require 'que' | ||
require 'bugsnag' | ||
require 'active_record' | ||
|
||
Bugsnag.configure do |config| | ||
puts "Configuring `api_key` to #{ENV['BUGSNAG_API_KEY']}" | ||
config.api_key = ENV['BUGSNAG_API_KEY'] | ||
puts "Configuring `endpoint` to #{ENV['BUGSNAG_ENDPOINT']}" | ||
config.endpoint = ENV['BUGSNAG_ENDPOINT'] | ||
end | ||
|
||
ActiveRecord::Base.establish_connection( | ||
adapter: 'postgresql', | ||
database: 'postgres', | ||
username: 'postgres', | ||
password: 'test_password', | ||
host: 'postgres' | ||
) | ||
|
||
Que.connection = ActiveRecord | ||
Que.migrate!(version: 3) | ||
|
||
class UnhandledJob < Que::Job | ||
def run | ||
raise RuntimeError.new("Unhandled error") | ||
end | ||
|
||
def handle_error(error) | ||
destroy | ||
end | ||
end | ||
|
||
class HandledJob < Que::Job | ||
def run | ||
raise RuntimeError.new("Handled error") | ||
rescue => exception | ||
Bugsnag.notify(exception) | ||
end | ||
end | ||
|
||
case ARGV[0] | ||
when "unhandled" | ||
UnhandledJob.enqueue | ||
when "handled" | ||
HandledJob.enqueue | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Gemfile.lock | ||
app/Gemfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ RUN bundle install | |
|
||
COPY app/ /usr/src/app | ||
|
||
CMD ["ruby", "app.rb"] | ||
CMD ["bundle", "exec", "ruby", "app.rb"] |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require 'bugsnag' | ||
require 'rack' | ||
|
||
puts "HERE" | ||
|
||
Bugsnag.configure do |config| | ||
puts "Configuring `api_key` to #{ENV['BUGSNAG_API_KEY']}" | ||
config.api_key = ENV['BUGSNAG_API_KEY'] | ||
puts "Configuring `endpoint` to #{ENV['BUGSNAG_ENDPOINT']}" | ||
config.endpoint = ENV['BUGSNAG_ENDPOINT'] | ||
end | ||
|
||
class BugsnagTests | ||
def call(env) | ||
req = Rack::Request.new(env) | ||
|
||
case req.env['REQUEST_PATH'] | ||
when '/unhandled' | ||
raise RuntimeError.new('Unhandled error') | ||
when '/handled' | ||
begin | ||
raise RuntimeError.new('Handled error') | ||
rescue => exception | ||
Bugsnag.notify(exception) | ||
end | ||
end | ||
|
||
res = Rack::Response.new | ||
res.finish | ||
end | ||
end | ||
|
||
Rack::Server.start(app: Bugsnag::Rack.new(BugsnagTests.new), Host: '0.0.0.0', Port: 3000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Gemfile.lock | ||
app/Gemfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ RUN bundle install | |
|
||
COPY app/ /usr/src/app | ||
|
||
CMD ["ruby", "app.rb"] | ||
CMD ["bundle", "exec", "ruby", "app.rb"] |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'bugsnag' | ||
require 'rack' | ||
|
||
|
||
Bugsnag.configure do |config| | ||
puts "Configuring `api_key` to #{ENV['BUGSNAG_API_KEY']}" | ||
config.api_key = ENV['BUGSNAG_API_KEY'] | ||
puts "Configuring `endpoint` to #{ENV['BUGSNAG_ENDPOINT']}" | ||
config.endpoint = ENV['BUGSNAG_ENDPOINT'] | ||
end | ||
|
||
class BugsnagTests | ||
def call(env) | ||
req = Rack::Request.new(env) | ||
|
||
case req.env['REQUEST_PATH'] | ||
when '/unhandled' | ||
raise RuntimeError.new('Unhandled error') | ||
when '/handled' | ||
begin | ||
raise RuntimeError.new('Handled error') | ||
rescue => exception | ||
Bugsnag.notify(exception) | ||
end | ||
end | ||
|
||
res = Rack::Response.new | ||
res.finish | ||
end | ||
end | ||
|
||
Rack::Server.start(app: Bugsnag::Rack.new(BugsnagTests.new), Host: '0.0.0.0', Port: 3000) |
9 changes: 8 additions & 1 deletion
9
features/fixtures/rails3/app/app/controllers/app_type_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we not add a rake task in a rails app?