Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit 863db65

Browse files
Merge pull request #98 from boschresearch/fix/unittests
Fix unittest timestamp races and Jenkinsfile
2 parents 3410917 + 90079f7 commit 863db65

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Jenkinsfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ node('docker') {
3636
stage('amd64') {
3737
sh "docker buildx build --platform=linux/amd64 -f ./docker/Dockerfile -t amd64/kuksa-val:${versiontag} --output type=docker,dest=./artifacts/kuksa-val-${versiontag}-amd64.tar ."
3838

39-
sh "docker buildx build --platform=linux/arm64 -f ./clients/vss-testclient/Dockerfile -t amd64/kuksa-vssclient:${versiontag} --output type=docker,dest=./artifacts/kuksa-vssclient-${versiontag}-amd64.tar ./clients/"
39+
sh "docker buildx build --platform=linux/amd64 -f ./clients/vss-testclient/Dockerfile -t amd64/kuksa-vssclient:${versiontag} --output type=docker,dest=./artifacts/kuksa-vssclient-${versiontag}-amd64.tar ./clients/"
4040

4141
sh "docker build -t kuksa-val-dev-ubuntu20.04:${versiontag} -f docker/Dockerfile.dev ."
4242
sh "docker save kuksa-val-dev-ubuntu20.04:${versiontag} > artifacts/kuksa-val-dev-ubuntu20.04:${versiontag}.tar"
@@ -50,6 +50,8 @@ node('docker') {
5050
tools: [ BoostTest(pattern: 'artifacts/results.xml') ]]
5151
)
5252
cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'artifacts/coverage.xml', conditionalCoverageTargets: '70, 0, 0', enableNewApi: true, failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
53+
//Cleaning up: After unittest we do not need dev docker in local registry
54+
sh "docker rmi kuksa-val-dev-ubuntu20.04:${versiontag}"
5355
}
5456
stage('Compress') {
5557
sh 'ls -al artifacts'

test/unit-test/VssCommandProcessorTests.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ BOOST_AUTO_TEST_CASE(Given_ValidSetQuery_When_ValueOutOfBound_Shall_ReturnError)
389389

390390
// timestamp must not be zero
391391
BOOST_TEST(res["timestamp"].as<int64_t>() > 0);
392+
jsonValueOutOfBound["timestamp"] = res["timestamp"].as<int64_t>(); // ignoring timestamp difference for response
393+
392394
BOOST_TEST(res == jsonValueOutOfBound);
393395
}
394396

@@ -438,6 +440,7 @@ BOOST_AUTO_TEST_CASE(Given_ValidSetQuery_When_NoPermission_Shall_ReturnError)
438440

439441
// timestamp must not be zero
440442
BOOST_TEST(res["timestamp"].as<int64_t>() > 0);
443+
jsonNoAccess["timestamp"] = res["timestamp"].as<int64_t>(); // ignoring timestamp difference for response
441444
BOOST_TEST(res == jsonNoAccess);
442445
}
443446

@@ -487,6 +490,9 @@ BOOST_AUTO_TEST_CASE(Given_ValidSetQuery_When_DBThrowsNotExpectedException_Shall
487490

488491
// timestamp must not be zero
489492
BOOST_TEST(res["timestamp"].as<int64_t>() > 0);
493+
// Set timestamp for comparision purposes
494+
jsonMalformedReq["timestamp"] = res["timestamp"].as<int64_t>();
495+
490496
BOOST_TEST(res == jsonMalformedReq);
491497
}
492498

0 commit comments

Comments
 (0)