Skip to content

Commit

Permalink
Fix a race condition in importer unit test #76
Browse files Browse the repository at this point in the history
  • Loading branch information
apertome committed Jan 28, 2019
1 parent e0628bc commit c9ce58d
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions test/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,26 @@ describe('import', function() {
}
//console.log("EXPECTED DATA", data);
expected_output = JSON.parse(data);
getData();
//console.log("AFTER JSON PARSE", data);
//console.error("expected output\n", JSON.stringify( expected_output, null, 3 ) );

});


fs.readFile(testfile, 'utf8', function (err,data) {
if (err) {
console.log("ERROR reading file", err);
return;
}
//console.log(data);
meshconfig = JSON.parse(data);
//console.error("meshconfig before\n", JSON.stringify( meshconfig, null, 3 ) );
importer._process_imported_config ( meshconfig, sub, cb, true );
//console.log("meshconfig after\n", JSON.stringify( meshconfig, null, 3 ) );
});
function getData( ) {
fs.readFile(testfile, 'utf8', function (err,data) {
if (err) {
console.log("ERROR reading file", err);
return;
}
//console.log(data);
meshconfig = JSON.parse(data);
//console.error("meshconfig before\n", JSON.stringify( meshconfig, null, 3 ) );
importer._process_imported_config ( meshconfig, sub, cb, true );
//console.log("meshconfig after\n", JSON.stringify( meshconfig, null, 3 ) );
});
}


});
Expand Down

0 comments on commit c9ce58d

Please sign in to comment.