コード例 #1
0
    def test_gen_job_id_new(self, mock_reattach_job):
        """Test generating job id which is completely new."""

        job_id = 'brand-new'

        mock_reattach_job.side_effect = [GenieJobNotFoundError]

        assert_equals(job_id, generate_job_id(job_id))
コード例 #2
0
ファイル: test_utils.py プロジェクト: ajoymajumdar/genie
    def test_gen_job_id_new(self, mock_reattach_job):
        """Test generating job id which is completely new."""

        job_id = 'brand-new'

        mock_reattach_job.side_effect = [
            GenieJobNotFoundError
        ]

        assert_equals(job_id, generate_job_id(job_id))
コード例 #3
0
    def test_gen_job_id_return_success_true(self, mock_reattach_job):
        """Test generating job id with returning successful job set to True."""

        job_id = 'return-successful-true'

        mock_reattach_job.side_effect = [
            FakeRunningJob(job_id=job_id, status='FAILED'),
            FakeRunningJob(job_id=job_id+'-1', status='KILLED'),
            FakeRunningJob(job_id=job_id+'-2', status='SUCCEEDED'),
            FakeRunningJob(job_id=job_id+'-3', status='SUCCEEDED'),
            FakeRunningJob(job_id=job_id+'-4', status='KILLED'),
            GenieJobNotFoundError
        ]

        assert_equals(job_id+'-2', generate_job_id(job_id))
コード例 #4
0
ファイル: test_utils.py プロジェクト: ajoymajumdar/genie
    def test_gen_job_id_return_success_true(self, mock_reattach_job):
        """Test generating job id with returning successful job set to True."""

        job_id = 'return-successful-true'

        mock_reattach_job.side_effect = [
            FakeRunningJob(job_id=job_id, status='FAILED'),
            FakeRunningJob(job_id=job_id+'-1', status='KILLED'),
            FakeRunningJob(job_id=job_id+'-2', status='SUCCEEDED'),
            FakeRunningJob(job_id=job_id+'-3', status='SUCCEEDED'),
            FakeRunningJob(job_id=job_id+'-4', status='KILLED'),
            GenieJobNotFoundError
        ]

        assert_equals(job_id+'-2', generate_job_id(job_id))
コード例 #5
0
    def test_gen_job_id_with_return_success_false_with_running(self, mock_reattach_job):
        """Test generating job id with returning successful job set to False with a job that is running."""

        job_id = 'return-successful-false-running'

        mock_reattach_job.side_effect = [
            FakeRunningJob(job_id=job_id, status='FAILED'),
            FakeRunningJob(job_id=job_id+'-1', status='KILLED'),
            FakeRunningJob(job_id=job_id+'-2', status='SUCCEEDED'),
            FakeRunningJob(job_id=job_id+'-3', status='KILLED'),
            FakeRunningJob(job_id=job_id+'-4', status='RUNNING'),
            FakeRunningJob(job_id=job_id+'-5', status='SUCCEEDED'),
            GenieJobNotFoundError
        ]

        assert_equals(job_id+'-4', generate_job_id(job_id, return_success=False))
コード例 #6
0
ファイル: test_utils.py プロジェクト: ajoymajumdar/genie
    def test_gen_job_id_with_return_success_false_with_running(self, mock_reattach_job):
        """Test generating job id with returning successful job set to False with a job that is running."""

        job_id = 'return-successful-false-running'

        mock_reattach_job.side_effect = [
            FakeRunningJob(job_id=job_id, status='FAILED'),
            FakeRunningJob(job_id=job_id+'-1', status='KILLED'),
            FakeRunningJob(job_id=job_id+'-2', status='SUCCEEDED'),
            FakeRunningJob(job_id=job_id+'-3', status='KILLED'),
            FakeRunningJob(job_id=job_id+'-4', status='RUNNING'),
            FakeRunningJob(job_id=job_id+'-5', status='SUCCEEDED'),
            GenieJobNotFoundError
        ]

        assert_equals(job_id+'-4', generate_job_id(job_id, return_success=False))