Add tests for checking if memlimit is enforced

pull/159/head
yuvipanda 2017-11-30 18:22:28 -08:00
rodzic 2db2fd7543
commit 43603225de
4 zmienionych plików z 50 dodań i 0 usunięć

36
tests/memlimit.py 100644
Wyświetl plik

@ -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

Wyświetl plik

@ -0,0 +1,4 @@
FROM python:3.6
COPY postBuild /usr/local/bin/postBuild
RUN ./postBuild

Wyświetl plik

@ -0,0 +1,5 @@
#!/usr/bin/env python3
array = []
for i in range(1024 * 1024 * 64):
array.append(i)

Wyświetl plik

@ -0,0 +1,5 @@
#!/usr/bin/env python3
array = []
for i in range(1024 * 1024 * 64):
array.append(i)