def test_nochdir_docker(self): """chdir disable""" cmd = ['z'] s = shell(chdir=False, commands=cmd) self.assertEqual(str(s), 'RUN z')
def test_single_singularity(self): """Single command specified""" cmd = ['z'] s = shell(commands=cmd) self.assertEqual(str(s), '%post\n cd /\n z')
def test_single_bash(self): """Single command specified""" cmd = ['z'] s = shell(commands=cmd) self.assertEqual(str(s), 'cd /\nz')
def test_invalid_ctype(self): """Invalid container type specified""" s = shell(commands=['a']) with self.assertRaises(RuntimeError): str(s)
def test_single_docker(self): """Single command specified""" cmd = ['z'] s = shell(commands=cmd) self.assertEqual(str(s), 'RUN z')
def test_merge_singularity(self): s = [] s.append(shell(commands=['a', 'b'])) s.append(shell(commands=['c'])) merged = s[0].merge(s) self.assertEqual(str(merged), '%post\n cd /\n a\n b\n c')
def test_empty(self): """No commands specified""" s = shell() self.assertEqual(str(s), '')
def test_apptest_singularity(self): """test option""" cmds = ['a', 'b', 'c'] s = shell(commands=cmds, _app='foo', chdir=False, _test=True) self.assertEqual(str(s), '%apptest foo\n a\n b\n c')
def test_merge_docker(self): s = [] s.append(shell(commands=['a', 'b'])) s.append(shell(commands=['c'])) merged = s[0].merge(s) self.assertEqual(str(merged), 'RUN a && \\\n b && \\\n c')
def test_appinstall_docker(self): """appinstall not implemented in Docker""" cmds = ['a', 'b', 'c'] s = shell(commands=cmds, _app='foo') self.assertEqual(str(s), 'RUN a && \\\n b && \\\n c')
def test_appinstall_multiple_singularity(self): """Multiple app-specific install commands""" cmds = ['a', 'b', 'c'] s = shell(commands=cmds, _app='foo') self.assertEqual(str(s), '%appinstall foo\n a\n b\n c')
def test_multiple_bash(self): """List of commands specified""" cmds = ['a', 'b', 'c'] s = shell(commands=cmds) self.assertEqual(str(s), 'cd /\na\nb\nc')
def __instructions(self): """Fill in container instructions""" self += shell(chdir=False, commands=self.__commands)
def __instructions(self): """Fill in container instructions""" self += comment('Mellanox OFED version {}'.format(self.__version)) self += packages(ospackages=self.__ospackages) self += shell(commands=self.__commands)