Commit c07ac551 authored by Sven Franck's avatar Sven Franck

JIO Restore: Restore old jIO - fixed tests

parent 1feea589
...@@ -203,19 +203,21 @@ generateTools = function (sinon) { ...@@ -203,19 +203,21 @@ generateTools = function (sinon) {
} }
}; };
// wait method // wait method
// NOTED: not sure I understood this correctly
o.waitUntilAJobExists = function (timeout) { o.waitUntilAJobExists = function (timeout) {
var cpt = 0 var cpt = 0, job = false;
while (true) { while (true) {
if (getLastJob(o.jio.getId()) !== undefined) { if (getLastJob(o.jio.getId()) !== undefined) {
job = true;
break; break;
} }
if (timeout >= cpt) { if (cpt >= timeout) {
ok(false, "No job were added to the queue");
break; break;
} }
o.clock.tick(25); o.clock.tick(25);
cpt += 25; cpt += 25;
} }
ok(job, "Waited until job was created");
}; };
o.waitUntilLastJobIs = function (state) { o.waitUntilLastJobIs = function (state) {
while (true) { while (true) {
...@@ -761,10 +763,11 @@ test ("Restore old Jio", function() { ...@@ -761,10 +763,11 @@ test ("Restore old Jio", function() {
"application_name": "jiotests" "application_name": "jiotests"
}); });
o.waitUntilAJobExists(30000); // timeout 30 sec o.waitUntilAJobExists(30000); // timeout 30 sec
o.testLastJobLabel("put", "Job restored"); o.testLastJobLabel("put", "Job restored");
o.clock.tick(1000); o.clock.tick(1000);
ok(getLastJob(o.jio.getId()) === undefined, ok(getLastJob(typeof o.jio.getId()) === undefined, "Job executed");
"Job executed"); o.clock.tick(1000);
o.jio.stop(); o.jio.stop();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment