Example #1
0
 def test_nochdir_docker(self):
     """chdir disable"""
     cmd = ['z']
     s = shell(chdir=False, commands=cmd)
     self.assertEqual(str(s), 'RUN z')
Example #2
0
 def test_single_singularity(self):
     """Single command specified"""
     cmd = ['z']
     s = shell(commands=cmd)
     self.assertEqual(str(s), '%post\n    cd /\n    z')
Example #3
0
 def test_single_bash(self):
     """Single command specified"""
     cmd = ['z']
     s = shell(commands=cmd)
     self.assertEqual(str(s), 'cd /\nz')
Example #4
0
 def test_invalid_ctype(self):
     """Invalid container type specified"""
     s = shell(commands=['a'])
     with self.assertRaises(RuntimeError):
         str(s)
Example #5
0
 def test_single_docker(self):
     """Single command specified"""
     cmd = ['z']
     s = shell(commands=cmd)
     self.assertEqual(str(s), 'RUN z')
Example #6
0
 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')
Example #7
0
 def test_empty(self):
     """No commands specified"""
     s = shell()
     self.assertEqual(str(s), '')
Example #8
0
 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')
Example #9
0
 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')
Example #10
0
 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')
Example #11
0
 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')
Example #12
0
 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')
Example #13
0
 def __instructions(self):
     """Fill in container instructions"""
     self += shell(chdir=False, commands=self.__commands)
Example #14
0
    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)