Skip to content

Commit

Permalink
Run all tests on every PR (#78)
Browse files Browse the repository at this point in the history
Run Tests on every PR
  • Loading branch information
JDragovichAlertLogic authored Mar 16, 2020
1 parent 13ad40a commit c3d0d89
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3,783 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
**/package-lock.json
test/report.xml
#idea
.idea/
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ node_js:
install:
- make deps
script:
- make test
- make test-all
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ AWS_LAMBDA_S3_BUCKET ?= alertlogic-collectors
AWS_LAMBDA_PAWS_FUNCTION_NAME ?= alertlogic-paws-collector
AWS_LAMBDA_PAWS_PACKAGE_NAME ?= al-paws-collector.zip
AWS_CFN_TEMPLATE_PATH ?= ./cfn/paws-collector.template
COLLECTOR_DIRS ?= $(shell find collectors/ -type d -maxdepth 1 -mindepth 1)

.PHONY: test

Expand All @@ -16,6 +17,13 @@ compile: deps
test: compile
npm run test

test-all: compile
npm run test
for d in $(COLLECTOR_DIRS); do \
echo "\n************\n\nrunning tests for $$d\n\n************\n\n"; \
make -C $$d test || exit 1; \
done;

package: test package.zip

package.zip: node_modules/ *.js package.json
Expand Down
7 changes: 7 additions & 0 deletions collectors/o365/test/o365_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ describe('O365 Collector Tests', function() {
return callback(null, data);
});

AWS.mock('SSM', 'getParameter', function (params, callback) {
const data = new Buffer('test-secret');
return callback(null, {Parameter : { Value: data.toString('base64')}});
});

responseStub = sinon.stub(m_response, 'send').callsFake(
function fakeFn(event, mockContext, responseStatus, responseData, physicalResourceId) {
mockContext.succeed();
Expand All @@ -127,6 +132,8 @@ describe('O365 Collector Tests', function() {
restoreAlServiceStub();
setEnvStub.restore();
responseStub.restore();
AWS.restore('KMS');
AWS.restore('SSM');
});

describe('pawsInitCollectionState', function() {
Expand Down
Loading

0 comments on commit c3d0d89

Please sign in to comment.