コード例 #1
0
def test_cleanup(jenkins, repo, config):
    config['cleanup'] = True
    config['namefmt'] = '{branch}'

    with repo.branches('branches/one', 'branches/two'):
        cmd(config)
        assert jenkins.job_exists('one')
        assert jenkins.job_exists('two')
        assert is_created_by_jenkinsautojobs(jenkins.job('one'))

    with repo.branch('branches/one'):
        cmd(config)
        assert not jenkins.job_exists('two')
コード例 #2
0
ファイル: test_git.py プロジェクト: Musiqua/jenkins-autojobs
def test_cleanup(config, jenkins, repo, tag_method):
    config['cleanup'] = True
    config['tag-method'] = tag_method

    with repo.branches('feature/one', 'feature/two'):
        cmd(config)
        assert jenkins.job_exists('feature-one')
        assert jenkins.job_exists('feature-two')
        assert is_created_by_jenkinsautojobs(jenkins.job('feature-one'), tag_method)

    with repo.branch('feature/one'):
        cmd(config)
        assert not jenkins.job_exists('feature-two')
コード例 #3
0
ファイル: test_svn.py プロジェクト: gvalkov/jenkins-autojobs
def test_cleanup(jenkins, repo, config):
    config['cleanup'] = True
    config['namefmt'] = '{branch}'

    with repo.branches('branches/one', 'branches/two'):
        cmd(config)
        assert jenkins.job_exists('one')
        assert jenkins.job_exists('two')
        assert is_created_by_jenkinsautojobs(jenkins.job('one'))

    with repo.branch('branches/one'):
        cmd(config)
        assert not jenkins.job_exists('two')
コード例 #4
0
def test_cleanup(config, jenkins, repo, tag_method):
    config['cleanup'] = True
    config['tag-method'] = tag_method

    with repo.branches('feature/one', 'feature/two'):
        cmd(config)
        assert jenkins.job_exists('feature-one')
        assert jenkins.job_exists('feature-two')
        assert is_created_by_jenkinsautojobs(jenkins.job('feature-one'), tag_method)

    with repo.branch('feature/one'):
        cmd(config)
        assert not jenkins.job_exists('feature-two')
コード例 #5
0
ファイル: test_git.py プロジェクト: Musiqua/jenkins-autojobs
def test_failing_git_cleanup(config, jenkins, repo, tag_method):
    config['cleanup'] = True
    config['tag-method'] = tag_method

    with repo.branches('feature/one', 'feature/two'):
        cmd(config)
        assert jenkins.job_exists('feature-one')
        assert jenkins.job_exists('feature-two')

        assert is_created_by_jenkinsautojobs(jenkins.job('feature-one'), tag_method)

        config['repo'] = '/tmp/should-never-exist-zxcv-123-zxcv-1asfmn'
        with pytest.raises(SystemExit):
            cmd(config)
        # feature-{one,two} should not be removed if command fails
        assert jenkins.job_exists('feature-one')
        assert jenkins.job_exists('feature-two')
コード例 #6
0
def test_failing_git_cleanup(config, jenkins, repo, tag_method):
    config['cleanup'] = True
    config['tag-method'] = tag_method

    with repo.branches('feature/one', 'feature/two'):
        cmd(config)
        assert jenkins.job_exists('feature-one')
        assert jenkins.job_exists('feature-two')

        assert is_created_by_jenkinsautojobs(jenkins.job('feature-one'), tag_method)

        config['repo'] = '/tmp/should-never-exist-zxcv-123-zxcv-1asfmn'
        with pytest.raises(SystemExit):
            cmd(config)
        # feature-{one,two} should not be removed if command fails
        assert jenkins.job_exists('feature-one')
        assert jenkins.job_exists('feature-two')