Make tests pass

This commit is contained in:
Girish Ramakrishnan
2023-10-01 13:26:43 +05:30
parent 9c78b2df9a
commit 0e195679bf
4 changed files with 28 additions and 4 deletions
+10 -3
View File
@@ -78,7 +78,12 @@ async function applyConfig(config) {
const [error] = await safe(shell.promises.sudo('setLdapAllowlist', [ SET_LDAP_ALLOWLIST_CMD ], {}));
if (error) throw new BoxError(BoxError.IPTABLES_ERROR, `Error setting ldap allowlist: ${error.message}`);
if (config.enabled) await start(); else await stop();
if (!config.enabled) {
await stop();
return;
}
if (!gServer) await start();
}
async function setConfig(directoryServerConfig) {
@@ -320,7 +325,7 @@ async function userAuth(req, res, next) {
}
async function start() {
if (gServer) return; // already running
assert(gServer === null, 'Already running');
const logger = {
trace: NOOP,
@@ -386,11 +391,13 @@ async function stop() {
debug('stopping server');
gServer.close();
await util.promisify(gServer.close.bind(gServer))();
gServer = null;
}
async function checkCertificate() {
assert(gServer !== null, 'Directory server is not running');
const certificate = await reverseProxy.getDirectoryServerCertificate();
if (certificate.cert === gCertificate.cert) {
debug('checkCertificate: certificate has not changed');