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

Add Maze Runner scaffolding for Lambda tests #1297

Merged
merged 9 commits into from
Feb 19, 2021

Conversation

imjoehaines
Copy link
Contributor

Goal

This PR adds the scaffolding necessary to be able to run Maze Runner tests against Lambda functions. The fixture and tests are by no means complete, but will be expanded on as further work. This PR is purely to prove that we can build, and run tests against, a Lambda fixture

Each commit is standalone so can be reviewed separately if that's easier

Testing

As we can't run tests using SAM on Buildkite yet, this has to be run locally for now:

  1. Install Maze Runner

    $ bundle install
  2. Run the tests

    $ bundle exec maze-runner

Note: the tests don't assert against Bugsnag payloads as we don't guarantee delivery in Lambda functions (yet!) so they assert against the Lambda responses instead

@github-actions
Copy link

github-actions bot commented Feb 16, 2021

@bugsnag/browser bundle size diff

Minified Minfied + Gzipped
Before 40.76 kB 12.57 kB
After 40.76 kB 12.57 kB
± No change No change

code coverage diff

Coverage values did not change👌.

Total:

Lines Branches Functions Statements
0%(+0%) 0%(+0%) 0%(+0%) 0%(+0%)

Generated by 🚫 dangerJS against 594d475

This stops a ruby backtrace from showing, which can be confusing -
the error happened in the 'build-fixtures' script rather than env.rb
Copy link
Contributor

@bengourley bengourley left a comment

Choose a reason for hiding this comment

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

Looks good.

I have a small concern regarding similar work being done in slightly different ways in different languages. The packing of fixtures is now done in Ruby and JS for these tests and the browser/node end to end tests. Maybe the context is too different that we can't consolidate the work, but I think it's worth a look.

Copy link
Contributor

@twometresteve twometresteve left a comment

Choose a reason for hiding this comment

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

LGTM.

@imjoehaines
Copy link
Contributor Author

I have a small concern regarding similar work being done in slightly different ways in different languages. The packing of fixtures is now done in Ruby and JS for these tests and the browser/node end to end tests. Maybe the context is too different that we can't consolidate the work, but I think it's worth a look.

I didn't realise we had packing in JS land too; I thought that was done by the dockerfiles and so had to be done differently for these tests as they can't run in docker. It's still a bit different as this is run by MR automatically rather than being a manual script

I think there's still an advantage to this being in Ruby; the buildkite boxes that will run these tests won't need Node installed as the JS execution is done in docker by SAM, but they do need Ruby to run Maze Runner so it cuts out a dependency

We could rewrite it in JS but I think it'd be more code & dependencies (e.g. for the YAML parsing) and be less robust, e.g. ensure blocks always run in Ruby even after exit or cancelling with Ctrl+c but finally blocks don't run after process.exit or cancelling in Node

@bengourley
Copy link
Contributor

We could rewrite it in JS but I think it'd be more code & dependencies (e.g. for the YAML parsing) and be less robust, e.g. ensure blocks always run in Ruby even after exit or cancelling with Ctrl+c but finally blocks don't run after process.exit or cancelling in Node

Maybe we rewrite the JS version in ruby then?

This is the script I'm talking about https://github.com/bugsnag/bugsnag-js/blob/next/bin/local-test-util

It builds the browser notifier(s) and test fixtures outside of docker for quicker iteration in development (I was mistaken when I said node too).

@twometresteve
Copy link
Contributor

Maybe we rewrite the JS version in ruby then?

I would back that - it could move us a step closer to a "Maze Builder".

@imjoehaines
Copy link
Contributor Author

Created https://bugsnag.atlassian.net/browse/PLAT-6086 for rewriting local-test-util

@imjoehaines imjoehaines merged commit 832c842 into integration/aws-lambda Feb 19, 2021
@imjoehaines imjoehaines deleted the lambda/maze-runner-scaffolding branch February 19, 2021 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants