Add buildah test and stub

pull/595/head
Jordan Webb 6 years ago
parent 1a02a86331
commit d71bdd1694
No known key found for this signature in database
GPG Key ID: C341950C47B6CE14

@ -0,0 +1,28 @@
import os
import mitogen
import unittest2
import testlib
class ConstructorTest(testlib.RouterMixin, testlib.TestCase):
def test_okay(self):
buildah_path = testlib.data_path('stubs/stub-buildah.py')
context = self.router.buildah(
container='container_name',
buildah_path=buildah_path,
)
stream = self.router.stream_by_id(context.context_id)
argv = eval(context.call(os.getenv, 'ORIGINAL_ARGV'))
self.assertEquals(argv[0], buildah_path)
self.assertEquals(argv[1], 'run')
self.assertEquals(argv[2], '--')
self.assertEquals(argv[3], 'container_name')
self.assertEquals(argv[4], stream.python_path)
if __name__ == '__main__':
unittest2.main()

@ -0,0 +1,8 @@
#!/usr/bin/env python
import sys
import os
os.environ['ORIGINAL_ARGV'] = repr(sys.argv)
os.environ['THIS_IS_STUB_BUILDAH'] = '1'
os.execv(sys.executable, sys.argv[sys.argv.index('--') + 2:])
Loading…
Cancel
Save