Permalink
Browse files

Use bigger file and timeouts for time-based tests

  • Loading branch information...
1 parent b186fbb commit 8c854e49d41dfe3d33c3f080ba08147010927a5d Nicolas Joyard committed Feb 26, 2014
Showing with 18 additions and 15 deletions.
  1. +2 −2 Makefile
  2. +16 −13 test/processor.test.js
View
@@ -2,10 +2,10 @@ REPORTER = spec
MOCHA = node_modules/.bin/mocha
test:
- @NODE_ENV=test $(MOCHA) --require should --reporter $(REPORTER)
+ @NODE_ENV=test $(MOCHA) --require should --reporter $(REPORTER) --timeout 30000
test-colors:
- @NODE_ENV=test $(MOCHA) --require should --reporter $(REPORTER) --colors
+ @NODE_ENV=test $(MOCHA) --require should --reporter $(REPORTER) --colors --timeout 30000
test-cov: lib-cov
@FLUENTFFMPEG_COV=1 $(MAKE) test REPORTER=html-cov > test/coverage.html
View
@@ -39,7 +39,7 @@ describe('Processor', function() {
it('should dynamically renice process', function(done) {
var testFile = path.join(__dirname, 'assets', 'testProcessKill.flv');
- var ffmpegJob = new Ffmpeg({ source: this.testfile, nolog: true, timeout: 1 })
+ var ffmpegJob = new Ffmpeg({ source: this.testfilebig, nolog: true, timeout: 2 })
.usingPreset('flashvideo')
ffmpegJob
@@ -66,23 +66,22 @@ describe('Processor', function() {
.saveToFile(testFile);
setTimeout(function() {
- ffmpegJob.kill('SIGSTOP');
ffmpegJob.renice(5);
- }, 20);
- setTimeout(function() {
- exec("ps h p " + ffmpegJob.ffmpegProc.pid + " -o ni", function(err, stdout, stderr) {
- assert.ok(!err);
- parseInt(stdout).should.equal(5);
- });
+ setTimeout(function() {
+ exec("ps h p " + ffmpegJob.ffmpegProc.pid + " -o ni", function(err, stdout, stderr) {
+ assert.ok(!err);
+ parseInt(stdout).should.equal(5);
+ });
+ }, 500);
}, 500);
});
}
it('should report codec data through \'codecData\' event', function(done) {
var testFile = path.join(__dirname, 'assets', 'testOnCodecData.flv');
- new Ffmpeg({ source: this.testfile, nolog: true })
+ new Ffmpeg({ source: this.testfilebig, nolog: true })
.on('codecData', function(data) {
data.should.have.property('audio');
data.should.have.property('video');
@@ -110,6 +109,10 @@ describe('Processor', function() {
gotProgress = true;
})
.usingPreset('flashvideo')
+ .on('error', function(err) {
+ assert.ok(!err);
+ done();
+ })
.on('end', function() {
fs.exists(testFile, function(exist) {
if (exist) {
@@ -204,7 +207,7 @@ describe('Processor', function() {
it('should kill the process on timeout', function(done) {
var testFile = path.join(__dirname, 'assets', 'testProcessKill.flv');
- new Ffmpeg({ source: this.testfile, nolog: true, timeout: 0.02 })
+ new Ffmpeg({ source: this.testfilebig, nolog: true, timeout: 0.02 })
.usingPreset('flashvideo')
.on('error', function(err) {
err.message.indexOf('timeout').should.not.equal(-1);
@@ -234,7 +237,7 @@ describe('Processor', function() {
it('should kill the process with .kill', function(done) {
var testFile = path.join(__dirname, 'assets', 'testProcessKill.flv');
- var ffmpegJob = new Ffmpeg({ source: this.testfile, nolog: true, timeout: 0 })
+ var ffmpegJob = new Ffmpeg({ source: this.testfilebig, nolog: true, timeout: 0 })
.usingPreset('flashvideo');
ffmpegJob
@@ -262,13 +265,13 @@ describe('Processor', function() {
})
.saveToFile(testFile);
- setTimeout(function() { ffmpegJob.kill(); }, 20);
+ setTimeout(function() { ffmpegJob.kill(); }, 500);
});
it('should send the process custom signals with .kill(signal)', function(done) {
var testFile = path.join(__dirname, 'assets', 'testProcessKill.flv');
- var ffmpegJob = new Ffmpeg({ source: this.testfile, nolog: true, timeout: 1 })
+ var ffmpegJob = new Ffmpeg({ source: this.testfilebig, nolog: true, timeout: 1 })
.usingPreset('flashvideo');
ffmpegJob

0 comments on commit 8c854e4

Please sign in to comment.