kopia lustrzana https://github.com/jupyterhub/repo2docker
Add tests for checking if memlimit is enforced
rodzic
2db2fd7543
commit
43603225de
|
@ -0,0 +1,36 @@
|
|||
import subprocess
|
||||
|
||||
def test_memlimit_nondockerfile():
|
||||
"""
|
||||
Test if memory limited builds are working for non dockerfile builds
|
||||
"""
|
||||
try:
|
||||
subprocess.check_call([
|
||||
'repo2docker',
|
||||
'--no-run',
|
||||
'--build-memory-limit', '4M',
|
||||
'tests/memlimit/non-dockerfile'
|
||||
])
|
||||
# If this doesn't throw an exception, then memory limit was
|
||||
# not enforced!
|
||||
assert False
|
||||
except subprocess.CalledProcessError as e:
|
||||
assert True
|
||||
|
||||
|
||||
def test_memlimit_dockerfile():
|
||||
"""
|
||||
Test if memory limited builds are working for non dockerfile builds
|
||||
"""
|
||||
try:
|
||||
subprocess.check_call([
|
||||
'repo2docker',
|
||||
'--no-run',
|
||||
'--build-memory-limit', '4M',
|
||||
'tests/memlimit/dockerfile'
|
||||
])
|
||||
# If this doesn't throw an exception, then memory limit was
|
||||
# not enforced!
|
||||
assert False
|
||||
except subprocess.CalledProcessError as e:
|
||||
assert True
|
|
@ -0,0 +1,4 @@
|
|||
FROM python:3.6
|
||||
|
||||
COPY postBuild /usr/local/bin/postBuild
|
||||
RUN ./postBuild
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
array = []
|
||||
for i in range(1024 * 1024 * 64):
|
||||
array.append(i)
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
array = []
|
||||
for i in range(1024 * 1024 * 64):
|
||||
array.append(i)
|
Ładowanie…
Reference in New Issue