Exemplo n.º 1
0
def main():
    parser = argparse.ArgumentParser(description='Run integration tests')
    parser.add_argument('--all', dest="run_all", action="store_true",
                        help="run all of the clients' integration tests")
    parser.add_argument('--letsencrypt', dest='run_letsencrypt', action='store_true',
                        help="run the letsencrypt's (the python client's) integration tests")
    parser.add_argument('--node', dest="run_node", action="store_true",
                        help="run the node client's integration tests")
    # allow any ACME client to run custom command for integration
    # testing (without having to implement its own busy-wait loop)
    parser.add_argument('--custom', metavar="CMD", help="run custom command")
    parser.set_defaults(run_all=False, run_letsencrypt=False, run_node=False)
    args = parser.parse_args()

    if not (args.run_all or args.run_letsencrypt or args.run_node or args.custom is not None):
        print >> sys.stderr, "must run at least one of the letsencrypt or node tests with --all, --letsencrypt, --node, or --custom"
        die(ExitStatus.IncorrectCommandLineArgs)

    if not startservers.start(race_detection=True):
        die(ExitStatus.Error)

    if args.run_all or args.run_node:
        os.chdir('test/js')
        if subprocess.Popen('npm install', shell=True).wait() != 0:
            print("\n Installing NPM modules failed")
            die(ExitStatus.Error)
        # Pick a random hostname so we don't run into certificate rate limiting.
        domain = "www." + subprocess.check_output("openssl rand -hex 6", shell=True).strip() + "-TEST.com"
        challenge_types = ["http-01", "dns-01"]

        expected_ct_submissions = 1
        resp = urllib2.urlopen("http://localhost:4500/submissions")
        submissionStr = resp.read()
        if int(submissionStr) > 0:
            expected_ct_submissions = int(submissionStr)+1
        for chall_type in challenge_types:
            if run_node_test(domain, chall_type, expected_ct_submissions) != 0:
                die(ExitStatus.NodeFailure)
            expected_ct_submissions += 1

        if run_node_test("good-caa-reserved.com", challenge_types[0], expected_ct_submissions) != 0:
            print("\nDidn't issue certificate for domain with good CAA records")
            die(ExitStatus.NodeFailure)

        if run_node_test("bad-caa-reserved.com", challenge_types[0], expected_ct_submissions) != ISSUANCE_FAILED:
            print("\nIssused certificate for domain with bad CAA records")
            die(ExitStatus.NodeFailure)

    # Simulate a disconnection from RabbitMQ to make sure reconnects work.
    startservers.bounce_forward()

    if args.run_all or args.run_letsencrypt:
        run_client_tests()

    if args.custom:
        run_custom(args.custom)

    if not startservers.check():
        die(ExitStatus.Error)
    exit_status = ExitStatus.OK
Exemplo n.º 2
0
def main():
    if not startservers.start(race_detection=True):
        raise Exception("startservers failed")

    if os.environ.get('BOULDER_CONFIG_DIR', '').startswith("test/config-next"):
        test_sct_embedding()

    test_multidomain()
    test_wildcardmultidomain()
    test_overlapping_wildcard()
    test_wildcard_exactblacklist()
    test_wildcard_authz_reuse()
    test_order_reuse_failed_authz()
    test_revoke_by_issuer()
    test_revoke_by_authz()
    test_revoke_by_privkey()
    test_order_finalize_early()
    test_only_return_existing_reg()
    test_bad_overlap_wildcard()

    test_loadgeneration()
    test_cert_checker()

    if not startservers.check():
        raise Exception("startservers.check failed")

    global exit_status
    exit_status = 0
Exemplo n.º 3
0
def main():
    parser = argparse.ArgumentParser(description='Run integration tests')
    parser.add_argument('--all', dest="run_all", action="store_true",
                        help="run all of the clients' integration tests")
    parser.add_argument('--certbot', dest='run_certbot', action='store_true',
                        help="run the certbot integration tests")
    parser.add_argument('--node', dest="run_node", action="store_true",
                        help="run the node client's integration tests")
    # allow any ACME client to run custom command for integration
    # testing (without having to implement its own busy-wait loop)
    parser.add_argument('--custom', metavar="CMD", help="run custom command")
    parser.set_defaults(run_all=False, run_certbot=False, run_node=False)
    args = parser.parse_args()

    if not (args.run_all or args.run_certbot or args.run_node or args.custom is not None):
        print >> sys.stderr, "must run at least one of the letsencrypt or node tests with --all, --certbot, --node, or --custom"
        die(ExitStatus.IncorrectCommandLineArgs)

    if not startservers.start(race_detection=True):
        die(ExitStatus.Error)

    if args.run_all or args.run_node:
        os.chdir('test/js')
        if subprocess.Popen('npm install', shell=True).wait() != 0:
            print("\n Installing NPM modules failed")
            die(ExitStatus.Error)
        # Pick a random hostname so we don't run into certificate rate limiting.
        domain = "www." + subprocess.check_output("openssl rand -hex 6", shell=True).strip() + "-TEST.com"
        challenge_types = ["http-01", "dns-01"]

        expected_ct_submissions = 1
        resp = urllib2.urlopen("http://localhost:4500/submissions")
        submissionStr = resp.read()
        if int(submissionStr) > 0:
            expected_ct_submissions = int(submissionStr)+1
        for chall_type in challenge_types:
            if run_node_test(domain, chall_type, expected_ct_submissions) != 0:
                die(ExitStatus.NodeFailure)
            expected_ct_submissions += 1

        if run_node_test("good-caa-reserved.com", challenge_types[0], expected_ct_submissions) != 0:
            print("\nDidn't issue certificate for domain with good CAA records")
            die(ExitStatus.NodeFailure)

        if run_node_test("bad-caa-reserved.com", challenge_types[0], expected_ct_submissions) != ISSUANCE_FAILED:
            print("\nIssused certificate for domain with bad CAA records")
            die(ExitStatus.NodeFailure)

    # Simulate a disconnection from RabbitMQ to make sure reconnects work.
    startservers.bounce_forward()

    if args.run_all or args.run_certbot:
        run_client_tests()

    if args.custom:
        run_custom(args.custom)

    if not startservers.check():
        die(ExitStatus.Error)
    exit_status = ExitStatus.OK
Exemplo n.º 4
0
def main():
    parser = argparse.ArgumentParser(description='Run integration tests')
    parser.add_argument('--all', dest="run_all", action="store_true",
                        help="run all of the clients' integration tests")
    parser.add_argument('--letsencrypt', dest='run_letsencrypt', action='store_true',
                        help="run the letsencrypt's (the python client's) integration tests")
    parser.add_argument('--node', dest="run_node", action="store_true",
                        help="run the node client's integration tests")
    parser.set_defaults(run_all=False, run_letsencrypt=False, run_node=False)
    args = parser.parse_args()

    if not (args.run_all or args.run_letsencrypt or args.run_node):
        print >> sys.stderr, "must run at least one of the letsencrypt or node tests with --all, --letsencrypt, or --node"
        die(ExitStatus.IncorrectCommandLineArgs)

    if not startservers.start(race_detection=True):
        die(ExitStatus.Error)

    if args.run_all or args.run_node:
        run_node_test()

    # Simulate a disconnection from RabbitMQ to make sure reconnects work.
    startservers.bounce_forward()

    if args.run_all or args.run_letsencrypt:
        run_client_tests()

    check_activity_monitor()

    if not startservers.check():
        die(ExitStatus.Error)
    exit_status = ExitStatus.OK
Exemplo n.º 5
0
def main():
    parser = argparse.ArgumentParser(description='Run integration tests')
    parser.add_argument('--all',
                        dest="run_all",
                        action="store_true",
                        help="run all of the clients' integration tests")
    parser.add_argument('--certbot',
                        dest='run_certbot',
                        action='store_true',
                        help="run the certbot integration tests")
    parser.add_argument('--chisel',
                        dest="run_chisel",
                        action="store_true",
                        help="run integration tests using chisel")
    # allow any ACME client to run custom command for integration
    # testing (without having to implement its own busy-wait loop)
    parser.add_argument('--custom', metavar="CMD", help="run custom command")
    parser.set_defaults(run_all=False, run_certbot=False, run_chisel=False)
    args = parser.parse_args()

    if not (args.run_all or args.run_certbot or args.run_chisel
            or args.custom is not None):
        raise Exception(
            "must run at least one of the letsencrypt or chisel tests with --all, --certbot, --chisel, or --custom"
        )

    # Keep track of whether we started the Boulder servers and need to shut them down.
    started_servers = False
    # Check if WFE is already running.
    try:
        urllib2.urlopen("http://localhost:4000/directory")
    except urllib2.URLError:
        # WFE not running, start all of Boulder.
        started_servers = True
        if not startservers.start(race_detection=True):
            raise Exception("startservers failed")

    if args.run_all or args.run_chisel:
        run_chisel()

    # Simulate a disconnection from RabbitMQ to make sure reconnects work.
    if started_servers:
        startservers.bounce_forward()

    if args.run_all or args.run_certbot:
        run_client_tests()

    if args.custom:
        run(args.custom)

    if started_servers and not startservers.check():
        raise Exception("startservers.check failed")

    global exit_status
    exit_status = 0
Exemplo n.º 6
0
def main():
    parser = argparse.ArgumentParser(description='Run integration tests')
    parser.add_argument('--all',
                        dest="run_all",
                        action="store_true",
                        help="run all of the clients' integration tests")
    parser.add_argument('--certbot',
                        dest='run_certbot',
                        action='store_true',
                        help="run the certbot integration tests")
    parser.add_argument('--chisel',
                        dest="run_chisel",
                        action="store_true",
                        help="run integration tests using chisel")
    # allow any ACME client to run custom command for integration
    # testing (without having to implement its own busy-wait loop)
    parser.add_argument('--custom', metavar="CMD", help="run custom command")
    parser.set_defaults(run_all=False, run_certbot=False, run_chisel=False)
    args = parser.parse_args()

    if not (args.run_all or args.run_certbot or args.run_chisel
            or args.custom is not None):
        raise Exception(
            "must run at least one of the letsencrypt or chisel tests with --all, --certbot, --chisel, or --custom"
        )

    now = datetime.datetime.utcnow()
    seventy_days_ago = now + datetime.timedelta(days=-70)
    if not startservers.start(race_detection=True,
                              fakeclock=fakeclock(seventy_days_ago)):
        raise Exception("startservers failed (mocking seventy days ago)")
    setup_seventy_days_ago()
    startservers.stop()

    if not startservers.start(race_detection=True):
        raise Exception("startservers failed")

    if args.run_all or args.run_chisel:
        run_chisel()

    # Simulate a disconnection to make sure gRPC reconnects work.
    startservers.bounce_forward()

    if args.run_all or args.run_certbot:
        run_client_tests()

    if args.custom:
        run(args.custom)

    if not startservers.check():
        raise Exception("startservers.check failed")

    global exit_status
    exit_status = 0
Exemplo n.º 7
0
def main():
    if not startservers.start(race_detection=True):
        raise Exception("startservers failed")

    test_multidomain()
    test_wildcardmultidomain()
    test_overlapping_wildcard()

    if not startservers.check():
        raise Exception("startservers.check failed")

    global exit_status
    exit_status = 0
Exemplo n.º 8
0
def main():
    if not startservers.start(race_detection=True):
        raise Exception("startservers failed")

    test_multidomain()
    test_wildcardmultidomain()
    test_overlapping_wildcard()
    test_wildcard_exactblacklist()
    test_wildcard_authz_reuse()

    if not startservers.check():
        raise Exception("startservers.check failed")

    global exit_status
    exit_status = 0
Exemplo n.º 9
0
def main():
    if not startservers.start(race_detection=True):
        raise Exception("startservers failed")

    test_multidomain()
    # Disabled DNS-based test cases temporarily while debugging a flakiness
    # issue (#3312)
    #test_wildcardmultidomain()
    #test_overlapping_wildcard()
    test_wildcard_exactblacklist()
    test_wildcard_authz_reuse()

    if not startservers.check():
        raise Exception("startservers.check failed")

    global exit_status
    exit_status = 0
Exemplo n.º 10
0
def main():
    parser = argparse.ArgumentParser(description='Run integration tests')
    parser.add_argument('--all', dest="run_all", action="store_true",
                        help="run all of the clients' integration tests")
    parser.add_argument('--certbot', dest='run_certbot', action='store_true',
                        help="run the certbot integration tests")
    parser.add_argument('--chisel', dest="run_chisel", action="store_true",
                        help="run integration tests using chisel")
    # allow any ACME client to run custom command for integration
    # testing (without having to implement its own busy-wait loop)
    parser.add_argument('--custom', metavar="CMD", help="run custom command")
    parser.set_defaults(run_all=False, run_certbot=False, run_chisel=False)
    args = parser.parse_args()

    if not (args.run_all or args.run_certbot or args.run_chisel or args.custom is not None):
        raise Exception("must run at least one of the letsencrypt or chisel tests with --all, --certbot, --chisel, or --custom")

    now = datetime.datetime.utcnow()
    seventy_days_ago = now+datetime.timedelta(days=-70)
    if not startservers.start(race_detection=True, fakeclock=fakeclock(seventy_days_ago)):
        raise Exception("startservers failed (mocking seventy days ago)")
    setup_seventy_days_ago()
    startservers.stop()

    if not startservers.start(race_detection=True):
        raise Exception("startservers failed")

    if args.run_all or args.run_chisel:
        run_chisel()

    # Simulate a disconnection to make sure gRPC reconnects work.
    startservers.bounce_forward()

    if args.run_all or args.run_certbot:
        run_client_tests()

    if args.custom:
        run(args.custom)

    if not startservers.check():
        raise Exception("startservers.check failed")

    global exit_status
    exit_status = 0
Exemplo n.º 11
0
def main():
    if not startservers.start(race_detection=True):
        raise Exception("startservers failed")

    test_multidomain()
    test_wildcardmultidomain()
    test_overlapping_wildcard()
    test_wildcard_exactblacklist()
    test_wildcard_authz_reuse()
    test_order_reuse_failed_authz()
    test_revoke_by_issuer()
    test_revoke_by_authz()
    test_revoke_by_privkey()
    test_order_finalize_early()

    if not startservers.check():
        raise Exception("startservers.check failed")

    global exit_status
    exit_status = 0
Exemplo n.º 12
0
        "Please set LETSENCRYPT_PATH env variable to point at "
        "initialized (virtualenv) client repo root")
    test_script_path = os.path.join(root, 'tests', 'boulder-integration.sh')
    cmd = "source %s/venv/bin/activate && SIMPLE_HTTP_PORT=5002 %s" % (
        root, test_script_path)
    if subprocess.Popen(cmd, shell=True, cwd=root,
                        executable='/bin/bash').wait() != 0:
        die(ExitStatus.PythonFailure)


@atexit.register
def cleanup():
    import shutil
    shutil.rmtree(tempdir)
    if exit_status == ExitStatus.OK:
        print("\n\nSUCCESS")
    else:
        print("\n\nFAILURE %d" % exit_status)


exit_status = ExitStatus.OK
tempdir = tempfile.mkdtemp()
if not startservers.start(race_detection=True):
    die(ExitStatus.Error)
run_node_test()
# Simulate a disconnection from RabbitMQ to make sure reconnects work.
startservers.bounce_forward()
run_client_tests()
if not startservers.check():
    die(ExitStatus.Error)
Exemplo n.º 13
0
This runs in non-monolithic mode and requires RabbitMQ on localhost.

Keeps servers alive until ^C. Exit non-zero if any servers fail to
start, or die before ^C.
"""

import errno
import os
import sys
import time

sys.path.append('./test')
import startservers

if not startservers.start(race_detection=False, fakeclock=None):
    sys.exit(1)
try:
    os.wait()

    # If we reach here, a child died early. Log what died:
    startservers.check()
    sys.exit(1)
except KeyboardInterrupt:
    print "\nstopping servers."
except OSError, v:
    # Ignore EINTR, which happens when we get SIGTERM or SIGINT (i.e. when
    # someone hits Ctrl-C after running docker-compose up or start.py.
    if v.errno != errno.EINTR:
        raise
Exemplo n.º 14
0
def main():
    parser = argparse.ArgumentParser(description='Run integration tests')
    parser.add_argument('--all',
                        dest="run_all",
                        action="store_true",
                        help="run all of the clients' integration tests")
    parser.add_argument('--certbot',
                        dest='run_certbot',
                        action='store_true',
                        help="run the certbot integration tests")
    parser.add_argument('--chisel',
                        dest="run_chisel",
                        action="store_true",
                        help="run integration tests using chisel")
    parser.add_argument('--load',
                        dest="run_loadtest",
                        action="store_true",
                        help="run load-generator")
    parser.add_argument('--filter',
                        dest="test_case_filter",
                        action="store",
                        help="Regex filter for test cases")
    parser.add_argument('--skip-setup',
                        dest="skip_setup",
                        action="store_true",
                        help="skip integration test setup")
    # allow any ACME client to run custom command for integration
    # testing (without having to implement its own busy-wait loop)
    parser.add_argument('--custom', metavar="CMD", help="run custom command")
    parser.set_defaults(run_all=False,
                        run_certbot=False,
                        run_chisel=False,
                        run_loadtest=False,
                        test_case_filter="",
                        skip_setup=False)
    args = parser.parse_args()

    if not (args.run_all or args.run_certbot or args.run_chisel
            or args.run_loadtest or args.custom is not None):
        raise Exception(
            "must run at least one of the letsencrypt or chisel tests with --all, --certbot, --chisel, --load or --custom"
        )

    if not args.skip_setup:
        now = datetime.datetime.utcnow()
        seventy_days_ago = now + datetime.timedelta(days=-70)
        if not startservers.start(race_detection=True,
                                  fakeclock=fakeclock(seventy_days_ago)):
            raise Exception("startservers failed (mocking seventy days ago)")
        setup_seventy_days_ago()
        global caa_client
        caa_client = chisel.make_client()
        startservers.stop()

        now = datetime.datetime.utcnow()
        twenty_days_ago = now + datetime.timedelta(days=-20)
        if not startservers.start(race_detection=True,
                                  fakeclock=fakeclock(twenty_days_ago)):
            raise Exception("startservers failed (mocking twenty days ago)")
        setup_twenty_days_ago()
        startservers.stop()

    caa_acount_uri = caa_client.account.uri if caa_client is not None else None
    if not startservers.start(race_detection=True, account_uri=caa_acount_uri):
        raise Exception("startservers failed")

    if not args.skip_setup:
        setup_zero_days_ago()

    if args.run_all or args.run_chisel:
        run_chisel(args.test_case_filter)

    if args.run_all or args.run_certbot:
        run_client_tests()

    if args.run_all or args.run_loadtest:
        run_loadtest()

    if args.custom:
        run(args.custom)

    run_cert_checker()
    check_balance()
    run_expired_authz_purger()

    if not startservers.check():
        raise Exception("startservers.check failed")

    global exit_status
    exit_status = 0
Exemplo n.º 15
0
def main():
    parser = argparse.ArgumentParser(description='Run integration tests')
    parser.add_argument('--all', dest="run_all", action="store_true",
                        help="run all of the clients' integration tests")
    parser.add_argument('--certbot', dest='run_certbot', action='store_true',
                        help="run the certbot integration tests")
    parser.add_argument('--chisel', dest="run_chisel", action="store_true",
                        help="run integration tests using chisel")
    parser.add_argument('--load', dest="run_loadtest", action="store_true",
                        help="run load-generator")
    parser.add_argument('--filter', dest="test_case_filter", action="store",
                        help="Regex filter for test cases")
    # allow any ACME client to run custom command for integration
    # testing (without having to implement its own busy-wait loop)
    parser.add_argument('--custom', metavar="CMD", help="run custom command")
    parser.set_defaults(run_all=False, run_certbot=False, run_chisel=False,
        run_loadtest=False, test_case_filter="")
    args = parser.parse_args()

    if not (args.run_all or args.run_certbot or args.run_chisel or args.run_loadtest or args.custom is not None):
        raise Exception("must run at least one of the letsencrypt or chisel tests with --all, --certbot, --chisel, --load or --custom")

    now = datetime.datetime.utcnow()
    seventy_days_ago = now+datetime.timedelta(days=-70)
    if not startservers.start(race_detection=True, fakeclock=fakeclock(seventy_days_ago)):
        raise Exception("startservers failed (mocking seventy days ago)")
    setup_seventy_days_ago()
    startservers.stop()

    now = datetime.datetime.utcnow()
    twenty_days_ago = now+datetime.timedelta(days=-20)
    if not startservers.start(race_detection=True, fakeclock=fakeclock(twenty_days_ago)):
        raise Exception("startservers failed (mocking twenty days ago)")
    setup_twenty_days_ago()
    startservers.stop()

    if not startservers.start(race_detection=True, account_uri=caa_client.account.uri):
        raise Exception("startservers failed")

    setup_zero_days_ago()

    if args.run_all or args.run_chisel:
        run_chisel(args.test_case_filter)

    if args.run_all or args.run_certbot:
        run_client_tests()

    if args.run_all or args.run_loadtest:
        run_loadtest()

    if args.custom:
        run(args.custom)

    run_cert_checker()
    check_balance()
    run_expired_authz_purger()

    if not startservers.check():
        raise Exception("startservers.check failed")

    global exit_status
    exit_status = 0
Exemplo n.º 16
0
def main():
    parser = argparse.ArgumentParser(description='Run integration tests')
    parser.add_argument('--certbot',
                        dest='run_certbot',
                        action='store_true',
                        help="run the certbot integration tests")
    parser.add_argument('--chisel',
                        dest="run_chisel",
                        action="store_true",
                        help="run integration tests using chisel")
    parser.add_argument('--filter',
                        dest="test_case_filter",
                        action="store",
                        help="Regex filter for test cases")
    # allow any ACME client to run custom command for integration
    # testing (without having to implement its own busy-wait loop)
    parser.add_argument('--custom', metavar="CMD", help="run custom command")
    parser.set_defaults(run_certbot=False,
                        run_chisel=False,
                        test_case_filter="",
                        skip_setup=False)
    args = parser.parse_args()

    if not (args.run_certbot or args.run_chisel or args.run_loadtest
            or args.custom is not None):
        raise Exception(
            "must run at least one of the letsencrypt or chisel tests with --certbot, --chisel, or --custom"
        )

    if not args.test_case_filter:
        now = datetime.datetime.utcnow()

        six_months_ago = now + datetime.timedelta(days=-30 * 6)
        if not startservers.start(race_detection=True,
                                  fakeclock=fakeclock(six_months_ago)):
            raise Exception("startservers failed (mocking six months ago)")
        v1_integration.caa_client = caa_client = chisel.make_client()
        setup_six_months_ago()
        startservers.stop()

        twenty_days_ago = now + datetime.timedelta(days=-20)
        if not startservers.start(race_detection=True,
                                  fakeclock=fakeclock(twenty_days_ago)):
            raise Exception("startservers failed (mocking twenty days ago)")
        setup_twenty_days_ago()
        startservers.stop()

    if not startservers.start(race_detection=True):
        raise Exception("startservers failed")

    if args.run_chisel:
        run_chisel(args.test_case_filter)

    if args.run_certbot:
        run_client_tests()

    run_go_tests()

    if args.custom:
        run(args.custom)

    # Skip the last-phase checks when the test case filter is one, because that
    # means we want to quickly iterate on a single test case.
    if not args.test_case_filter:
        run_cert_checker()
        check_balance()
        if not CONFIG_NEXT:
            run_expired_authz_purger()

        # Run the boulder-janitor. This should happen after all other tests because
        # it runs with the fake clock set to the future and deletes rows that may
        # otherwise be referenced by tests.
        run_janitor()

        # Run the load-generator last. run_loadtest will stop the
        # pebble-challtestsrv before running the load-generator and will not restart
        # it.
        run_loadtest()

    if not startservers.check():
        raise Exception("startservers.check failed")

    global exit_status
    exit_status = 0
Exemplo n.º 17
0
def run_client_tests():
    root = os.environ.get("LETSENCRYPT_PATH")
    assert root is not None, (
        "Please set LETSENCRYPT_PATH env variable to point at "
        "initialized (virtualenv) client repo root")
    os.environ['SERVER'] = 'http://localhost:4000/acme/new-reg'
    test_script_path = os.path.join(root, 'tests', 'boulder-integration.sh')
    if subprocess.Popen(test_script_path, shell=True, cwd=root).wait() != 0:
        die(ExitStatus.PythonFailure)


@atexit.register
def cleanup():
    import shutil
    shutil.rmtree(tempdir)
    if exit_status == ExitStatus.OK:
        print("\n\nSUCCESS")
    else:
        print("\n\nFAILURE")


exit_status = ExitStatus.OK
tempdir = tempfile.mkdtemp()
if not startservers.start(race_detection=True):
    die(ExitStatus.Error)
run_node_test()
run_client_tests()
if not startservers.check():
    die(ExitStatus.Error)
Exemplo n.º 18
0
def main():
    parser = argparse.ArgumentParser(description='Run integration tests')
    parser.add_argument('--all',
                        dest="run_all",
                        action="store_true",
                        help="run all of the clients' integration tests")
    parser.add_argument('--certbot',
                        dest='run_certbot',
                        action='store_true',
                        help="run the certbot integration tests")
    parser.add_argument('--fuzz',
                        dest="run_fuzz",
                        action="store_true",
                        help="run fuzzing stuff with chisel")
    parser.add_argument('--iter',
                        dest="iters",
                        action="store",
                        type=int,
                        default=5,
                        help="number of fuzzing iterations")
    parser.add_argument('--type',
                        dest="fuzz_type",
                        action="store",
                        type=str,
                        default='csr',
                        help="type of fuzzing (csr/config)")
    parser.add_argument('--load',
                        dest="run_loadtest",
                        action="store_true",
                        help="run load-generator")
    parser.add_argument('--filter',
                        dest="test_case_filter",
                        action="store",
                        help="Regex filter for test cases")
    parser.add_argument('--skip-setup',
                        dest="skip_setup",
                        action="store_true",
                        help="skip integration test setup")
    # allow any ACME client to run custom command for integration
    # testing (without having to implement its own busy-wait loop)
    parser.add_argument('--custom', metavar="CMD", help="run custom command")
    parser.set_defaults(run_all=False,
                        run_certbot=False,
                        run_fuzz=False,
                        run_loadtest=False,
                        test_case_filter="",
                        skip_setup=False)
    args = parser.parse_args()

    if not (args.run_all or args.run_certbot or args.run_fuzz
            or args.run_loadtest or args.custom is not None):
        raise Exception(
            "must run at least one of the letsencrypt or chisel tests with --all, --certbot, --chisel, --load or --custom"
        )

    config = default_config_dir  # TODO: change this to get different configs

    if not startservers.start(race_detection=True, config_dir=config):
        raise Exception("startservers failed")

    if args.fuzz_type.lower() == 'csr':
        run_fuzz_csrs(args.iters)
    elif args.fuzz_type.lower() == 'config':
        run_fuzz_configs(args.iters)

    if args.custom:
        run(args.custom)

    if not startservers.check():
        raise Exception("startservers.check failed")

    global exit_status
    exit_status = 0
Exemplo n.º 19
0
def main():
    parser = argparse.ArgumentParser(description='Run integration tests')
    parser.add_argument('--chisel',
                        dest="run_chisel",
                        action="store_true",
                        help="run integration tests using chisel")
    parser.add_argument('--gotest',
                        dest="run_go",
                        action="store_true",
                        help="run Go integration tests")
    parser.add_argument('--filter',
                        dest="test_case_filter",
                        action="store",
                        help="Regex filter for test cases")
    # allow any ACME client to run custom command for integration
    # testing (without having to implement its own busy-wait loop)
    parser.add_argument('--custom', metavar="CMD", help="run custom command")
    parser.set_defaults(run_chisel=False,
                        test_case_filter="",
                        skip_setup=False)
    args = parser.parse_args()

    if not (args.run_chisel or args.custom or args.run_go is not None):
        raise (Exception(
            "must run at least one of the letsencrypt or chisel tests with --chisel, --gotest, or --custom"
        ))

    if not startservers.install(race_detection=race_detection):
        raise (Exception("failed to build"))

    # Setup issuance hierarchy
    startservers.setupHierarchy()

    if not args.test_case_filter:
        now = datetime.datetime.utcnow()

        six_months_ago = now + datetime.timedelta(days=-30 * 6)
        if not startservers.start(fakeclock=fakeclock(six_months_ago)):
            raise (Exception("startservers failed (mocking six months ago)"))
        setup_six_months_ago()
        startservers.stop()

        twenty_days_ago = now + datetime.timedelta(days=-20)
        if not startservers.start(fakeclock=fakeclock(twenty_days_ago)):
            raise (Exception("startservers failed (mocking twenty days ago)"))
        setup_twenty_days_ago()
        startservers.stop()

    if not startservers.start(fakeclock=None):
        raise (Exception("startservers failed"))

    if args.run_chisel:
        run_chisel(args.test_case_filter)

    if args.run_go:
        run_go_tests(args.test_case_filter)

    if args.custom:
        run(args.custom.split())

    # Skip the last-phase checks when the test case filter is one, because that
    # means we want to quickly iterate on a single test case.
    if not args.test_case_filter:
        run_cert_checker()
        check_balance()

        # Run the load-generator last. run_loadtest will stop the
        # pebble-challtestsrv before running the load-generator and will not restart
        # it.
        run_loadtest()

    if not startservers.check():
        raise (Exception("startservers.check failed"))

    # This test is flaky, so it's temporarily disabled.
    # TODO(#4583): Re-enable this test.
    #check_slow_queries()

    global exit_status
    exit_status = 0
Exemplo n.º 20
0
def main():
    parser = argparse.ArgumentParser(description='Run integration tests')
    parser.add_argument('--all',
                        dest="run_all",
                        action="store_true",
                        help="run all of the clients' integration tests")
    parser.add_argument('--certbot',
                        dest='run_certbot',
                        action='store_true',
                        help="run the certbot integration tests")
    parser.add_argument('--chisel',
                        dest="run_chisel",
                        action="store_true",
                        help="run integration tests using chisel")
    parser.add_argument('--load',
                        dest="run_loadtest",
                        action="store_true",
                        help="run load-generator")
    parser.add_argument('--filter',
                        dest="test_case_filter",
                        action="store",
                        help="Regex filter for test cases")
    parser.add_argument('--skip-setup',
                        dest="skip_setup",
                        action="store_true",
                        help="skip integration test setup")
    # allow any ACME client to run custom command for integration
    # testing (without having to implement its own busy-wait loop)
    parser.add_argument('--custom', metavar="CMD", help="run custom command")
    parser.set_defaults(run_all=False,
                        run_certbot=False,
                        run_chisel=False,
                        run_loadtest=False,
                        test_case_filter="",
                        skip_setup=False)
    args = parser.parse_args()

    if not (args.run_all or args.run_certbot or args.run_chisel
            or args.run_loadtest or args.custom is not None):
        raise Exception(
            "must run at least one of the letsencrypt or chisel tests with --all, --certbot, --chisel, --load or --custom"
        )

    caa_client = None
    if not args.skip_setup:
        now = datetime.datetime.utcnow()
        seventy_days_ago = now + datetime.timedelta(days=-70)
        if not startservers.start(race_detection=True,
                                  fakeclock=fakeclock(seventy_days_ago)):
            raise Exception("startservers failed (mocking seventy days ago)")
        setup_seventy_days_ago()
        v1_integration.caa_client = caa_client = chisel.make_client()
        startservers.stop()

        now = datetime.datetime.utcnow()
        twenty_days_ago = now + datetime.timedelta(days=-20)
        if not startservers.start(race_detection=True,
                                  fakeclock=fakeclock(twenty_days_ago)):
            raise Exception("startservers failed (mocking twenty days ago)")
        setup_twenty_days_ago()
        startservers.stop()

    if not startservers.start(race_detection=True):
        raise Exception("startservers failed")

    if not args.skip_setup:
        setup_zero_days_ago()

    if args.run_all or args.run_chisel:
        run_chisel(args.test_case_filter)

    if args.run_all or args.run_certbot:
        run_client_tests()

    if args.custom:
        run(args.custom)

    run_cert_checker()
    # Skip load-balancing check when test case filter is on, since that usually
    # means there's a single issuance and we don't expect every RPC backend to get
    # traffic.
    if not args.test_case_filter:
        check_balance()
    if not CONFIG_NEXT:
        run_expired_authz_purger()

    # Run the load-generator last. run_loadtest will stop the
    # pebble-challtestsrv before running the load-generator and will not restart
    # it.
    if args.run_all or args.run_loadtest:
        run_loadtest()

    if not startservers.check():
        raise Exception("startservers.check failed")

    global exit_status
    exit_status = 0
Exemplo n.º 21
0
This runs in non-monolithic mode and requires RabbitMQ on localhost.

Keeps servers alive until ^C. Exit non-zero if any servers fail to
start, or die before ^C.
"""

import errno
import os
import sys
import time

sys.path.append('./test')
import startservers

if not startservers.start(race_detection=False):
    sys.exit(1)
try:
    os.wait()

    # If we reach here, a child died early. Log what died:
    startservers.check()
    sys.exit(1)
except KeyboardInterrupt:
    print "\nstopping servers."
except OSError, v:
    # Ignore EINTR, which happens when we get SIGTERM or SIGINT (i.e. when
    # someone hits Ctrl-C after running docker-compose up or start.py.
    if v.errno != errno.EINTR:
        raise