2020-12-14 15:28:35 +00:00
|
|
|
/* eslint-env node */
|
|
|
|
|
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',
|
2021-01-20 18:40:46 +00:00
|
|
|
operatorConfig: {}
|
2020-01-28 17:33:20 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
environment: 'test',
|
|
|
|
CONSUL_BINARY_TYPE: 'oss',
|
2021-01-20 18:40:46 +00:00
|
|
|
operatorConfig: {
|
|
|
|
ACLsEnabled: true,
|
|
|
|
NamespacesEnabled: false,
|
|
|
|
SSOEnabled: false,
|
2021-04-22 11:22:40 +00:00
|
|
|
PartitionsEnabled: false,
|
2021-01-20 18:40:46 +00:00
|
|
|
LocalDatacenter: 'dc1',
|
|
|
|
}
|
2020-01-28 17:33:20 +00:00
|
|
|
},
|
2020-02-07 11:02:53 +00:00
|
|
|
{
|
|
|
|
$: {
|
2020-10-19 16:29:43 +00:00
|
|
|
CONSUL_NSPACES_ENABLED: 1
|
2020-02-07 11:02:53 +00:00
|
|
|
},
|
|
|
|
environment: 'test',
|
|
|
|
CONSUL_BINARY_TYPE: 'oss',
|
2021-01-20 18:40:46 +00:00
|
|
|
operatorConfig: {
|
|
|
|
ACLsEnabled: true,
|
|
|
|
NamespacesEnabled: true,
|
|
|
|
SSOEnabled: false,
|
2021-04-22 11:22:40 +00:00
|
|
|
PartitionsEnabled: false,
|
2021-01-20 18:40:46 +00:00
|
|
|
LocalDatacenter: 'dc1',
|
|
|
|
}
|
2020-05-11 15:37:11 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
$: {
|
2020-10-19 16:29:43 +00:00
|
|
|
CONSUL_SSO_ENABLED: 1
|
2020-05-11 15:37:11 +00:00
|
|
|
},
|
|
|
|
environment: 'test',
|
|
|
|
CONSUL_BINARY_TYPE: 'oss',
|
2021-01-20 18:40:46 +00:00
|
|
|
operatorConfig: {
|
|
|
|
ACLsEnabled: true,
|
|
|
|
NamespacesEnabled: false,
|
|
|
|
SSOEnabled: true,
|
2021-04-22 11:22:40 +00:00
|
|
|
PartitionsEnabled: false,
|
2021-01-20 18:40:46 +00:00
|
|
|
LocalDatacenter: 'dc1',
|
|
|
|
}
|
2020-02-07 11:02:53 +00:00
|
|
|
},
|
2020-01-28 17:33:20 +00:00
|
|
|
{
|
|
|
|
environment: 'staging',
|
|
|
|
CONSUL_BINARY_TYPE: 'oss',
|
2021-01-20 18:40:46 +00:00
|
|
|
operatorConfig: {
|
|
|
|
ACLsEnabled: true,
|
|
|
|
NamespacesEnabled: true,
|
|
|
|
SSOEnabled: true,
|
2021-04-22 11:22:40 +00:00
|
|
|
PartitionsEnabled: true,
|
2021-01-20 18:40:46 +00:00
|
|
|
LocalDatacenter: 'dc1',
|
|
|
|
}
|
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;
|
|
|
|
}
|
2021-01-20 18:40:46 +00:00
|
|
|
t.deepEqual(
|
2020-02-07 11:02:53 +00:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
);
|