Ejemplo n.º 1
0
 def test_setup_singularity_cache(self):
     cache_path = os.path.join(os.environ['HOME'],
                               '.cache/.popper/singularity/12345')
     shutil.rmtree(cache_path)
     self.assertEqual(os.path.exists(cache_path), False)
     SingularityRunner.setup_singularity_cache('12345')
     self.assertEqual(os.path.exists(cache_path), True)
Ejemplo n.º 2
0
 def test_get_recipe_file(self):
     os.chdir(os.environ['HOME'] +
              '/.cache/.popper/actions/12345/github.com/actions/bin/sh')
     file = SingularityRunner.get_recipe_file(os.getcwd(), '12345')
     self.assertEqual(
         file, os.environ['HOME'] +
         '/.cache/.popper/actions/12345/github.com/actions/bin/sh/' +
         'Singularity.12345')
     os.remove(os.environ['HOME'] +
               '/.cache/.popper/actions/12345/github.com/actions/bin/sh/' +
               'Dockerfile')
     self.assertRaises(SystemExit, SingularityRunner.get_recipe_file,
                       os.getcwd(), '12345')
Ejemplo n.º 3
0
    def setUp(self):
        os.makedirs('/tmp/test_folder')
        os.chdir('/tmp/test_folder')
        log.setLevel('CRITICAL')
        workflow = """
        workflow "sample" {
            resolves = "sample action"
        }

        action "sample action" {
            uses = "popperized/bin/sh@master"
            args = ["echo", "Hello"]
        }
        """
        pu.write_file('/tmp/test_folder/a.workflow', workflow)
        self.wf = Workflow('/tmp/test_folder/a.workflow')
        self.wf.parse()
        WorkflowRunner.download_actions(self.wf, False, False, '12345')
        WorkflowRunner.instantiate_runners('singularity', self.wf,
                                           '/tmp/test_folder', False, False,
                                           '12345')
        self.runner = self.wf.action['sample action']['runner']
        SingularityRunner.setup_singularity_cache('12345')