Skip to content
Snippets Groups Projects
Commit aebc76e6 authored by Lloyd Hilaiel's avatar Lloyd Hilaiel
Browse files

(test fix) when checking that certificate duration is correct based on...

(test fix) when checking that certificate duration is correct based on 'ephemeral' argument to cert_key api, allow a 200ms window to account for a small elapsed time between setting of iat and exp - which occurs on a system under load or slower virtualized environments (like travisci)
parent d8b7cad1
No related branches found
No related tags found
No related merge requests found
......@@ -178,6 +178,11 @@ suite.addBatch({
var kp = jwk.KeyPair.generate("RS", 64);
assert.within = function(got, expected, margin) {
assert.ok(got + margin > expected);
assert.ok(got - margin < expected);
}
suite.addBatch({
"cert_key invoked with ephemeral = false": {
topic: wsapi.post('/wsapi/cert_key', {
......@@ -197,7 +202,9 @@ suite.addBatch({
var cert = new jws.JWS();
cert.parse(r.body);
var pl = JSON.parse(cert.payload);
assert.strictEqual(pl.exp - pl.iat, config.get('certificate_validity_ms'));
assert.within(pl.exp - pl.iat,
config.get('certificate_validity_ms'),
200);
}
}
});
......@@ -221,7 +228,9 @@ suite.addBatch({
var cert = new jws.JWS();
cert.parse(r.body);
var pl = JSON.parse(cert.payload);
assert.strictEqual(pl.exp - pl.iat, config.get('ephemeral_session_duration_ms'));
assert.within(pl.exp - pl.iat,
config.get('ephemeral_session_duration_ms'),
200);
}
}
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment