コード例 #1
0
ファイル: test_views.py プロジェクト: pombredanne/cinch
def test_build_with_shas(fixtures, app_context):
    client = app.test_client()
    data = {
        'job_name': 'app_integration',
        'build_number': 3,
        'project_name': 'application',
        'sha': 'sha1',
    }
    response = client.post('/jenkins/api/build_sha', data=data)
    assert response.status_code == 200

    data = {
        'job_name': 'app_integration',
        'build_number': 3,
        'project_name': 'library',
        'sha': 'sha2',
    }
    response = client.post('/jenkins/api/build_sha', data=data)
    assert response.status_code == 200


    data = make_jenkins_data('app_integration', 3)
    response = client.post('/jenkins/api/build_status', data=json.dumps(data))
    assert response.status_code == 200

    application = db.session.query(Project).filter_by(name='application').one()
    library = db.session.query(Project).filter_by(name='library').one()
    application.master_sha = 'sha1'
    library.master_sha = 'sha2'

    db.session.commit()

    assert build_check('application', 'sha1')
コード例 #2
0
ファイル: test_controllers.py プロジェクト: pombredanne/cinch
def test_integration_test_check(session, fixtures, app_context):
    lib_sha = "lib-proposed-sha"

    # library@proposed-sha passes unit tests
    record_job_sha('library_unit', 1, 'library', lib_sha)
    record_job_result('library_unit', 1, True, "passed")


    small_app = fixtures['small_app']
    large_app = fixtures['large_app']
    mobile = fixtures['mobile']

    # set project master_shas
    small_app.master_sha = "sha1"
    large_app.master_sha = "sha2"
    mobile.master_sha = "sha3"
    session.commit()

    # small_app@sha1 integration passes against library@lib_sha
    shas = {
        'small_app': 'sha1',
        'library': lib_sha
    }
    record_job_shas('small_app_integration', 1, shas)
    record_job_result('small_app_integration', 1, True, "passed")

    # library integration not yet satisfied
    assert not build_check('library', lib_sha)

    # large_app@sha2 integration passes against library@lib_sha
    shas = {
        'large_app': 'sha2',
        'library': lib_sha
    }
    record_job_shas('large_app_integration', 1, shas)
    record_job_result('large_app_integration', 1, True, "passed")

    # library integration not yet satisfied
    assert not build_check('library', lib_sha)

    # mobile@sha3 integration FAILS against library@lib_sha and large_app@sha2
    shas = {
        'mobile': 'sha3',
        'large_app': 'sha2',
        'library': lib_sha
    }
    record_job_shas('mobile_integration', 1, shas)
    record_job_result('mobile_integration', 1, False, "aborted")

    # library integration not yet satisfied
    assert not build_check('library', lib_sha)

    # mobile@sha3 integration PASSES against library@lib_sha,
    # but  against large_app@sha4
    shas = {
        'mobile': 'sha3',
        'large_app': 'sha4',
        'library': lib_sha
    }
    record_job_shas('mobile_integration', 2, shas)
    record_job_result('mobile_integration', 2, True, "passed")

    # library integration not yet satisfied
    assert not build_check('library', lib_sha)

    # mobile@sha3 integration PASSES against library@lib_sha AND large_app@sha2
    shas = {
        'mobile': 'sha3',
        'large_app': 'sha2',
        'library': lib_sha
    }
    record_job_shas('mobile_integration', 3, shas)
    record_job_result('mobile_integration', 3, True, "passed")

    # library integration finally satisfied
    assert build_check('library', lib_sha)