Exemple #1
0
def test_ingest_hg_pushlog_not_found_in_json_pushes(jm, initial_data, test_base_dir,
                                                    test_repository, mock_post_json, activate_responses):
    """
    Ingest a pushlog that is not found in json-pushes.  So we ingest a
    resultset that is "onhold"

    """

    pushlog_fake_url = "http://www.thisismypushlog.com"
    responses.add(responses.GET, pushlog_fake_url,
                  body="foo", status=404,
                  content_type='application/json')

    process = MissingHgPushlogProcess()

    process.run(pushlog_fake_url, jm.project, "123456789012")

    pushes_stored = jm.get_dhub().execute(
        proc="jobs_test.selects.result_sets",
        return_type='tuple'
    )

    assert len(pushes_stored) == 1
    assert pushes_stored[0]['active_status'] == "onhold"

    revisions_stored = jm.get_dhub().execute(
        proc="jobs_test.selects.revision_ids",
        return_type='tuple'
    )

    assert len(revisions_stored) == 1
Exemple #2
0
def fetch_missing_hg_push_logs(repo_name, repo_url, resultset):
    """
    Run a HgPushlog etl process

    ``revisions`` is a list of changeset values truncated to 12 chars.
    """
    process = MissingHgPushlogProcess()

    changesetParam = urllib.urlencode({"changeset": resultset}, True)
    url_str = repo_url + '/json-pushes/?full=1&version=2&' + changesetParam

    logger.info("fetching missing resultsets: {0}".format(url_str))
    process.run(url_str, repo_name, resultset)