-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change to async API that handles waiting for Pebble to boot
- Loading branch information
Showing
6 changed files
with
41 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,16 @@ | ||
const test = require('tape') | ||
const Pebble = require('..') | ||
|
||
test ('Node Pebble', t => { | ||
const expectedOutputContents = [ | ||
'Starting Pebble ACME server', | ||
'Generated new root issuer', | ||
'Generated new intermediate issuer', | ||
'Using system DNS resolver for ACME challenges', | ||
'Disabling random VA sleeps', | ||
'Configured to reject 0% of good nonces', | ||
'Configured to attempt authz reuse for each identifier 50% of the time', | ||
'Configured to show 3 orders per page', | ||
'Management interface listening on: 0.0.0.0:15000', | ||
'Root CA certificate available at: https://0.0.0.0:15000/roots/0', | ||
'Listening on: 0.0.0.0:14000', | ||
'ACME directory available at: https://0.0.0.0:14000/dir' | ||
] | ||
test ('Node Pebble', async t => { | ||
const pebbleProcess = await Pebble.spawn() | ||
|
||
t.plan(expectedOutputContents.length) | ||
|
||
const pebbleProcess = Pebble.spawn() | ||
|
||
let outputBuffer = Buffer.from('') | ||
|
||
pebbleProcess.on('error', (error) => { | ||
t.fail('Spawn should not error') | ||
}) | ||
|
||
pebbleProcess.stdout.on('data', (data) => { | ||
outputBuffer = Buffer.concat([outputBuffer, data]) | ||
}) | ||
|
||
pebbleProcess.stderr.on('data', (data) => { | ||
t.fail('Pebble server should not error') | ||
}) | ||
t.pass('pebble process launches as expected') | ||
|
||
pebbleProcess.on('close', (code) => { | ||
output = outputBuffer.toString('utf-8') | ||
|
||
expectedOutputContents.forEach(expectedOutputContent => { | ||
t.ok(output.includes(expectedOutputContent), `output should contain ${expectedOutputContent}`) | ||
}) | ||
|
||
t.pass('pebble process killed as expected') | ||
t.end() | ||
}) | ||
|
||
setTimeout(() => { | ||
pebbleProcess.kill() | ||
}, 2000) | ||
}) | ||
pebbleProcess.kill() | ||
}) | ||
|