Skip to content

Commit

Permalink
Add command make test and add section on testing in Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
sgalushin committed Aug 18, 2021
1 parent d416372 commit ac999ba
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 3 deletions.
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ install:
$(MAKE) install.product-catalog
$(MAKE) install.rolls

test:
$(info [*] Running tests...)
$(MAKE) test.integration-endpoint
$(MAKE) test.product-catalog
$(MAKE) test.rolls



deploy.backend-shared:
$(MAKE) -C backend-shared deploy
Expand All @@ -37,6 +44,7 @@ deploy.product-catalog:
deploy.rolls:
$(MAKE) -C rolls deploy


install.integration-endpoint:
$(MAKE) -C integration-endpoint install

Expand All @@ -47,6 +55,16 @@ install.rolls:
$(MAKE) -C rolls install


test.integration-endpoint:
$(MAKE) -C integration-endpoint test

test.product-catalog:
$(MAKE) -C product-catalog test

test.rolls:
$(MAKE) -C rolls test


define HELP_MESSAGE
See README.md.
endef
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,23 @@ Keep in mind that when deploying a new stage, integration API key must not be re
After initial deployment specific services can be updated with `make deploy.SERVICE` command, for example
`make deploy.rolls STAGE=st2 INTEGRATION_API_KEY=wcqp4peshv57dulfakpm REGION=eu-west-1 BUCKET_FOR_LAMBDAS=my-bucket-for-lambdas-0492320`

## Testing

### Unit tests

Before running tests make sure you have installed all packages by running `make install` from the project root directory.

To run all tests execute `make test` from the project root directory.

To test that package execute `npm run test` from that package's directory.

All unit tests require DynamoDB Local to be available on `localhost:8000`. To run it in Docker use `docker run -p 8000:8000 -d amazon/dynamodb-local`. Unit tests create randomly named DynamoDB tables and don't delete them after the test (for performance reasons). The expectation is that the DynamoDB Local container should be easily discarded. Running multiple iterations of tests on the same container is fine as a chance for a collision in table names is extremely unlikely.


### End-to-End tests

To be done.

## Project status

This app was created as a pre-sales proof-of-concept for a specific client to demonstrate the feasibility of moving some parts of the existing classic three-tier ERP application to a serverless AWS stack. Currently, its development is abandoned.
Expand Down
5 changes: 4 additions & 1 deletion integration-endpoint/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ deploy:
sam deploy --no-fail-on-empty-changeset --stack-name trc-$(STAGE)-integration-endpoint --no-confirm-changeset --parameter-overrides "ParameterKey=Stage,ParameterValue=$(STAGE) ParameterKey=ApiKey,ParameterValue=$(INTEGRATION_API_KEY)" --region $(REGION) --resolve-s3 --capabilities CAPABILITY_IAM

install:
(cd incoming-message-processor && npm ci)
(cd incoming-message-processor && npm ci)

test:
(cd incoming-message-processor && npm run test)
5 changes: 4 additions & 1 deletion product-catalog/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ deploy:
sam deploy -t template-export.yaml --no-fail-on-empty-changeset --stack-name trc-$(STAGE)-product-catalog --no-confirm-changeset --parameter-overrides "ParameterKey=Stage,ParameterValue=$(STAGE)" --region $(REGION) --resolve-s3 --capabilities CAPABILITY_IAM

install:
(cd catalog-crud && npm ci)
(cd catalog-crud && npm ci)

test:
(cd catalog-crud && npm run test)
5 changes: 4 additions & 1 deletion rolls/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ deploy:
sam deploy -t template-export.yaml --no-fail-on-empty-changeset --stack-name trc-$(STAGE)-rolls --no-confirm-changeset --parameter-overrides "ParameterKey=Stage,ParameterValue=$(STAGE)" --region $(REGION) --resolve-s3 --capabilities CAPABILITY_IAM

install:
(cd rolls-crud && npm ci)
(cd rolls-crud && npm ci)

test:
(cd rolls-crud && npm run test)

0 comments on commit ac999ba

Please sign in to comment.