Validates that a the config value for tsd.network.worker_threads for which the default value is calced by a js scriptlet, is two times the number of cores. @throws Exception on any error
()
| 198 | * @throws Exception on any error |
| 199 | */ |
| 200 | @Test |
| 201 | public void testWorkerThreadDefault() throws Exception { |
| 202 | ConfigArgP cap = new ConfigArgP(); |
| 203 | Config config = cap.getConfig(); |
| 204 | assertEquals("The value for key [tsd.network.worker_threads]", (CORES * 2), config.getInt("tsd.network.worker_threads")); |
| 205 | // now test an override |
| 206 | cap = new ConfigArgP("--worker-threads", "7"); |
| 207 | config = cap.getConfig(); |
| 208 | assertEquals("The overriden value for key [tsd.network.worker_threads]", 7, config.getInt("tsd.network.worker_threads")); |
| 209 | // now test an override with an "=" |
| 210 | cap = new ConfigArgP("--worker-threads=7"); |
| 211 | config = cap.getConfig(); |
| 212 | assertEquals("The overriden value for key [tsd.network.worker_threads]", 7, config.getInt("tsd.network.worker_threads")); |
| 213 | |
| 214 | } |
| 215 | |
| 216 | /** |
| 217 | * Validates that a ConfigArgP with no arguments creates a Config with the expected defaults |