Skip to content

Commit e89d059

Browse files
author
bweigel
committed
[individually option] port tests from bats to tape
1 parent 3b20787 commit e89d059

File tree

4 files changed

+381
-129
lines changed

4 files changed

+381
-129
lines changed

test.bats

Lines changed: 0 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -146,23 +146,6 @@ teardown() {
146146
test $(find puck -type d -name "*.egg-info*" | wc -l) -eq 0
147147
}
148148

149-
@test "py3.6 uses download cache with useDownloadCache option" {
150-
cd tests/base
151-
npm i $(npm pack ../..)
152-
perl -p -i'.bak' -e 's/(pythonRequirements:$)/\1\n useDownloadCache: true/' serverless.yml
153-
sls package
154-
USR_CACHE_DIR=`node -e 'console.log(require("../../lib/shared").getUserCachePath())'`
155-
ls $USR_CACHE_DIR/downloadCacheslspyc/http
156-
}
157-
158-
@test "py3.6 uses download cache with cacheLocation option" {
159-
cd tests/base
160-
npm i $(npm pack ../..)
161-
perl -p -i'.bak' -e 's/(pythonRequirements:$)/\1\n useDownloadCache: true\n cacheLocation: .requirements-cache/' serverless.yml
162-
sls package
163-
ls .requirements-cache/downloadCacheslspyc/http
164-
}
165-
166149
@test "py3.6 uses download cache with dockerizePip option" {
167150
cd tests/base
168151
npm i $(npm pack ../..)
@@ -437,71 +420,6 @@ teardown() {
437420
ls puck/.requirements.zip puck/unzip_requirements.py
438421
}
439422

440-
@test "py3.6 can package flask with package individually option" {
441-
cd tests/base
442-
npm i $(npm pack ../..)
443-
sls --individually=true package
444-
unzip .serverless/hello.zip -d puck
445-
unzip .serverless/hello2.zip -d puck2
446-
unzip .serverless/hello3.zip -d puck3
447-
ls puck/flask
448-
ls puck2/flask
449-
! ls puck3/flask
450-
}
451-
452-
@test "py3.6 can package flask with package individually & slim option" {
453-
cd tests/base
454-
npm i $(npm pack ../..)
455-
sls --individually=true --slim=true package
456-
unzip .serverless/hello.zip -d puck
457-
unzip .serverless/hello2.zip -d puck2
458-
unzip .serverless/hello3.zip -d puck3
459-
ls puck/flask
460-
ls puck2/flask
461-
! ls puck3/flask
462-
test $(find "puck*" -name "*.pyc" | wc -l) -eq 0
463-
}
464-
465-
@test "py2.7 can package flask with package individually option" {
466-
cd tests/base
467-
npm i $(npm pack ../..)
468-
sls --individually=true --runtime=python2.7 package
469-
unzip .serverless/hello.zip -d puck
470-
unzip .serverless/hello2.zip -d puck2
471-
unzip .serverless/hello3.zip -d puck3
472-
ls puck/flask
473-
ls puck2/flask
474-
! ls puck3/flask
475-
}
476-
477-
@test "py2.7 can package flask with package individually & slim option" {
478-
cd tests/base
479-
npm i $(npm pack ../..)
480-
sls --individually=true --slim=true --runtime=python2.7 package
481-
unzip .serverless/hello.zip -d puck
482-
unzip .serverless/hello2.zip -d puck2
483-
unzip .serverless/hello3.zip -d puck3
484-
ls puck/flask
485-
ls puck2/flask
486-
! ls puck3/flask
487-
test $(find puck* -name "*.pyc" | wc -l) -eq 0
488-
}
489-
490-
@test "py3.6 can package only requirements of module" {
491-
cd tests/individually
492-
npm i $(npm pack ../..)
493-
sls package
494-
unzip .serverless/module1-sls-py-req-test-indiv-dev-hello1.zip -d puck
495-
unzip .serverless/module2-sls-py-req-test-indiv-dev-hello2.zip -d puck2
496-
ls puck/handler1.py
497-
ls puck2/handler2.py
498-
ls puck/pyaml
499-
ls puck2/flask
500-
! ls puck/handler2.py
501-
! ls puck2/handler1.py
502-
! ls puck/flask
503-
! ls puck2/pyaml
504-
}
505423

506424
@test "py3.6 can package lambda-decorators using vendor option" {
507425
cd tests/base
@@ -512,21 +430,6 @@ teardown() {
512430
ls puck/lambda_decorators.py
513431
}
514432

515-
@test "py3.6 can package lambda-decorators using vendor and invidiually option" {
516-
cd tests/base
517-
npm i $(npm pack ../..)
518-
sls --individually=true --vendor=./vendor package
519-
unzip .serverless/hello.zip -d puck
520-
unzip .serverless/hello2.zip -d puck2
521-
unzip .serverless/hello3.zip -d puck3
522-
ls puck/flask
523-
ls puck2/flask
524-
! ls puck3/flask
525-
ls puck/lambda_decorators.py
526-
ls puck2/lambda_decorators.py
527-
! ls puck3/lambda_decorators.py
528-
}
529-
530433
@test "Don't nuke execute perms" {
531434
cd tests/base
532435
npm i $(npm pack ../..)
@@ -540,30 +443,6 @@ teardown() {
540443
./puck/foobar
541444
}
542445

543-
@test "Don't nuke execute perms when using individually" {
544-
cd tests/individually
545-
npm i $(npm pack ../..)
546-
touch module1/foobar
547-
chmod +x module1/foobar
548-
perl -p -i'.bak' -e 's/(handler.py$)/\1\n - foobar/' serverless.yml
549-
sls package
550-
unzip .serverless/hello1.zip -d puck
551-
./puck/module1/foobar
552-
}
553-
554-
@test "Don't nuke execute perms when using individually w/docker" {
555-
cd tests/individually
556-
docker &> /dev/null || skip "docker not present"
557-
! uname -sm|grep Linux || groups|grep docker || id -u|egrep '^0$' || skip "can't dockerize on linux if not root & not in docker group"
558-
npm i $(npm pack ../..)
559-
touch module1/foobar
560-
chmod +x module1/foobar
561-
perl -p -i'.bak' -e 's/(handler.py$)/\1\n - foobar/' serverless.yml
562-
sls package --dockerizePip=true
563-
unzip .serverless/hello1.zip -d puck
564-
./puck/module1/foobar
565-
}
566-
567446
@test "py3.6 can package flask in a project with a space in it" {
568447
cp -a tests/base "tests/base with a space"
569448
cd "tests/base with a space"

0 commit comments

Comments
 (0)