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
Beispiel #2
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
Beispiel #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('--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
Beispiel #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('--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
Beispiel #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"
        )

    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
Beispiel #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
        "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)
Beispiel #8
0
tempdir = tempfile.mkdtemp()

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()

if not startservers.check():
    die(ExitStatus.Error)