Skip to content

Commit

Permalink
Merge pull request letsencrypt#279 from letsencrypt/npm-install
Browse files Browse the repository at this point in the history
Integration test should run npm install.
  • Loading branch information
jsha committed Jun 2, 2015
2 parents d31aef6 + 92b4855 commit 6e45187
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion test/boulder-test-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"issuerCert": "test/test-ca.pem",
"_comment": "This should only be present in testMode. In prod use an HSM.",
"issuerKey": "test/test-ca.key",
"expiry": "8760h",
"expiry": "2160h",
"maxNames": 1000
},

Expand Down
28 changes: 20 additions & 8 deletions test/integration-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@

tempdir = tempfile.mkdtemp()

exit_status = 0

def die():
global exit_status
exit_status = 1
sys.exit(1)

def build(path):
cmd = 'go build -o %s/%s %s' % (tempdir, os.path.basename(path), path)
print(cmd)
if subprocess.Popen(cmd, shell=True).wait() != 0:
sys.exit(1)
die()

# A strange Go bug: If cfssl is up-to-date, we'll get a failure building
# Boulder. Work around by touching cfssl.go.
Expand Down Expand Up @@ -48,41 +55,46 @@ def run_test():
pass
time.sleep(1)

if subprocess.Popen('npm install', shell=True).wait() != 0:
die()

issue = subprocess.Popen('''
node test.js --email [email protected] --agree true \
--domains foo.com --new-reg http://localhost:4300/acme/new-reg \
--certKey %s/key.pem --cert %s/cert.der
''' % (tempdir, tempdir), shell=True)
if issue.wait() != 0:
sys.exit(1)
die()
revoke = subprocess.Popen('''
node revoke.js %s/cert.der %s/key.pem http://localhost:4300/acme/revoke-cert/
''' % (tempdir, tempdir), shell=True)
if revoke.wait() != 0:
sys.exit(1)
die()

try:
run_test()
except Exception as e:
exit_status = 1
print e
finally:
status = 0
# Check whether boulder died. This can happen, for instance, if there was an
# existing boulder already listening on the port.
if boulder.poll() is not None:
print("Boulder died")
status = 1
exit_status = 1
else:
boulder.kill()

if cfssl.poll() is not None:
print("CFSSL died")
status = 1
exit_status = 1
else:
cfssl.kill()

shutil.rmtree(tempdir)

if status == 0:
if exit_status == 0:
print("SUCCESS")
else:
print("FAILURE")
sys.exit(status)
sys.exit(exit_status)

0 comments on commit 6e45187

Please sign in to comment.