Skip to content

Commit 4dd24a4

Browse files
authored
test: add testcase for #12 (#13)
1 parent c6cdf09 commit 4dd24a4

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

test/stop.test.js

+37
Original file line numberDiff line numberDiff line change
@@ -227,4 +227,41 @@ describe('test/stop.test.js', () => {
227227
assert(app2.stdout.includes('[app_worker] exit with code:0'));
228228
});
229229
});
230+
231+
describe('stop with symlink', () => {
232+
const baseDir = path.join(__dirname, 'fixtures/tmp');
233+
234+
beforeEach(function* () {
235+
yield fs.symlink(fixturePath, baseDir);
236+
237+
yield utils.cleanup(fixturePath);
238+
yield rimraf(logDir);
239+
yield coffee.fork(eggBin, [ 'start', '--daemon', '--workers=2' ], { cwd: baseDir })
240+
.debug()
241+
.expect('stdout', new RegExp(`Starting custom-framework application at ${fixturePath}`))
242+
.expect('code', 0)
243+
.end();
244+
245+
yield rimraf(baseDir);
246+
const result = yield httpclient.request('http://127.0.0.1:7001');
247+
assert(result.data.toString() === 'hi, egg');
248+
});
249+
afterEach(function* () {
250+
yield utils.cleanup(fixturePath);
251+
yield rimraf(baseDir);
252+
});
253+
254+
it('should stop', function* () {
255+
yield rimraf(baseDir);
256+
yield fs.symlink(path.join(__dirname, 'fixtures/status'), baseDir);
257+
258+
yield coffee.fork(eggBin, [ 'stop', baseDir ])
259+
.debug()
260+
.expect('stdout', /\[egg-scripts] stopping egg application/)
261+
.expect('stdout', /got master pid \["\d+\"\]/i)
262+
.expect('code', 0)
263+
.end();
264+
});
265+
});
266+
230267
});

0 commit comments

Comments
 (0)