-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: mv assert to fixtures (eggjs#3829)
- Loading branch information
Showing
2 changed files
with
17 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const assert = require('assert'); | ||
const sleep = require('mz-modules/sleep'); | ||
|
||
function readJSON(p) { | ||
return JSON.parse(fs.readFileSync(p)); | ||
} | ||
|
||
module.exports = app => { | ||
const baseDir = app.config.baseDir; | ||
let json; | ||
|
||
app.config.dynamic = 1; | ||
app.beforeStart(function*() { | ||
yield sleep(500); | ||
// dumpConfig() dynamically | ||
json = readJSON(path.join(baseDir, 'run/application_config.json')); | ||
assert(json.config.dynamic === 1, 'should dump in config'); | ||
json = readJSON(path.join(baseDir, 'run/agent_config.json')); | ||
assert(json.config.dynamic === 0, 'should dump in config'); | ||
|
||
yield sleep(2000); | ||
app.config.dynamic = 2; | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters