|
4 | 4 |
|
5 | 5 | const nsfs_schema_utils = require('../../../manage_nsfs/nsfs_schema_utils'); |
6 | 6 | const RpcError = require('../../../rpc/rpc_error'); |
| 7 | +const config = require('../../../../config'); |
7 | 8 |
|
8 | 9 | describe('schema validation NC NSFS config', () => { |
9 | 10 |
|
@@ -251,6 +252,31 @@ describe('schema validation NC NSFS config', () => { |
251 | 252 | nsfs_schema_utils.validate_nsfs_config_schema(config_data); |
252 | 253 | }); |
253 | 254 | }); |
| 255 | + |
| 256 | + describe('skip/unskip schema check by config test', () => { |
| 257 | + |
| 258 | + it('unskip schema check - config.LOG_TO_SYSLOG_ENABLED=false nsfs_config.LOG_TO_SYSLOG_ENABLED=bla - invalid config - should fail', () => { |
| 259 | + config.LOG_TO_SYSLOG_ENABLED = false; |
| 260 | + const config_data = { |
| 261 | + LOG_TO_SYSLOG_ENABLED: 'bla', |
| 262 | + }; |
| 263 | + const reason = 'Test should have failed because of wrong type ' + |
| 264 | + 'LOG_TO_SYSLOG_ENABLED must be boolean'; |
| 265 | + const message = `must be boolean | {"type":"boolean"} | "/LOG_TO_SYSLOG_ENABLED"`; |
| 266 | + assert_validation(config_data, reason, message); |
| 267 | + }); |
| 268 | + |
| 269 | + it('unskip schema check - config.LOG_TO_STDERR_ENABLED=false nsfs_config.LOG_TO_STDERR_ENABLED=bla - invalid config - should fail', () => { |
| 270 | + config.LOG_TO_STDERR_ENABLED = false; |
| 271 | + const config_data = { |
| 272 | + LOG_TO_STDERR_ENABLED: 'bla', |
| 273 | + }; |
| 274 | + const reason = 'Test should have failed because of wrong type ' + |
| 275 | + 'LOG_TO_STDERR_ENABLED must be boolean'; |
| 276 | + const message = `must be boolean | {"type":"boolean"} | "/LOG_TO_STDERR_ENABLED"`; |
| 277 | + assert_validation(config_data, reason, message); |
| 278 | + }); |
| 279 | + }); |
254 | 280 | }); |
255 | 281 |
|
256 | 282 | function assert_validation(config_to_validate, reason, basic_message) { |
|
0 commit comments