eclipse-hara / hara-ddiclient

Hara-ddiclient is a Kotlin library that facilitates and speeds up the development of DDI API clients for devices connecting to hawkBit servers.
https://projects.eclipse.org/projects/iot.hawkbit.hara
Eclipse Public License 2.0
18 stars 13 forks source link

Adding test cases #24

Closed Madhupatel08 closed 1 year ago

Madhupatel08 commented 1 year ago
  1. Test that the dataProvider method returns an array of TargetDeployments
  2. Test that an exception is thrown if the TargetDeployments parameter in the test method has an empty deploymentInfo list
Sundar1709 commented 1 year ago

hi madhu can u help me running this code in my local machine

Madhupatel08 commented 1 year ago

hi,

first set up the application on your machine. Then you will be able the run the test. Please let me know if you have any other question.

On Mon, Mar 20, 2023 at 5:19 PM Sundar1709 @.***> wrote:

hi madhu can u help me running this code in my local machine

— Reply to this email directly, view it on GitHub https://github.com/eclipse/hara-ddiclient/pull/24#issuecomment-1476083101, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM7X3KMT57JUZJGQATVMNWTW5A75VANCNFSM6AAAAAAV7GP5J4 . You are receiving this because you authored the thread.Message ID: @.***>

diegorondini commented 1 year ago

Hi @Madhupatel08

Please sign the ECA: https://www.eclipse.org/legal/ECA.php

Also please double-check your tests, some are failing for me (Fedora Linux 37 + Java 17):

> Task :test
Executing test test[0](TargetDeployments(targetId=target1, targetToken=4a28d893bb841def706073c789c0f3a7, deploymentInfo=[DeploymentInfo(actionId=1, actionStatusOnStart=ActionStatus(content=[ContentEntry(type=canceling, messages=[Update Server: cancel obsolete action due to new update]), ContentEntry(type=running, messages=[null])], total=2, size=2), actionStatusOnFinish=ActionStatus(content=[ContentEntry(type=canceled, messages=[Update Server: Cancelation confirmed., Update Server: Cancellation completion is finished sucessfully.]), ContentEntry(type=retrieved, messages=[Update Server: Target retrieved cancel action and should start now the cancelation.]), ContentEntry(type=canceling, messages=[Update Server: cancel obsolete action due to new update]), ContentEntry(type=running, messages=[null])], total=4, size=4), filesDownloadedPairedWithServerFile=[]), DeploymentInfo(actionId=2, actionStatusOnStart=ActionStatus(content=[ContentEntry(type=running, messages=[null])], total=1, size=1), actionStatusOnFinish=ActionStatus(content=[ContentEntry(type=finished, messages=[Details:]), ContentEntry(type=running, messages=[Update applied]), ContentEntry(type=running, messages=[Applying the update...]), ContentEntry(type=running, messages=[Successfully downloaded all files]), ContentEntry(type=running, messages=[Successfully downloaded file with md5 2490a3d39b0004e4afeb517ef0ddbe2d]), ContentEntry(type=download, messages=[Update Server: Target downloads /Default/controller/v1/target1/softwaremodules/1/artifacts/test_1]), ContentEntry(type=running, messages=[Start downloading 1 files]), ContentEntry(type=retrieved, messages=[Update Server: Target retrieved update action and should start now the download.]), ContentEntry(type=running, messages=[null])], total=9, size=9), filesDownloadedPairedWithServerFile=[(/home/diego/Kynetics/Progetti/UpdateFactory/Hara/hara-ddiclient/./build/test/download/artifacts/2/2490a3d39b0004e4afeb517ef0ddbe2d, docker/test/artifactrepo/DEFAULT/4b/5a/b54e43082887d1e7cdb10b7a21fe4a1e56b44b5a)])])) [org.eclipse.hara.ddiclient.integrationtest.SuccessfulForcedUpdate] with result: FAILURE

Gradle suite > Gradle test > org.eclipse.hara.ddiclient.integrationtest.SuccessfulForcedUpdate > test[0](TargetDeployments(targetId=target1, targetToken=4a28d893bb841def706073c789c0f3a7, deploymentInfo=[DeploymentInfo(actionId=1, actionStatusOnStart=ActionStatus(content=[ContentEntry(type=canceling, messages=[Update Server: cancel obsolete action due to new update]), ContentEntry(type=running, messages=[null])], total=2, size=2), actionStatusOnFinish=ActionStatus(content=[ContentEntry(type=canceled, messages=[Update Server: Cancelation confirmed., Update Server: Cancellation completion is finished sucessfully.]), ContentEntry(type=retrieved, messages=[Update Server: Target retrieved cancel action and should start now the cancelation.]), ContentEntry(type=canceling, messages=[Update Server: cancel obsolete action due to new update]), ContentEntry(type=running, messages=[null])], total=4, size=4), filesDownloadedPairedWithServerFile=[]), DeploymentInfo(actionId=2, actionStatusOnStart=ActionStatus(content=[ContentEntry(type=running, messages=[null])], total=1, size=1), actionStatusOnFinish=ActionStatus(content=[ContentEntry(type=finished, messages=[Details:]), ContentEntry(type=running, messages=[Update applied]), ContentEntry(type=running, messages=[Applying the update...]), ContentEntry(type=running, messages=[Successfully downloaded all files]), ContentEntry(type=running, messages=[Successfully downloaded file with md5 2490a3d39b0004e4afeb517ef0ddbe2d]), ContentEntry(type=download, messages=[Update Server: Target downloads /Default/controller/v1/target1/softwaremodules/1/artifacts/test_1]), ContentEntry(type=running, messages=[Start downloading 1 files]), ContentEntry(type=retrieved, messages=[Update Server: Target retrieved update action and should start now the download.]), ContentEntry(type=running, messages=[null])], total=9, size=9), filesDownloadedPairedWithServerFile=[(/home/diego/Kynetics/Progetti/UpdateFactory/Hara/hara-ddiclient/./build/test/download/artifacts/2/2490a3d39b0004e4afeb517ef0ddbe2d, docker/test/artifactrepo/DEFAULT/4b/5a/b54e43082887d1e7cdb10b7a21fe4a1e56b44b5a)])])) FAILED
    kotlinx.coroutines.TimeoutCancellationException at:-1
        Caused by: kotlinx.coroutines.TimeoutCancellationException at Timeout.kt:184
Executing test test[1](TargetDeployments(targetId=target2, targetToken=0fe7b8c9de2102ec6bf305b6f66df5b2, deploymentInfo=[DeploymentInfo(actionId=3, actionStatusOnStart=ActionStatus(content=[ContentEntry(type=running, messages=[null])], total=1, size=1), actionStatusOnFinish=ActionStatus(content=[ContentEntry(type=finished, messages=[Details:]), ContentEntry(type=running, messages=[Update applied]), ContentEntry(type=running, messages=[Applying the update...]), ContentEntry(type=running, messages=[Successfully downloaded all files]), ContentEntry(type=running, messages=[Successfully downloaded file with md5 94424c5ce3f8c57a5b26d02f37dc06fc]), ContentEntry(type=download, messages=[Update Server: Target downloads /Default/controller/v1/target2/softwaremodules/3/artifacts/test_4]), ContentEntry(type=running, messages=[Start downloading 1 files]), ContentEntry(type=retrieved, messages=[Update Server: Target retrieved update action and should start now the download.]), ContentEntry(type=running, messages=[null])], total=9, size=9), filesDownloadedPairedWithServerFile=[(/home/diego/Kynetics/Progetti/UpdateFactory/Hara/hara-ddiclient/./build/test/download/artifacts/3/94424c5ce3f8c57a5b26d02f37dc06fc, docker/test/artifactrepo/DEFAULT/dd/0a/07fa4d03ac54d0b2a52f23d8e878c96db7aadd0a)])])) [org.eclipse.hara.ddiclient.integrationtest.SuccessfulForcedUpdate] with result: SUCCESS
Executing test test[2](TargetDeployments(targetId=target3, targetToken=4a28d893bb841def706073c789c0f3a7, deploymentInfo=[DeploymentInfo(actionId=4, actionStatusOnStart=ActionStatus(content=[ContentEntry(type=running, messages=[null])], total=1, size=1), actionStatusOnFinish=ActionStatus(content=[ContentEntry(type=finished, messages=[Details:]), ContentEntry(type=running, messages=[Update applied]), ContentEntry(type=running, messages=[Applying the update...]), ContentEntry(type=running, messages=[Successfully downloaded all files]), ContentEntry(type=running, messages=[Successfully downloaded file with md5 2490a3d39b0004e4afeb517ef0ddbe2d]), ContentEntry(type=running, messages=[Successfully downloaded file with md5 b0b3b0dbf5330e3179c6ae3e0ac524c9]), ContentEntry(type=running, messages=[Successfully downloaded file with md5 2244fbd6bee5dcbe312e387c062ce6e6]), ContentEntry(type=running, messages=[Successfully downloaded file with md5 94424c5ce3f8c57a5b26d02f37dc06fc]), ContentEntry(type=download, messages=[Update Server: Target downloads /Default/controller/v1/target3/softwaremodules/2/artifacts/test_2]), ContentEntry(type=download, messages=[Update Server: Target downloads /Default/controller/v1/target3/softwaremodules/2/artifacts/test_3]), ContentEntry(type=download, messages=[Update Server: Target downloads /Default/controller/v1/target3/softwaremodules/1/artifacts/test_1]), ContentEntry(type=download, messages=[Update Server: Target downloads /Default/controller/v1/target3/softwaremodules/3/artifacts/test_4]), ContentEntry(type=running, messages=[Start downloading 4 files]), ContentEntry(type=retrieved, messages=[Update Server: Target retrieved update action and should start now the download.]), ContentEntry(type=running, messages=[null])], total=15, size=15), filesDownloadedPairedWithServerFile=[(/home/diego/Kynetics/Progetti/UpdateFactory/Hara/hara-ddiclient/./build/test/download/artifacts/4/2490a3d39b0004e4afeb517ef0ddbe2d, docker/test/artifactrepo/DEFAULT/4b/5a/b54e43082887d1e7cdb10b7a21fe4a1e56b44b5a), (/home/diego/Kynetics/Progetti/UpdateFactory/Hara/hara-ddiclient/./build/test/download/artifacts/4/b0b3b0dbf5330e3179c6ae3e0ac524c9, docker/test/artifactrepo/DEFAULT/b6/1e/a096a9d3cb96fa4cf6c63bd736a84cb7a7e4b61e), (/home/diego/Kynetics/Progetti/UpdateFactory/Hara/hara-ddiclient/./build/test/download/artifacts/4/2244fbd6bee5dcbe312e387c062ce6e6, docker/test/artifactrepo/DEFAULT/bf/94/cde0c01b26634f869bb876326e4fbe969792bf94), (/home/diego/Kynetics/Progetti/UpdateFactory/Hara/hara-ddiclient/./build/test/download/artifacts/4/94424c5ce3f8c57a5b26d02f37dc06fc, docker/test/artifactrepo/DEFAULT/dd/0a/07fa4d03ac54d0b2a52f23d8e878c96db7aadd0a)])])) [org.eclipse.hara.ddiclient.integrationtest.SuccessfulForcedUpdate] with result: SUCCESS
Executing test test[0](TargetDeployments(targetId=Target4, targetToken=, deploymentInfo=[DeploymentInfo(actionId=5, actionStatusOnStart=ActionStatus(content=[ContentEntry(type=running, messages=[null])], total=1, size=1), actionStatusOnFinish=ActionStatus(content=[ContentEntry(type=finished, messages=[Details:]), ContentEntry(type=running, messages=[Update applied]), ContentEntry(type=running, messages=[Applying the update...]), ContentEntry(type=running, messages=[Successfully downloaded all files]), ContentEntry(type=running, messages=[Successfully downloaded file with md5 2490a3d39b0004e4afeb517ef0ddbe2d]), ContentEntry(type=running, messages=[Successfully downloaded file with md5 b0b3b0dbf5330e3179c6ae3e0ac524c9]), ContentEntry(type=running, messages=[Successfully downloaded file with md5 2244fbd6bee5dcbe312e387c062ce6e6]), ContentEntry(type=running, messages=[Successfully downloaded file with md5 94424c5ce3f8c57a5b26d02f37dc06fc]), ContentEntry(type=download, messages=[Update Server: Target downloads /Default/controller/v1/Target4/softwaremodules/2/artifacts/test_2]), ContentEntry(type=download, messages=[Update Server: Target downloads /Default/controller/v1/Target4/softwaremodules/2/artifacts/test_3]), ContentEntry(type=download, messages=[Update Server: Target downloads /Default/controller/v1/Target4/softwaremodules/1/artifacts/test_1]), ContentEntry(type=download, messages=[Update Server: Target downloads /Default/controller/v1/Target4/softwaremodules/3/artifacts/test_4]), ContentEntry(type=running, messages=[Start downloading 4 files]), ContentEntry(type=retrieved, messages=[Update Server: Target retrieved update action and should start now the download.]), ContentEntry(type=running, messages=[null])], total=15, size=15), filesDownloadedPairedWithServerFile=[(/home/diego/Kynetics/Progetti/UpdateFactory/Hara/hara-ddiclient/./build/test/download/artifacts/5/2490a3d39b0004e4afeb517ef0ddbe2d, docker/test/artifactrepo/DEFAULT/4b/5a/b54e43082887d1e7cdb10b7a21fe4a1e56b44b5a), (/home/diego/Kynetics/Progetti/UpdateFactory/Hara/hara-ddiclient/./build/test/download/artifacts/5/b0b3b0dbf5330e3179c6ae3e0ac524c9, docker/test/artifactrepo/DEFAULT/b6/1e/a096a9d3cb96fa4cf6c63bd736a84cb7a7e4b61e), (/home/diego/Kynetics/Progetti/UpdateFactory/Hara/hara-ddiclient/./build/test/download/artifacts/5/2244fbd6bee5dcbe312e387c062ce6e6, docker/test/artifactrepo/DEFAULT/bf/94/cde0c01b26634f869bb876326e4fbe969792bf94), (/home/diego/Kynetics/Progetti/UpdateFactory/Hara/hara-ddiclient/./build/test/download/artifacts/5/94424c5ce3f8c57a5b26d02f37dc06fc, docker/test/artifactrepo/DEFAULT/dd/0a/07fa4d03ac54d0b2a52f23d8e878c96db7aadd0a)])])) [org.eclipse.hara.ddiclient.integrationtest.SuccessfulSoftUpdateWithDownloadAndUpdateAlwaysAllowed] with result: SUCCESS
Executing test testDataProviderReturnsArrayOfTargetDeployments [org.eclipse.hara.ddiclient.integrationtest.SuccessfulSoftUpdateWithDownloadAndUpdateAlwaysAllowed] with result: SUCCESS
Executing test testMethodThrowsExceptionIfDeploymentInfoIsEmpty [org.eclipse.hara.ddiclient.integrationtest.SuccessfulSoftUpdateWithDownloadAndUpdateAlwaysAllowed] with result: FAILURE

Gradle suite > Gradle test > org.eclipse.hara.ddiclient.integrationtest.SuccessfulSoftUpdateWithDownloadAndUpdateAlwaysAllowed > testMethodThrowsExceptionIfDeploymentInfoIsEmpty FAILED
    java.lang.AssertionError at SuccessfulSoftUpdateWithDownloadAndUpdateAlwaysAllowed.kt:47
Idle

6 tests completed, 2 failed

> Task :test FAILED
Sundar1709 commented 1 year ago

hi madhu i tried running it on my local machine but enciountered some problems while executing problems and one thing i want to ask are using docker desktop or seperate applications mentioned in the file

danielesergio commented 1 year ago

Closed because the two test cases are testing the test code and they are not testing the hara-ddiclient code.