Skip to content

Commit ded3398

Browse files
committed
use caches by default!
1 parent 56b9c1d commit ded3398

File tree

8 files changed

+18
-25
lines changed

8 files changed

+18
-25
lines changed

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ class ServerlessPythonRequirements {
5151
dockerBuildCmdExtraArgs: [],
5252
dockerRunCmdExtraArgs: [],
5353
dockerExtraFiles: [],
54-
useStaticCache: false,
55-
useDownloadCache: false,
54+
useStaticCache: true,
55+
useDownloadCache: true,
5656
cacheLocation: false,
5757
staticCacheMaxVersions: 0,
5858
pipCmdExtraArgs: [],

test.js

+9-16
Original file line numberDiff line numberDiff line change
@@ -1632,11 +1632,11 @@ test(
16321632
{ skip: !canUseDocker() || process.platform === 'win32' }
16331633
);
16341634

1635-
test('py3.6 uses download cache with useDownloadCache option', t => {
1635+
test('py3.6 uses download cache by default option', t => {
16361636
process.chdir('tests/base');
16371637
const path = npm(['pack', '../..']);
16381638
npm(['i', path]);
1639-
sls(['--useDownloadCache=true', 'package']);
1639+
sls(['package']);
16401640
const cachepath = getUserCachePath();
16411641
t.true(
16421642
pathExistsSync(`${cachepath}${sep}downloadCacheslspyc${sep}http`),
@@ -1645,12 +1645,11 @@ test('py3.6 uses download cache with useDownloadCache option', t => {
16451645
t.end();
16461646
});
16471647

1648-
test('py3.6 uses download cache with cacheLocation option', t => {
1648+
test('py3.6 uses download cache by defaul option', t => {
16491649
process.chdir('tests/base');
16501650
const path = npm(['pack', '../..']);
16511651
npm(['i', path]);
16521652
sls([
1653-
'--useDownloadCache=true',
16541653
'--cacheLocation=.requirements-cache',
16551654
'package'
16561655
]);
@@ -1667,7 +1666,7 @@ test(
16671666
process.chdir('tests/base');
16681667
const path = npm(['pack', '../..']);
16691668
npm(['i', path]);
1670-
sls(['--useDownloadCache=true', '--dockerizePip=true', 'package']);
1669+
sls(['--dockerizePip=true', 'package']);
16711670
const cachepath = getUserCachePath();
16721671
t.true(
16731672
pathExistsSync(`${cachepath}${sep}downloadCacheslspyc${sep}http`),
@@ -1679,13 +1678,12 @@ test(
16791678
);
16801679

16811680
test(
1682-
'py3.6 uses download cache with dockerizePip + cacheLocation option',
1681+
'py3.6 uses download cache with dockerizePip by default option',
16831682
t => {
16841683
process.chdir('tests/base');
16851684
const path = npm(['pack', '../..']);
16861685
npm(['i', path]);
16871686
sls([
1688-
'--useDownloadCache=true',
16891687
'--dockerizePip=true',
16901688
'--cacheLocation=.requirements-cache',
16911689
'package'
@@ -1703,7 +1701,7 @@ test('py3.6 uses static and download cache', t => {
17031701
process.chdir('tests/base');
17041702
const path = npm(['pack', '../..']);
17051703
npm(['i', path]);
1706-
sls(['--useDownloadCache=true', '--useStaticCache=true', 'package']);
1704+
sls(['package']);
17071705
const cachepath = getUserCachePath();
17081706
const cacheFolderHash = sha256Path('.serverless/requirements.txt');
17091707
t.true(
@@ -1724,8 +1722,6 @@ test(
17241722
const path = npm(['pack', '../..']);
17251723
npm(['i', path]);
17261724
sls([
1727-
'--useDownloadCache=true',
1728-
'--useStaticCache=true',
17291725
'--dockerizePip=true',
17301726
'package'
17311727
]);
@@ -1748,7 +1744,7 @@ test('py3.6 uses static cache', t => {
17481744
process.chdir('tests/base');
17491745
const path = npm(['pack', '../..']);
17501746
npm(['i', path]);
1751-
sls(['--useStaticCache=true', 'package']);
1747+
sls(['package']);
17521748
const cachepath = getUserCachePath();
17531749
const cacheFolderHash = sha256Path('.serverless/requirements.txt');
17541750
t.true(
@@ -1767,7 +1763,7 @@ test('py3.6 uses static cache', t => {
17671763
`${cachepath}${sep}${cacheFolderHash}_slspyc${sep}injected_file_is_bad_form`,
17681764
'injected new file into static cache folder'
17691765
);
1770-
sls(['--useStaticCache=true', 'package']);
1766+
sls(['package']);
17711767

17721768
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
17731769
t.true(
@@ -1783,7 +1779,7 @@ test('py3.6 uses static cache with cacheLocation option', t => {
17831779
const path = npm(['pack', '../..']);
17841780
npm(['i', path]);
17851781
const cachepath = '.requirements-cache';
1786-
sls(['--useStaticCache=true', `--cacheLocation=${cachepath}`, 'package']);
1782+
sls([`--cacheLocation=${cachepath}`, 'package']);
17871783
const cacheFolderHash = sha256Path('.serverless/requirements.txt');
17881784
t.true(
17891785
pathExistsSync(`${cachepath}${sep}${cacheFolderHash}_slspyc${sep}flask`),
@@ -1805,7 +1801,6 @@ test(
18051801
const path = npm(['pack', '../..']);
18061802
npm(['i', path]);
18071803
sls([
1808-
'--useStaticCache=true',
18091804
'--dockerizePip=true',
18101805
'--slim=true',
18111806
'package'
@@ -1829,7 +1824,6 @@ test(
18291824
'injected new file into static cache folder'
18301825
);
18311826
sls([
1832-
'--useStaticCache=true',
18331827
'--dockerizePip=true',
18341828
'--slim=true',
18351829
'package'
@@ -1858,7 +1852,6 @@ test(
18581852
const path = npm(['pack', '../..']);
18591853
npm(['i', path]);
18601854
sls([
1861-
'--useDownloadCache=true',
18621855
'--dockerizePip=true',
18631856
'--slim=true',
18641857
'package'

tests/base/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"author": "",
1010
"license": "ISC",
1111
"dependencies": {
12-
"serverless-python-requirements": "file:serverless-python-requirements-4.2.5.tgz"
12+
"serverless-python-requirements": "file:serverless-python-requirements-5.0.0.tgz"
1313
}
1414
}

tests/base/serverless.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ custom:
2525
zip: false
2626
dockerizePip: false
2727
individually: false
28-
useStaticCache: false
29-
useDownloadCache: false
28+
useStaticCache: true
29+
useDownloadCache: true
3030

3131
package:
3232
individually: ${opt:individually, self:custom.defaults.individually}

tests/individually/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"author": "",
1010
"license": "ISC",
1111
"dependencies": {
12-
"serverless-python-requirements": "file:serverless-python-requirements-4.2.5.tgz"
12+
"serverless-python-requirements": "file:serverless-python-requirements-5.0.0.tgz"
1313
}
1414
}

tests/non_build_pyproject/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"author": "",
1010
"license": "ISC",
1111
"dependencies": {
12-
"serverless-python-requirements": "file:serverless-python-requirements-4.2.5.tgz"
12+
"serverless-python-requirements": "file:serverless-python-requirements-5.0.0.tgz"
1313
}
1414
}

tests/pipenv/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"author": "",
1010
"license": "ISC",
1111
"dependencies": {
12-
"serverless-python-requirements": "file:serverless-python-requirements-4.2.5.tgz"
12+
"serverless-python-requirements": "file:serverless-python-requirements-5.0.0.tgz"
1313
}
1414
}

tests/poetry/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"author": "",
1010
"license": "ISC",
1111
"dependencies": {
12-
"serverless-python-requirements": "file:serverless-python-requirements-4.2.5.tgz"
12+
"serverless-python-requirements": "file:serverless-python-requirements-5.0.0.tgz"
1313
}
1414
}

0 commit comments

Comments
 (0)