Skip to content

Commit

Permalink
Merge pull request #246 from bugsnag/next
Browse files Browse the repository at this point in the history
## 2.5.0 (2024-08-27)

### Enhancements

* Limit resource usage while sending events asynchronously \
  Added MainContext configuration option for providing context from main app
  [#231](#231)
  • Loading branch information
DariaKunoichi authored Aug 27, 2024
2 parents 4ae0bc0 + 82e2d24 commit 46ba8d9
Show file tree
Hide file tree
Showing 61 changed files with 973 additions and 1,269 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on: [ push, pull_request ]

jobs:
test:

runs-on: ${{ matrix.os }}-latest
defaults:
run:
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 2.5.0 (2024-08-27)

### Enhancements

* Limit resource usage while sending events asynchronously \
Added MainContext configuration option for providing context from main app
[#231](https://github.com/bugsnag/bugsnag-go/pull/231)

## 2.4.0 (2024-04-15)

### Enhancements
Expand Down
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.

29 changes: 29 additions & 0 deletions LOCAL_TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

## Unit tests
* Install old golang version (do not install just 1.11 - it's not compatible with running newer modules):

```
ASDF_GOLANG_OVERWRITE_ARCH=amd64 asdf install golang 1.11.13
```

* If you see error below use `CGO_ENABLED=0`.

```
# crypto/x509
malformed DWARF TagVariable entry
```

## Local testing with maze runner

* Maze runner tests require
* Specyfing `GO_VERSION` env variable to set a golang version for docker container.
* Ruby 2.7.
* Running docker.

* Commands to run tests

```
bundle install
bundle exec bugsnag-maze-runner
bundle exec bugsnag-maze-runner -c features/<chosen_feature>
```
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]"
Loading

0 comments on commit 46ba8d9

Please sign in to comment.