kopia lustrzana https://github.com/jupyterhub/repo2docker
Update test of editable flag
For some reason the notebook server doesn't exit when we send the SIGTERM signal to the container and as a result waiting for the container to shutdown leads to an exit code of 137 (the notebook server gets kill by SIGKILL).pull/628/head
rodzic
4a9f4a5594
commit
649225166a
|
@ -3,10 +3,8 @@ import re
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from repo2docker.app import Repo2Docker
|
|
||||||
from repo2docker.__main__ import make_r2d
|
from repo2docker.__main__ import make_r2d
|
||||||
|
|
||||||
from conftest import make_test_func
|
|
||||||
|
|
||||||
DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'dockerfile', 'editable')
|
DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'dockerfile', 'editable')
|
||||||
|
|
||||||
|
@ -39,19 +37,26 @@ def test_editable_by_host():
|
||||||
app.initialize()
|
app.initialize()
|
||||||
app.build()
|
app.build()
|
||||||
container = app.start_container()
|
container = app.start_container()
|
||||||
|
|
||||||
# give the container a chance to start
|
# give the container a chance to start
|
||||||
time.sleep(1)
|
while container.status != 'running':
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with tempfile.NamedTemporaryFile(dir=DIR, prefix='testfile', suffix='.txt'):
|
with tempfile.NamedTemporaryFile(dir=DIR, prefix='testfile', suffix='.txt'):
|
||||||
status, output = container.exec_run(['sh', '-c', 'ls testfile????????.txt'])
|
status, output = container.exec_run(['sh', '-c', 'ls testfile????????.txt'])
|
||||||
assert status == 0
|
assert status == 0
|
||||||
assert re.match(br'^testfile\w{8}\.txt\n$', output) is not None
|
assert re.match(br'^testfile\w{8}\.txt\n$', output) is not None
|
||||||
# File should be removed in the container as well
|
# After exiting the with block the file should stop existing
|
||||||
|
# in the container as well as locally
|
||||||
status, output = container.exec_run(['sh', '-c', 'ls testfile????????.txt'])
|
status, output = container.exec_run(['sh', '-c', 'ls testfile????????.txt'])
|
||||||
assert status != 1
|
assert status == 2
|
||||||
assert re.match(br'^testfile\w{8}\.txt\n$', output) is None
|
assert re.match(br'^testfile\w{8}\.txt\n$', output) is None
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
# stop the container
|
# stop the container, we don't care how it stops or
|
||||||
container.stop()
|
# what the exit code is.
|
||||||
app.wait_for_container(container)
|
container.stop(timeout=1)
|
||||||
|
container.reload()
|
||||||
|
assert container.status == 'exited', container.status
|
||||||
|
container.remove()
|
||||||
|
|
Ładowanie…
Reference in New Issue