Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.

Commit 410b0a9

Browse files
committed
Add an integration test using the example
1 parent dec6af4 commit 410b0a9

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: go
2+
3+
services:
4+
- docker
5+
6+
go_import_path: github.com/awslabs/aws-lambda-container-image-converter
7+
8+
go:
9+
- 1.11.x
10+
11+
script:
12+
- make install-deps build test integration-test stage-release-binaries

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ $(LOCAL_BINARY): $(SOURCES) GITCOMMIT_SHA
2727
test:
2828
go test -v -timeout 30s -short -cover $(shell go list ./img2lambda/... | grep -v /vendor/)
2929

30+
.PHONY: integration-test
31+
integration-test: $(LOCAL_BINARY)
32+
./scripts/build_example.sh
33+
3034
.PHONY: generate
3135
generate: $(SOURCES)
3236
PATH=$(LOCAL_PATH) go generate -x $(shell go list ./img2lambda/... | grep -v '/vendor/')
@@ -86,4 +90,5 @@ GITCOMMIT_SHA: $(GITFILES)
8690
clean:
8791
- rm -rf ./bin
8892
- rm -rf ./output
93+
- rm -rf ./example/output
8994
- rm -f GITCOMMIT_SHA

scripts/build_example.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
6+
# SPDX-License-Identifier: MIT-0
7+
8+
# Normalize to working directory being build root (up one level from ./scripts)
9+
ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )
10+
cd "${ROOT}"
11+
12+
cd "${ROOT}"/example
13+
14+
# Build the example and parse the layers
15+
docker build -t lambda-php .
16+
17+
docker run lambda-php hello '{"name": "World"}'
18+
19+
docker run lambda-php goodbye '{"name": "World"}'
20+
21+
../bin/local/img2lambda -i lambda-php:latest --dry-run
22+
23+
# Look for the 2 layers that contain files in opt/
24+
ls output/layer-1.zip
25+
ls output/layer-2.zip

0 commit comments

Comments
 (0)