2020-01-28 17:33:20 +00:00
|
|
|
const test = require('tape');
|
|
|
|
|
|
|
|
const getEnvironment = require('../../config/environment.js');
|
|
|
|
|
|
|
|
test(
|
|
|
|
'config has the correct environment settings',
|
|
|
|
function(t) {
|
|
|
|
[
|
|
|
|
{
|
|
|
|
environment: 'production',
|
|
|
|
CONSUL_BINARY_TYPE: 'oss',
|
2020-10-06 13:26:55 +00:00
|
|
|
CONSUL_ACLS_ENABLED: '__RUNTIME_BOOL_ACLsEnabled__',
|
|
|
|
CONSUL_SSO_ENABLED: '__RUNTIME_BOOL_SSOEnabled__',
|
2020-10-08 20:29:52 +00:00
|
|
|
CONSUL_NSPACES_ENABLED: '__RUNTIME_BOOL_NamespacesEnabled__',
|
2020-01-28 17:33:20 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
environment: 'test',
|
|
|
|
CONSUL_BINARY_TYPE: 'oss',
|
|
|
|
CONSUL_ACLS_ENABLED: true,
|
|
|
|
CONSUL_NSPACES_ENABLED: true,
|
2020-05-11 15:37:11 +00:00
|
|
|
CONSUL_SSO_ENABLED: false,
|
2020-01-28 17:33:20 +00:00
|
|
|
},
|
2020-02-07 11:02:53 +00:00
|
|
|
{
|
|
|
|
$: {
|
|
|
|
CONSUL_NSPACES_ENABLED: 0
|
|
|
|
},
|
|
|
|
environment: 'test',
|
|
|
|
CONSUL_BINARY_TYPE: 'oss',
|
|
|
|
CONSUL_ACLS_ENABLED: true,
|
|
|
|
CONSUL_NSPACES_ENABLED: false,
|
2020-05-11 15:37:11 +00:00
|
|
|
CONSUL_SSO_ENABLED: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
$: {
|
|
|
|
CONSUL_SSO_ENABLED: 0
|
|
|
|
},
|
|
|
|
environment: 'test',
|
|
|
|
CONSUL_BINARY_TYPE: 'oss',
|
|
|
|
CONSUL_ACLS_ENABLED: true,
|
|
|
|
CONSUL_NSPACES_ENABLED: true,
|
|
|
|
CONSUL_SSO_ENABLED: false,
|
2020-02-07 11:02:53 +00:00
|
|
|
},
|
2020-01-28 17:33:20 +00:00
|
|
|
{
|
|
|
|
environment: 'staging',
|
|
|
|
CONSUL_BINARY_TYPE: 'oss',
|
|
|
|
CONSUL_ACLS_ENABLED: true,
|
|
|
|
CONSUL_NSPACES_ENABLED: true,
|
2020-05-11 15:37:11 +00:00
|
|
|
CONSUL_SSO_ENABLED: true,
|
2020-01-28 17:33:20 +00:00
|
|
|
}
|
|
|
|
].forEach(
|
|
|
|
function(item) {
|
2020-02-07 11:02:53 +00:00
|
|
|
const env = getEnvironment(item.environment, typeof item.$ !== 'undefined' ? item.$ : undefined);
|
2020-01-28 17:33:20 +00:00
|
|
|
Object.keys(item).forEach(
|
|
|
|
function(key) {
|
2020-02-07 11:02:53 +00:00
|
|
|
if(key === '$') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
t.equal(
|
|
|
|
env[key],
|
|
|
|
item[key],
|
|
|
|
`Expect ${key} to equal ${item[key]} in the ${item.environment} environment ${typeof item.$ !== 'undefined' ? `(with ${JSON.stringify(item.$)})` : ''}`
|
|
|
|
);
|
2020-01-28 17:33:20 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
t.end();
|
|
|
|
}
|
|
|
|
);
|