-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #689 from bugsnag/hackathon-test-harness
Hackathon test harness
- Loading branch information
Showing
11 changed files
with
172 additions
and
23 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# @!group Setup steps | ||
|
||
# Creates a new project in bugsnag | ||
Given('I create a new project {string} with type {string}') do |name, type| | ||
org_id = data_access_api.get_first_org_id | ||
project = data_access_api.create_project(org_id, name, type) | ||
project_id = project['id'] | ||
data_access_api.set_project_id(project_id) | ||
api_key = data_access_api.get_project_api_key(project_id) | ||
Maze.config.bugsnag_repeater_api_key = api_key | ||
Maze.config.bugsnag_data_access_project_id = project_id | ||
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
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,6 @@ | ||
ARG BRANCH_NAME | ||
ARG RUBY_VERSION | ||
FROM 855461928731.dkr.ecr.us-west-1.amazonaws.com/maze-runner:${BRANCH_NAME}-ci-ruby-${RUBY_VERSION} | ||
|
||
COPY . /app | ||
WORKDIR /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,4 @@ | ||
source "https://rubygems.org" | ||
|
||
gem 'bugsnag-maze-runner', path: '../../..' | ||
gem 'bugsnag', '>= 6.0.0' |
9 changes: 9 additions & 0 deletions
9
test/fixtures/pipeline-events/features/create_project_and_send_event.feature
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 @@ | ||
Feature: We can create a project, send an event to the new project and verify | ||
that the event is available via the data access api | ||
|
||
Scenario: We can create a project, send an event to the new project and verify | ||
Given I create a new project "My Project" with type "ruby" | ||
When I send a request to the server | ||
Then I wait to receive an error | ||
And the last event is available via the data access api | ||
And the pipeline event payload field "exceptions.0.message" equals "This is an error" |
7 changes: 7 additions & 0 deletions
7
test/fixtures/pipeline-events/features/pull_from_pipeline.feature
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,7 @@ | ||
Feature: We can pull processed requests from Bugsnag Development | ||
|
||
Scenario: We can pull a processed event from the pipeline | ||
When I send a request to the server | ||
Then I wait to receive an error | ||
And the last event is available via the data access api | ||
And the pipeline event payload field "exceptions.0.message" equals "This is an error" |
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,60 @@ | ||
When('I send a request to the server') do | ||
test_payload = JSON.generate({ | ||
apiKey: Maze.config.bugsnag_repeater_api_key, | ||
notifier: { | ||
name: 'Ruby Bugsnag Notifier', | ||
version: '6.27.1', | ||
url: 'https://www.bugsnag.com' | ||
}, | ||
payloadVersion: '4.0', | ||
events: [ | ||
{ | ||
app: { version: nil, releaseStage: nil, type: nil }, | ||
breadcrumbs: [], | ||
device: { | ||
hostname: 'SBUK62MMD6T.local', | ||
runtimeVersions: { ruby: '3.3.5' }, | ||
time: '2024-10-17T14:27:33.829Z' | ||
}, | ||
exceptions: [ | ||
{ | ||
errorClass: 'RuntimeError', | ||
message: 'This is an error', | ||
stacktrace: [ | ||
{ | ||
lineNumber: 435, | ||
file: 'gems/bugsnag-6.27.1/lib/bugsnag/report.rb', | ||
method: 'block in generate_exception_list', | ||
code: { | ||
'432': ' {', | ||
'433': ' errorClass: class_name,', | ||
'434': ' message: error_message(exception, class_name),', | ||
'435': ' stacktrace: Stacktrace.process(exception.backtrace, configuration)', | ||
'436': ' }', | ||
'437': ' end', | ||
'438': ' end' | ||
} | ||
} | ||
] | ||
} | ||
], | ||
featureFlags: [], | ||
metaData: {}, | ||
severity: 'warning', | ||
severityReason: { type: 'handledException' }, | ||
unhandled: false, | ||
user: {} | ||
} | ||
] | ||
}) | ||
|
||
http = Net::HTTP.new('localhost', '9339') | ||
request = Net::HTTP::Post.new('/notify') | ||
request['content-type'] = 'application/json' | ||
request['bugsnag-api-key'] = Maze.config.bugsnag_repeater_api_key | ||
request['bugsnag-payload-version'] = '4.0' | ||
request['bugsnag-sent-at'] = Time.now.utc.iso8601 | ||
request.body = test_payload | ||
|
||
http.request(request) | ||
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,7 @@ | ||
Maze.config.enable_bugsnag = false | ||
|
||
BeforeAll do | ||
Maze.config.enforce_bugsnag_integrity = false | ||
end | ||
|
||
|