Skip to content

Commit

Permalink
[update] unit test and integration test, with Makefile.
Browse files Browse the repository at this point in the history
  • Loading branch information
cm-wada-yusuke committed Mar 23, 2018
1 parent 5683902 commit 4e97995
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 64 deletions.
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
SHELL = /usr/bin/env bash -xeuo pipefail

S3_BUCKET_URL := s3://hero-lambda-deploy
include Makevars

TEST_INTEG_TARGETS := $(shell find test -name '*.bats')

GIT_COMMIT := $(shell git log -n 1 --format=%h)
ZIP_FILE := $(GIT_COMMIT).zip
UPLOAD_FILE := deploy/$(ZIP_FILE)
Expand All @@ -21,6 +24,14 @@ localstack-up:
localstack-stop:
@docker-compose stop localstack

test-unit:
python -m pytest

test-integ: localstack-up
@echo $(TEST_INTEG_TARGETS)
@echo $(DOCKER_NAME)
@DOCKER_NAME=$(DOCKER_NAME) bats $(TEST_INTEG_TARGETS)

clean:
-rm -rf deploy/
-rm packaged-*.yaml
Expand Down Expand Up @@ -85,6 +96,8 @@ guard-%:
.PHONY: \
localstack-up \
localstack-stop \
test-unit \
test-integ \
dist \
upload \
clean \
4 changes: 4 additions & 0 deletions Makevars
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# enter your own environment values.

S3_BUCKET_URL := s3://hero-lambda-deploy
DOCKER_NAME := pythonlambdatemplate_default
43 changes: 0 additions & 43 deletions deploy.sh

This file was deleted.

8 changes: 0 additions & 8 deletions environments/common.sh

This file was deleted.

8 changes: 0 additions & 8 deletions integration_test.sh

This file was deleted.

3 changes: 1 addition & 2 deletions test/functions/heroes/integration.bats
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/usr/bin/env bats

. environments/common.sh

setup() {
echo "setup"
aws --endpoint-url=http://localhost:4569 dynamodb create-table --table-name CM-Heroes --attribute-definitions AttributeName=id,AttributeType=S --key-schema AttributeName=id,KeyType=HASH --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1 || true
docker_network_id=`docker network ls -q -f NAME=$DOCKER_NAME`
}

Expand Down
3 changes: 1 addition & 2 deletions test/functions/offices/integration.bats
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/usr/bin/env bats

. environments/common.sh

setup() {
echo "setup"
aws --endpoint-url=http://localhost:4569 dynamodb create-table --table-name CM-Offices --attribute-definitions AttributeName=id,AttributeType=S --key-schema AttributeName=id,KeyType=HASH --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1 || true
docker_network_id=`docker network ls -q -f NAME=$DOCKER_NAME`
}

Expand Down

0 comments on commit 4e97995

Please sign in to comment.