Update tests, add more invalid metrics to be ignored, add sql metrics count check

This commit is contained in:
xbgmsharp
2023-12-31 21:13:40 +01:00
parent db3bd6b06f
commit c46a428fc2
5 changed files with 67 additions and 5 deletions

View File

@@ -604,8 +604,12 @@ request.set('User-Agent', 'PostgSail unit tests');
// Override client_id
data[i]['client_id'] = test.vessel_metadata.client_id;
}
// Force last entry to be back in time from previous, it should be ignore silently
data.at(-1).time = moment.utc(data.at(-2).time).subtract(1, 'minutes').format();
// The last entry are invalid and should be ignore.
// - Invalid status
// - Invalid speedoverground
// - Invalid time previous time is duplicate
// Force last valid entry to be back in time from previous, it should be ignore silently
data.at(-1).time = moment.utc(data.at(-3).time).subtract(1, 'minutes').format();
//console.log(data[0]);
it('/metrics?select=time', function(done) {
@@ -625,7 +629,7 @@ request.set('User-Agent', 'PostgSail unit tests');
res.header['content-type'].should.match(new RegExp('json','g'));
res.header['server'].should.match(new RegExp('postgrest','g'));
should.exist(res.body);
res.body.length.should.match(test.vessel_metrics['metrics'].length-1);
res.body.length.should.match(test.vessel_metrics['metrics'].length-3);
done(err);
});
});