예제 #1
0
def test_build_pr_body_with_synth_log_and_kokoro_build_id():
    with util.ModifiedEnvironment({"KOKORO_BUILD_ID": "42"}):
        synth_log = "A great pull request."
        pr_body = build_pr_body(synth_log)
        assert (pr_body.find(
            "https://source.cloud.google.com/results/invocations/42") > -1)
        assert pr_body.find(synth_log) > -1
예제 #2
0
def test_build_pr_body_with_very_long_synth_log():
    with util.ModifiedEnvironment({"KOKORO_BUILD_ID": "42"}):
        synth_log = "abcdefghi\n" * 10000
        pr_body = build_pr_body(synth_log)
        assert (pr_body.find(
            "https://source.cloud.google.com/results/invocations/42") > -1)
        assert pr_body.find("abcdefghi") > -1
        assert pr_body.find("[LOG TRUNCATED]") > -1
        assert len(pr_body) < 60000
예제 #3
0
def test_build_pr_body_with_synth_trailers():
    synth_log = "synth log"
    pr_body = build_pr_body(synth_log, "a: b\nc: d")
    assert pr_body.find("a: b") > -1
    assert pr_body.find("c: d") > -1
예제 #4
0
def test_build_pr_body_with_kokoro_build_id():
    with util.ModifiedEnvironment({"KOKORO_BUILD_ID": "42"}):
        pr_body = build_pr_body("")
        assert (pr_body.find(
            "https://source.cloud.google.com/results/invocations/42") > -1)
예제 #5
0
def test_build_pr_body_with_synth_log():
    synth_log = "The best pull request ever!"
    pr_body = build_pr_body(synth_log)
    assert pr_body.find(synth_log) > -1