Skip to content

Commit 8ebf67f

Browse files
committed
another round
1 parent 86e4ccf commit 8ebf67f

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

tests/bashtest.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ TESTS=0
1010
FAILED=0
1111

1212
# Verify that a command succeeds
13-
assert_success() {
13+
assert() {
1414
MESSAGE="$1"
1515
shift
1616
COMMAND="$@"

tests/test.sh

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ package_bin() {
1616
-v "${HOME}"/.cargo/registry:/root/.cargo/registry \
1717
-v "${HOME}"/.cargo/git:/root/.cargo/git \
1818
softprops/lambda-rust && \
19-
ls target/lambda/release/bootstrap.zip > /dev/null 2>&1
19+
ls target/lambda/release/"$1".zip > /dev/null 2>&1
2020
}
2121

2222
# test packaging all binaries
@@ -32,43 +32,47 @@ package_all() {
3232

3333
# test packaging with PROFILE=dev
3434
package_all_dev_profile() {
35-
rm -rf target/lambda/debug > /dev/null 2>&1
35+
#rm -rf target/lambda/debug > /dev/null 2>&1
3636
docker run --rm \
3737
-e PROFILE=dev \
3838
-v "${PWD}":/code \
3939
-v "${HOME}"/.cargo/registry:/root/.cargo/registry \
4040
-v "${HOME}"/.cargo/git:/root/.cargo/git \
4141
softprops/lambda-rust && \
42+
ls -al target/lambda/debug && \
4243
ls target/lambda/debug/bootstrap.zip > /dev/null 2>&1
4344
}
4445

45-
for project in test-func test-multi-func; do
46+
for project in test-multi-func; do
4647
cd "${HERE}"/"${project}"
48+
echo "👩‍🔬 Running tests for $project"
4749

48-
# package tests
4950
if [[ "$project" == test-func ]]; then
50-
assert_success "it packages single bin" package_bin bootstrap
51+
bin_name=boostrap
5152
else
52-
assert_success "it packages single bin" package_bin bootstrap
53+
bin_name=test-func
5354
fi
5455

55-
assert_success "it packages all bins with dev profile" package_all_dev_profile
56+
# package tests
57+
assert "it packages single bins" package_bin "${bin_name}"
58+
59+
assert "it packages all bins with dev profile" package_all_dev_profile
5660

57-
assert_success "it packages all bins" package_all
61+
assert "it packages all bins" package_all
5862

5963
# verify packaged artifact by invoking it using the lambdaci "provided" docker image
6064
rm test-out.log > /dev/null 2>&1
6165
rm -rf /tmp/lambda > /dev/null 2>&1
6266
unzip -o \
63-
target/lambda/release/bootstrap.zip \
67+
target/lambda/release/"${bin_name}".zip \
6468
-d /tmp/lambda > /dev/null 2>&1 && \
6569
docker run \
6670
-i -e DOCKER_LAMBDA_USE_STDIN=1 \
6771
--rm \
6872
-v /tmp/lambda:/var/task \
6973
lambci/lambda:provided < test-event.json | grep -v RequestId | grep -v '^\W*$' > test-out.log
7074

71-
assert_success "when invoked, it produces expected output" diff test-event.json test-out.log
75+
assert "when invoked, it produces expected output" diff test-event.json test-out.log
7276
done
7377

7478
end_tests

0 commit comments

Comments
 (0)