Skip to content
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

Setup maze runner #380

Merged
merged 3 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/license-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ jobs:
docker run -v $PWD:/scan licensefinder/license_finder /bin/bash -lc "
cd /scan &&
pip3 install -r requirements.txt --quiet &&
license_finder --decisions-file decisions.yml --python-version 3
license_finder --decisions-file decisions.yml --python-version 3 --enabled-package-managers=pip
"
29 changes: 29 additions & 0 deletions .github/workflows/maze-runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Maze Runner

on: [push, pull_request]

jobs:
maze-runner:
runs-on: 'ubuntu-latest'

strategy:
fail-fast: false
matrix:
python-version: ['3.5', '3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4

- name: Install libcurl4-openssl-dev and net-tools
run: |
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev net-tools

- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true

- run: bundle exec maze-runner --no-source
env:
PYTHON_TEST_VERSION: ${{ matrix.python-version }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
maze-runner.log
maze_output

*.py[co]

# Packages
Expand Down
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem 'bugsnag-maze-runner', '~> 9.6'
140 changes: 140 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
GEM
remote: https://rubygems.org/
specs:
appium_lib (12.0.1)
appium_lib_core (~> 5.0)
nokogiri (~> 1.8, >= 1.8.1)
tomlrb (>= 1.1, < 3.0)
appium_lib_core (5.4.0)
faye-websocket (~> 0.11.0)
selenium-webdriver (~> 4.2, < 4.6)
bugsnag (6.26.4)
concurrent-ruby (~> 1.0)
bugsnag-maze-runner (9.6.0)
appium_lib (~> 12.0.0)
appium_lib_core (~> 5.4.0)
bugsnag (~> 6.24)
cucumber (~> 7.1)
cucumber-expressions (~> 6.0.0)
curb (~> 0.9.6)
dogstatsd-ruby (~> 5.5.0)
json_schemer (~> 0.2.24)
optimist (~> 3.0.1)
os (~> 1.0.0)
rack (~> 2.2)
rake (~> 12.3.3)
rubyzip (~> 2.3.2)
selenium-webdriver (~> 4.0)
test-unit (~> 3.5.2)
webrick (~> 1.7.0)
builder (3.2.4)
childprocess (4.1.0)
concurrent-ruby (1.2.3)
cucumber (7.1.0)
builder (~> 3.2, >= 3.2.4)
cucumber-core (~> 10.1, >= 10.1.0)
cucumber-create-meta (~> 6.0, >= 6.0.1)
cucumber-cucumber-expressions (~> 14.0, >= 14.0.0)
cucumber-gherkin (~> 22.0, >= 22.0.0)
cucumber-html-formatter (~> 17.0, >= 17.0.0)
cucumber-messages (~> 17.1, >= 17.1.1)
cucumber-wire (~> 6.2, >= 6.2.0)
diff-lcs (~> 1.4, >= 1.4.4)
mime-types (~> 3.3, >= 3.3.1)
multi_test (~> 0.1, >= 0.1.2)
sys-uname (~> 1.2, >= 1.2.2)
cucumber-core (10.1.1)
cucumber-gherkin (~> 22.0, >= 22.0.0)
cucumber-messages (~> 17.1, >= 17.1.1)
cucumber-tag-expressions (~> 4.1, >= 4.1.0)
cucumber-create-meta (6.0.4)
cucumber-messages (~> 17.1, >= 17.1.1)
sys-uname (~> 1.2, >= 1.2.2)
cucumber-cucumber-expressions (14.0.0)
cucumber-expressions (6.0.1)
cucumber-gherkin (22.0.0)
cucumber-messages (~> 17.1, >= 17.1.1)
cucumber-html-formatter (17.0.0)
cucumber-messages (~> 17.1, >= 17.1.0)
cucumber-messages (17.1.1)
cucumber-tag-expressions (4.1.0)
cucumber-wire (6.2.1)
cucumber-core (~> 10.1, >= 10.1.0)
cucumber-cucumber-expressions (~> 14.0, >= 14.0.0)
curb (0.9.11)
diff-lcs (1.5.1)
dogstatsd-ruby (5.5.0)
ecma-re-validator (0.4.0)
regexp_parser (~> 2.2)
eventmachine (1.2.7)
faye-websocket (0.11.3)
eventmachine (>= 0.12.0)
websocket-driver (>= 0.5.1)
ffi (1.16.3)
hana (1.3.7)
json_schemer (0.2.25)
ecma-re-validator (~> 0.3)
hana (~> 1.3)
regexp_parser (~> 2.0)
simpleidn (~> 0.2)
uri_template (~> 0.7)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0305)
multi_test (0.1.2)
nokogiri (1.16.3-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.3-arm-linux)
racc (~> 1.4)
nokogiri (1.16.3-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.3-x86-linux)
racc (~> 1.4)
nokogiri (1.16.3-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.3-x86_64-linux)
racc (~> 1.4)
optimist (3.0.1)
os (1.0.1)
power_assert (2.0.3)
racc (1.7.3)
rack (2.2.9)
rake (12.3.3)
regexp_parser (2.9.0)
rexml (3.2.6)
rubyzip (2.3.2)
selenium-webdriver (4.5.0)
childprocess (>= 0.5, < 5.0)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
simpleidn (0.2.1)
unf (~> 0.1.4)
sys-uname (1.2.3)
ffi (~> 1.1)
test-unit (3.5.9)
power_assert
tomlrb (2.0.3)
unf (0.1.4)
unf_ext
unf_ext (0.0.9.1)
uri_template (0.7.0)
webrick (1.7.0)
websocket (1.2.10)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)

PLATFORMS
aarch64-linux
arm-linux
arm64-darwin
x86-linux
x86_64-darwin
x86_64-linux

DEPENDENCIES
bugsnag-maze-runner (~> 9.6)

BUNDLED WITH
2.5.1
1 change: 1 addition & 0 deletions bugsnag/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ def _payload(self):
return encoder.encode({
"apiKey": self.api_key,
"notifier": _NOTIFIER_INFORMATION,
"payloadVersion": self.PAYLOAD_VERSION,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required for the step:

the error is valid for the error reporting API version "4.0" for the "Python Bugsnag Notifier" notifier

"events": [{
"severity": self.severity,
"severityReason": self.severity_reason,
Expand Down
1 change: 1 addition & 0 deletions features/fixtures/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
temp-bugsnag-python/
14 changes: 14 additions & 0 deletions features/fixtures/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: "3.8"

services:
plain:
build:
context: plain
args:
- PYTHON_TEST_VERSION
environment:
- BUGSNAG_API_KEY
- BUGSNAG_ERROR_ENDPOINT
- BUGSNAG_SESSION_ENDPOINT
extra_hosts:
- "host.docker.internal:host-gateway"
9 changes: 9 additions & 0 deletions features/fixtures/plain/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ARG PYTHON_TEST_VERSION
FROM python:$PYTHON_TEST_VERSION

COPY app/ /usr/src/app
COPY temp-bugsnag-python/ /usr/src/bugsnag

WORKDIR /usr/src/app

RUN pip install --no-cache-dir -r requirements.txt
10 changes: 10 additions & 0 deletions features/fixtures/plain/app/handled.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import os
import bugsnag

bugsnag.configure(
api_key=os.environ["BUGSNAG_API_KEY"],
endpoint=os.environ["BUGSNAG_ERROR_ENDPOINT"],
session_endpoint=os.environ["BUGSNAG_SESSION_ENDPOINT"],
)

bugsnag.notify(RuntimeError("uh oh :o"))
1 change: 1 addition & 0 deletions features/fixtures/plain/app/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../bugsnag
10 changes: 10 additions & 0 deletions features/fixtures/plain/app/unhandled.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import os
import bugsnag

bugsnag.configure(
api_key=os.environ["BUGSNAG_API_KEY"],
endpoint=os.environ["BUGSNAG_ERROR_ENDPOINT"],
session_endpoint=os.environ["BUGSNAG_SESSION_ENDPOINT"],
)

raise Exception("OH NO!")
11 changes: 11 additions & 0 deletions features/plain/handled.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Feature: Handled exceptions

Scenario: Handled exceptions are delivered
Given I run the service "plain" with the command "python handled.py"
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Python Bugsnag Notifier" notifier
And the exception "errorClass" equals "RuntimeError"
And the exception "message" equals "uh oh :o"
And the event "unhandled" is false
And the event "severity" equals "warning"
And the event "severityReason.type" equals "handledException"
11 changes: 11 additions & 0 deletions features/plain/unhandled.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Feature: Unhandled exceptions

Scenario: Unhandled exceptions are delivered
Given I run the service "plain" with the command "python unhandled.py"
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Python Bugsnag Notifier" notifier
And the exception "errorClass" equals "Exception"
And the exception "message" equals "OH NO!"
And the event "unhandled" is true
And the event "severity" equals "error"
And the event "severityReason.type" equals "unhandledException"
46 changes: 46 additions & 0 deletions features/support/env.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
require "fileutils"

Maze.hooks.before_all do
# log to console, not the filesystem
Maze.config.file_log = false
Maze.config.log_requests = true

# don't wait so long for requests/not to receive requests
Maze.config.receive_requests_wait = 10
Maze.config.receive_no_requests_wait = 10

# warn if a test takes more than 5 seconds to send a request
Maze.config.receive_requests_slow_threshold = 5

# bugsnag-python doesn't need to send the integrity header
Maze.config.enforce_bugsnag_integrity = false

# install bugsnag into each fixture
Dir.each_child("features/fixtures") do |path|
fixture_directory = "#{Dir.pwd}/features/fixtures/#{path}"

next unless File.directory?(fixture_directory)

destination = "#{fixture_directory}/temp-bugsnag-python"

FileUtils.mkdir(destination) unless File.exist?(destination)

FileUtils.cp_r(
["bugsnag", "setup.py"],
destination,
remove_destination: true # delete destination before copying
)

at_exit do
FileUtils.rm_rf(destination)
end
end
end

Maze.hooks.before do
host = "host.docker.internal"

Maze::Runner.environment["BUGSNAG_API_KEY"] = $api_key
Maze::Runner.environment["BUGSNAG_ERROR_ENDPOINT"] = "http://#{host}:#{Maze.config.port}/notify"
Maze::Runner.environment["BUGSNAG_SESSION_ENDPOINT"] = "http://#{host}:#{Maze.config.port}/sessions"
end
Loading