Skip to content

Commit

Permalink
Merge pull request #98 from boschresearch/fix/unittests
Browse files Browse the repository at this point in the history
Fix unittest timestamp races and Jenkinsfile
  • Loading branch information
wenwenchenbosch authored Jan 27, 2021
2 parents 3410917 + 90079f7 commit 863db65
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ node('docker') {
stage('amd64') {
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 ."

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/"
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/"

sh "docker build -t kuksa-val-dev-ubuntu20.04:${versiontag} -f docker/Dockerfile.dev ."
sh "docker save kuksa-val-dev-ubuntu20.04:${versiontag} > artifacts/kuksa-val-dev-ubuntu20.04:${versiontag}.tar"
Expand All @@ -50,6 +50,8 @@ node('docker') {
tools: [ BoostTest(pattern: 'artifacts/results.xml') ]]
)
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
//Cleaning up: After unittest we do not need dev docker in local registry
sh "docker rmi kuksa-val-dev-ubuntu20.04:${versiontag}"
}
stage('Compress') {
sh 'ls -al artifacts'
Expand Down
6 changes: 6 additions & 0 deletions test/unit-test/VssCommandProcessorTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ BOOST_AUTO_TEST_CASE(Given_ValidSetQuery_When_ValueOutOfBound_Shall_ReturnError)

// timestamp must not be zero
BOOST_TEST(res["timestamp"].as<int64_t>() > 0);
jsonValueOutOfBound["timestamp"] = res["timestamp"].as<int64_t>(); // ignoring timestamp difference for response

BOOST_TEST(res == jsonValueOutOfBound);
}

Expand Down Expand Up @@ -438,6 +440,7 @@ BOOST_AUTO_TEST_CASE(Given_ValidSetQuery_When_NoPermission_Shall_ReturnError)

// timestamp must not be zero
BOOST_TEST(res["timestamp"].as<int64_t>() > 0);
jsonNoAccess["timestamp"] = res["timestamp"].as<int64_t>(); // ignoring timestamp difference for response
BOOST_TEST(res == jsonNoAccess);
}

Expand Down Expand Up @@ -487,6 +490,9 @@ BOOST_AUTO_TEST_CASE(Given_ValidSetQuery_When_DBThrowsNotExpectedException_Shall

// timestamp must not be zero
BOOST_TEST(res["timestamp"].as<int64_t>() > 0);
// Set timestamp for comparision purposes
jsonMalformedReq["timestamp"] = res["timestamp"].as<int64_t>();

BOOST_TEST(res == jsonMalformedReq);
}

Expand Down

0 comments on commit 863db65

Please sign in to comment.