Пример #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
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
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
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')