Skip to content

Commit c4874f3

Browse files
committed
add setup for LocalStack tests
1 parent 95e0357 commit c4874f3

5 files changed

Lines changed: 47 additions & 7 deletions

File tree

.travis.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
language: node_js
2-
sudo: false
2+
sudo: true
33
node_js:
44
- 6
55

66
install:
7-
- npm install
7+
- export DEBIAN_FRONTEND=noninteractive
8+
- echo /home/travis/.nvm/versions/node/v6*/lib/node_modules
9+
- sudo add-apt-repository -y ppa:longsleep/golang-backports; sudo apt update -q
10+
- sudo apt install -y -qq golang-go
11+
- go version
12+
- curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
13+
- export PATH=$PATH:$GOPATH/bin
14+
- mkdir -p $GOPATH/src/github.com/serverless
15+
- ln -s `pwd` $GOPATH/src/github.com/serverless/examples
816

917
script:
10-
- npm run docs
11-
- npm run validate
12-
- ./check-if-readme-is-up-to-date.sh
18+
- cd $GOPATH/src/github.com/serverless/examples
19+
- make install
20+
- export NODE_PATH=$NODE_PATH:`echo /home/travis/.nvm/versions/node/v6*/lib/node_modules`
21+
- ls -la /home/travis/.nvm/versions/node/v6*/lib/node_modules
22+
- make start
23+
- make test-all
24+
25+
notifications:
26+
email: false

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
VENV_DIR ?= .venv
2+
VENV_ACT = . $(VENV_DIR)/bin/activate
3+
4+
usage: ## Show this help
5+
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
6+
7+
start: ## Start LocalStack infrastructure
8+
@$(VENV_ACT); nohup localstack start &
9+
10+
install: ## Install global dependencies
11+
which localstack || (virtualenv $(VENV_DIR); $(VENV_ACT); pip install -q localstack)
12+
docker pull localstack/localstack &
13+
npm install -q -s -g serverless serverless-localstack 2>&1 > /dev/null
14+
15+
test-all: ## Run all tests
16+
(cd aws-golang-dynamo-stream-to-elasticsearch && make build && npm install serverless-localstack && make deploy)
17+
(cd aws-ffmpeg-layer && ./build.sh && npm install serverless-localstack && sls deploy)
18+
19+
.PHONY: usage install test-all

aws-ffmpeg-layer/serverless.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ layers:
2525

2626
custom:
2727
bucket: ${env:BUCKET, 'ffmpeg-layer-gif-maker'}
28+
29+
plugins:
30+
- serverless-localstack

aws-golang-dynamo-stream-to-elasticsearch/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
build:
2-
dep ensure -v
2+
dep ensure
33
env GOOS=linux go build -ldflags="-s -w" -o bin/aws-golang-dynamo-stream-to-elasticsearch cmd/aws-golang-dynamo-stream-to-elasticsearch/main.go
44

55
.PHONY: clean

aws-golang-dynamo-stream-to-elasticsearch/serverless.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ provider:
3434
- { "Fn::GetAtt": ["PuppySearch", "DomainArn"] }
3535
- { "Fn::Join": ["", ["Fn::GetAtt": ["PuppySearch", "DomainArn"], "/*"]] }
3636

37+
plugins:
38+
- serverless-localstack
39+
40+
custom: {}
41+
3742
package:
3843
exclude:
3944
- ./**
@@ -103,4 +108,3 @@ resources:
103108
# Resource: "*"
104109
AdvancedOptions:
105110
rest.action.multi.allow_explicit_index: "true"
106-

0 commit comments

Comments
 (0)