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

Update maze-runner tests from v1 to v9 #244

Merged
merged 23 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
779414b
Prepare CI for new mazerunner tests, use GO111MODULE for older golang…
DariaKunoichi Aug 20, 2024
0b8413e
Temporarily disable ubuntu tests on CI
DariaKunoichi Aug 20, 2024
fe77eac
Merge pull request #238 from bugsnag/update_ci
DariaKunoichi Aug 20, 2024
cebe14b
Add Bugsnag-Integrity header with sha1 sum
DariaKunoichi Aug 20, 2024
d50e51d
Add command pattern in main test app
DariaKunoichi Aug 20, 2024
d9b0f51
Prepare ruby steps for new mazerunner version, set test server address
DariaKunoichi Aug 20, 2024
fea99fd
Separate test functions into scenario files
DariaKunoichi Aug 20, 2024
2522f88
Add scenarios to map in main file
DariaKunoichi Aug 20, 2024
6b02a9f
Remove nethttp and autoconfigure test apps
DariaKunoichi Aug 20, 2024
5d80e4b
Remove autoconfig and nethttp from docker-compose, use only real bugs…
DariaKunoichi Aug 20, 2024
ea2077b
Rewrite basic features to new steps
DariaKunoichi Aug 20, 2024
6ae8183
Rewrite nethttp features to new steps
DariaKunoichi Aug 20, 2024
2be2a54
Merge pull request #239 from bugsnag/integrity_header
DariaKunoichi Aug 21, 2024
97aa5f1
Fix auto session value in tests - number instead of string
DariaKunoichi Aug 21, 2024
dd819fa
Merge pull request #240 from bugsnag/scenarios
DariaKunoichi Aug 21, 2024
bf878a4
Merge pull request #241 from bugsnag/remove_old_apps
DariaKunoichi Aug 21, 2024
41c675e
Consider startup session in session count in tests
DariaKunoichi Aug 21, 2024
54313af
Unify scenario names with scenario func names
DariaKunoichi Aug 21, 2024
f4ca7eb
Enable ubuntu tests in CI
DariaKunoichi Aug 21, 2024
e983d36
Merge pull request #243 from bugsnag/final_touches
twometresteve Aug 21, 2024
1ea6317
Merge pull request #242 from bugsnag/rewrite_features
DariaKunoichi Aug 21, 2024
d719193
Remove Bugsnag-Integrity header, server side notifiers don't have to …
DariaKunoichi Aug 22, 2024
f0af7a9
Merge pull request #245 from bugsnag/remove_header
DariaKunoichi Aug 22, 2024
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
24 changes: 14 additions & 10 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ on: [ push, pull_request ]

jobs:
test:

runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
defaults:
run:
working-directory: 'go/src/github.com/bugsnag/bugsnag-go/v2' # relative to $GITHUB_WORKSPACE
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-latest]
os: [ubuntu, windows]
go-version: ['1.11', '1.12', '1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19', '1.20', '1.21', '1.22']

steps:
Expand All @@ -27,31 +26,36 @@ jobs:
if: matrix.os == 'windows'
run: |
bash -c 'echo "GOPATH=$GITHUB_WORKSPACE\\\\go" >> $GITHUB_ENV'
- name: set GO111MODULE
run: |
bash -c 'echo "GO111MODULE=on" >> $GITHUB_ENV'
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: install dependencies
run: go get -v -d ./...
- name: run tests
run: go test ./...
run: go test $(go list ./... | grep -v /features/)
- name: vet package
# go1.12 vet shows spurious 'unknown identifier' issues
if: matrix.go-version != '1.12'
run: go vet ./...
run: go vet $(go list ./... | grep -v /features/)

- name: install integration dependencies
if: matrix.os == 'ubuntu'
run: |
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev
- name: install Ruby
if: matrix.os == 'ubuntu'
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: '3.2'
bundler-cache: true
working-directory: go/src/github.com/bugsnag/bugsnag-go # relative to $GITHUB_WORKSPACE
- name: install integration dependencies
if: matrix.os == 'ubuntu'
run: sudo apt-get install docker-compose
- name: maze tests
working-directory: go/src/github.com/bugsnag/bugsnag-go
if: matrix.os == 'ubuntu'
env:
GO_VERSION: ${{ matrix.go-version }}
run: bundle exec bugsnag-maze-runner --color --format progress
run: bundle exec maze-runner --color --format progress
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
maze_output
vendor

features/fixtures/testbuild
# ignore the gemfile to prevent testing against stale versions
Gemfile.lock
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source 'https://rubygems.org'

gem 'bugsnag-maze-runner', git: 'https://github.com/bugsnag/maze-runner', branch: 'v1'
gem "bugsnag-maze-runner", "~> 9.0"
55 changes: 0 additions & 55 deletions Gemfile.lock

This file was deleted.

24 changes: 10 additions & 14 deletions features/apptype.feature
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
Feature: Configuring app type

Background:
Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
And I configure the bugsnag endpoint
And I set environment variable "APP_TYPE" to "background-queue"
And I have built the service "app"
Given I set environment variable "BUGSNAG_APP_TYPE" to "background-queue"

Scenario: An error report contains the configured app type when running a go app
Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false"
When I run the go service "app" with the test case "handled"
Then I wait to receive a request
And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
Given I set environment variable "BUGSNAG_AUTO_CAPTURE_SESSIONS" to "0"
When I start the service "app"
And I run "HandledErrorScenario"
And I wait to receive an error
And the event "app.type" equals "background-queue"

Scenario: An session report contains the configured app type when running a go app
Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "true"
When I run the go service "app" with the test case "session"
Then I wait to receive a request after the start up session
And the request is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
And the payload field "app.type" equals "background-queue"

Given I set environment variable "BUGSNAG_AUTO_CAPTURE_SESSIONS" to "1"
When I start the service "app"
And I run "SendSessionScenario"
And I wait to receive 2 sessions
And the session payload field "app.type" equals "background-queue"
25 changes: 11 additions & 14 deletions features/appversion.feature
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
Feature: Configuring app version

Background:
Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
And I configure the bugsnag endpoint
And I set environment variable "APP_VERSION" to "3.1.2"
And I have built the service "app"
And I set environment variable "BUGSNAG_APP_VERSION" to "3.1.2"

Scenario: An error report contains the configured app type when running a go app
Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "false"
When I run the go service "app" with the test case "handled"
Then I wait to receive a request
And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
Given I set environment variable "BUGSNAG_AUTO_CAPTURE_SESSIONS" to "0"
When I start the service "app"
And I run "HandledErrorScenario"
And I wait to receive an error
And the event "app.version" equals "3.1.2"

Scenario: An session report contains the configured app type when running a go app
Given I set environment variable "AUTO_CAPTURE_SESSIONS" to "true"
When I run the go service "app" with the test case "session"
Then I wait to receive a request after the start up session
And the request is a valid session report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
And the payload field "app.version" equals "3.1.2"
Scenario: A session report contains the configured app type when running a go app
Given I set environment variable "BUGSNAG_AUTO_CAPTURE_SESSIONS" to "1"
When I start the service "app"
And I run "SendSessionScenario"
And I wait to receive 2 sessions
And the session payload field "app.version" equals "3.1.2"
18 changes: 8 additions & 10 deletions features/autonotify.feature
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
Feature: Using auto notify

Background:
Given I set environment variable "API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
And I configure the bugsnag endpoint
And I have built the service "app"

Scenario: An error report is sent when an AutoNotified crash occurs which later gets recovered
When I run the go service "app" with the test case "autonotify"
Then I wait for 3 seconds
And the request 1 is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
And the exception "errorClass" equals "*errors.errorString" for request 1
And the exception "message" equals "Go routine killed with auto notify" for request 1
When I start the service "app"
And I run "AutonotifyPanicScenario"
And I wait to receive 2 errors
And the exception "errorClass" equals "*errors.errorString"
And the exception "message" equals "Go routine killed with auto notify"
And I discard the oldest error
And the exception "errorClass" equals "panic"
And the exception "message" equals "Go routine killed with auto notify [recovered]"
104 changes: 54 additions & 50 deletions features/configuration.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,92 +5,96 @@ Feature: Configure integration with environment variables

Background:
Given I set environment variable "BUGSNAG_API_KEY" to "a35a2a72bd230ac0aa0f52715bbdc6aa"
And I set environment variable "BUGSNAG_NOTIFY_ENDPOINT" to the notify endpoint
And I set environment variable "BUGSNAG_SESSIONS_ENDPOINT" to the sessions endpoint
And I have built the service "autoconfigure"

Scenario Outline: Adding content to handled events through env variables
Given I set environment variable "<variable>" to "<value>"
And I set environment variable "BUGSNAG_AUTO_CAPTURE_SESSIONS" to "0"
When I run the go service "autoconfigure" with the test case "<testcase>"
Then I wait to receive a request
And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
When I start the service "app"
And I run "<testcase>"
And I wait to receive an error
And the event "<field>" equals "<value>"

Examples:
| testcase | variable | value | field |
| panic | BUGSNAG_APP_VERSION | 1.4.34 | app.version |
| panic | BUGSNAG_APP_TYPE | mailer-daemon | app.type |
| panic | BUGSNAG_RELEASE_STAGE | beta1 | app.releaseStage |
| panic | BUGSNAG_HOSTNAME | dream-machine-2 | device.hostname |
| panic | BUGSNAG_METADATA_device_instance | kube2-33-A | metaData.device.instance |
| panic | BUGSNAG_METADATA_framework_version | v3.1.0 | metaData.framework.version |
| panic | BUGSNAG_METADATA_device_runtime_level | 1C | metaData.device.runtime_level |
| panic | BUGSNAG_METADATA_Carrot | orange | metaData.custom.Carrot |
| AutoconfigPanicScenario | BUGSNAG_APP_VERSION | 1.4.34 | app.version |
| AutoconfigPanicScenario | BUGSNAG_APP_TYPE | mailer-daemon | app.type |
| AutoconfigPanicScenario | BUGSNAG_RELEASE_STAGE | beta1 | app.releaseStage |
| AutoconfigPanicScenario | BUGSNAG_HOSTNAME | dream-machine-2 | device.hostname |
| AutoconfigPanicScenario | BUGSNAG_METADATA_device_instance | kube2-33-A | metaData.device.instance |
| AutoconfigPanicScenario | BUGSNAG_METADATA_framework_version | v3.1.0 | metaData.framework.version |
| AutoconfigPanicScenario | BUGSNAG_METADATA_device_runtime_level | 1C | metaData.device.runtime_level |
| AutoconfigPanicScenario | BUGSNAG_METADATA_Carrot | orange | metaData.custom.Carrot |

| handled | BUGSNAG_APP_VERSION | 1.4.34 | app.version |
| handled | BUGSNAG_APP_TYPE | mailer-daemon | app.type |
| handled | BUGSNAG_RELEASE_STAGE | beta1 | app.releaseStage |
| handled | BUGSNAG_HOSTNAME | dream-machine-2 | device.hostname |
| handled | BUGSNAG_METADATA_device_instance | kube2-33-A | metaData.device.instance |
| handled | BUGSNAG_METADATA_framework_version | v3.1.0 | metaData.framework.version |
| handled | BUGSNAG_METADATA_device_runtime_level | 1C | metaData.device.runtime_level |
| handled | BUGSNAG_METADATA_Carrot | orange | metaData.custom.Carrot |
| AutoconfigHandledScenario | BUGSNAG_APP_VERSION | 1.4.34 | app.version |
| AutoconfigHandledScenario | BUGSNAG_APP_TYPE | mailer-daemon | app.type |
| AutoconfigHandledScenario | BUGSNAG_RELEASE_STAGE | beta1 | app.releaseStage |
| AutoconfigHandledScenario | BUGSNAG_HOSTNAME | dream-machine-2 | device.hostname |
| AutoconfigHandledScenario | BUGSNAG_METADATA_device_instance | kube2-33-A | metaData.device.instance |
| AutoconfigHandledScenario | BUGSNAG_METADATA_framework_version | v3.1.0 | metaData.framework.version |
| AutoconfigHandledScenario | BUGSNAG_METADATA_device_runtime_level | 1C | metaData.device.runtime_level |
| AutoconfigHandledScenario | BUGSNAG_METADATA_Carrot | orange | metaData.custom.Carrot |

Scenario: Configuring project packages
Given I set environment variable "BUGSNAG_PROJECT_PACKAGES" to "main,test"
And I set environment variable "BUGSNAG_AUTO_CAPTURE_SESSIONS" to "0"
When I run the go service "autoconfigure" with the test case "panic"
Then I wait to receive a request
And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
And the in-project frames of the stacktrace are:
| file | method | lineNumber |
| cases.go | explicitPanic | 22 |
| main.go | main | 11 |
When I start the service "app"
And I run "AutoconfigPanicScenario"
And I wait to receive an error
And the "file" of stack frame 0 equals "features/fixtures/app/autoconfig_scenario.go"
And the "method" of stack frame 0 equals "AutoconfigPanicScenario.func1"
And the "lineNumber" of stack frame 0 equals 11
And the "file" of stack frame 1 equals "features/fixtures/app/main.go"
And the "method" of stack frame 1 equals "main"
And the "lineNumber" of stack frame 1 equals 65

Scenario: Configuring source root
Given I set environment variable "BUGSNAG_SOURCE_ROOT" to the app directory
Given I set environment variable "BUGSNAG_SOURCE_ROOT" to "/app/src/features/fixtures/app/"
And I set environment variable "BUGSNAG_AUTO_CAPTURE_SESSIONS" to "0"
And I run the go service "autoconfigure" with the test case "panic"
Then I wait to receive a request
And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
And the in-project frames of the stacktrace are:
| file | method | lineNumber |
| cases.go | explicitPanic | 22 |
| main.go | main | 11 |
When I start the service "app"
And I run "AutoconfigPanicScenario"
And I wait to receive an error
And the "file" of stack frame 0 equals "autoconfig_scenario.go"
And the "method" of stack frame 0 equals "AutoconfigPanicScenario.func1"
And the "lineNumber" of stack frame 0 equals 11
And the "file" of stack frame 1 equals "main.go"
And the "method" of stack frame 1 equals "main"
And the "lineNumber" of stack frame 1 equals 65

Scenario: Delivering events filtering through notify release stages
Given I set environment variable "BUGSNAG_NOTIFY_RELEASE_STAGES" to "prod,beta"
And I set environment variable "BUGSNAG_RELEASE_STAGE" to "beta"
And I set environment variable "BUGSNAG_AUTO_CAPTURE_SESSIONS" to "0"
And I run the go service "autoconfigure" with the test case "panic"
Then I wait to receive a request
And the request is a valid error report with api key "a35a2a72bd230ac0aa0f52715bbdc6aa"
When I start the service "app"
And I run "AutoconfigPanicScenario"
And I wait to receive an error

Scenario: Suppressing events through notify release stages
Given I set environment variable "BUGSNAG_NOTIFY_RELEASE_STAGES" to "prod,beta"
And I set environment variable "BUGSNAG_RELEASE_STAGE" to "dev"
And I set environment variable "BUGSNAG_AUTO_CAPTURE_SESSIONS" to "0"
And I run the go service "autoconfigure" with the test case "panic"
Then 0 requests were received
When I start the service "app"
And I run "AutoconfigPanicScenario"
Then I should receive no errors

Scenario: Suppressing events using panic handler
Given I set environment variable "BUGSNAG_DISABLE_PANIC_HANDLER" to "1"
And I set environment variable "BUGSNAG_AUTO_CAPTURE_SESSIONS" to "0"
And I run the go service "autoconfigure" with the test case "panic"
And I wait for 2 seconds
Then 0 requests were received
When I start the service "app"
And I run "AutoconfigPanicScenario"
Then I should receive no errors

Scenario: Enabling synchronous event delivery
Given I set environment variable "BUGSNAG_SYNCHRONOUS" to "1"
And I set environment variable "BUGSNAG_AUTO_CAPTURE_SESSIONS" to "0"
When I run the go service "autoconfigure" with the test case "handled"
Then 1 request was received
When I start the service "app"
And I run "AutoconfigHandledScenario"
And I wait to receive an error

Scenario: Filtering metadata
Given I set environment variable "BUGSNAG_PARAMS_FILTERS" to "tomato,pears"
And I set environment variable "BUGSNAG_AUTO_CAPTURE_SESSIONS" to "0"
When I run the go service "autoconfigure" with the test case "handled-metadata"
Then I wait to receive a request
When I start the service "app"
And I run "AutoconfigMetadataScenario"
And I wait to receive an error
And the event "metaData.fruit.Tomato" equals "[FILTERED]"
And the event "metaData.snacks.Carrot" equals "4"
And the event "metaData.snacks.Carrot" equals "4"
16 changes: 0 additions & 16 deletions features/endpoint.feature

This file was deleted.

Loading
Loading