Closed kretzschi closed 2 years ago
I have downloaded the branch for the Testsuite integration and followed the documentation included in the README.md file. I am able to run the tests executing the provided command.
For the Connector execution there are no errors, but when I run the Broker there are two errors. The first one is in the Postman call: Testsuite>Broker>General Requirements > Minimal endpoint /browse. It is responding with code 404 Not Found.
The second one is in the Postman call:
Testsuite>Broker> Functional Requirements > HTTPS
It is a GET http://{{APPLICANT_BROKER_IP}}:443 request.
I think it should be http://{{APPLICANT_BROKER_IP}}:81 due to the definition of the testbed MetadataBroker setup.
This is the docker-compose.yml
file for the Metadata Broker set up:
version: '3'
services:
broker-reverseproxy:
image: registry.gitlab.cc-asp.fraunhofer.de/eis-ids/broker-open/reverseproxy
container_name: broker-reverseproxy
…
ports:
- "443:443" # IDS-HTTP API
- "81:80"
For the Connector execution there are no errors, but when I run the Broker there are two errors. The first one is in the Postman call: Testsuite>Broker>General Requirements > Minimal endpoint /browse. It is responding with code 404 Not Found.
The second one is in the Postman call: Testsuite>Broker> Functional Requirements > HTTPS It is a GET http://{{APPLICANT_BROKER_IP}}:443 request. I think it should be http://{{APPLICANT_BROKER_IP}}:81 due to the definition of the testbed MetadataBroker setup.
Please keep in mind that the test suite does not necessarily expect successful API calls (= Ssatus code 200) but rather checks the defined tests. In the first case, the status code 404 is expected (see also env variable STATUS_CODE_ENDPOINT_BROWSE), because the endpoint "/browse" is noct defined.
In the second case, no unsecured HTTP must be used according to BR_FR_02. That's why we expect 400 in the case of trying to call the exposed port 443 unsecure (via http). But indeed, we should add an additional test for checking for port 81. I can do it later. But it seems as the current Broker instance would fail.
The justification given for the two errors found is adequate. As a first version I approve this pull request.
@mohuber can you please review this PR? Thank you!
Hello @kretzschi , I have tried the latest update of the Testsuite and it is giving the following errors:
1) For the Connector tests it gives:
sqs@sqs-VirtualBox:~/IDS-testbed-1-testsuite-integration/Testsuite$ docker build --network broker-localhost_default -t test . --build-arg component=Connector
Sending build context to Docker daemon 46.08kB
Step 1/7 : FROM postman/newman:latest
---> 601ee88e5e39
Step 2/7 : WORKDIR /newman
---> Using cache
---> ad088b1300a7
Step 3/7 : COPY . .
---> Using cache
---> fc3a9da9ecf2
Step 4/7 : ARG component
---> Using cache
---> 4d88c6c1091d
Step 5/7 : RUN if [[ -z "$component" ]] ; then echo Error: IDS component to test not provided! ; fi
---> Using cache
---> 35663297a0c7
Step 6/7 : RUN newman run "Testsuite.postman_collection.json" --folder "$component" -e "env/Applicant_IDS_"$component"_Test_Configuration.postman_environment.json" --insecure
---> Running in 250e47411ba6
newman
Testsuite
❏ Connector / Set-up
↳ Successful Offer Creation 1/2
POST https://localhost:8081/api/offers [errored]
connect ECONNREFUSED 127.0.0.1:8081
2. Create offer and retrieve offer ID
↳ Successful Resource Creation 2/2
GET https://localhost:8081/api/offers [errored]
connect ECONNREFUSED 127.0.0.1:8081
4. Created offer exists
↳ Successful Artifact Creation 1/2
POST https://localhost:8081/api/artifacts [errored]
connect ECONNREFUSED 127.0.0.1:8081
6. Create artifact and retrieve offer ID
↳ Successful Artifact Creation 2/2
GET https://localhost:8081/api/artifacts [errored]
connect ECONNREFUSED 127.0.0.1:8081
8. Created artifact exists
↳ Successful Rule Creation 1/2
POST https://localhost:8081/api/rules [errored]
connect ECONNREFUSED 127.0.0.1:8081
10. Create rule and retrieve offer ID
↳ Successful Rule Creation 2/2
GET https://localhost:8081/api/rules [errored]
connect ECONNREFUSED 127.0.0.1:8081
12. Created rule exists
↳ Successful Contract Creation 1/2
POST https://localhost:8081/api/contracts [errored]
connect ECONNREFUSED 127.0.0.1:8081
14. Create contract and retrieve offer ID
↳ Successful Contract Creation 2/2
GET https://localhost:8081/api/contracts/ [errored]
connect ECONNREFUSED 127.0.0.1:8081
16. Created contract exists
↳ Successful Offer To Contract Addition
POST /offers [errored]
Invalid URI "http:///offers"
18. Created contract exists
↳ Successful Rule To Contract Addition
POST /rules [errored]
Invalid URI "http:///rules"
20. Add rule to contract
❏ Connector / Information Model
↳ Get Applicant's Self-Description
POST https://localhost:8080/api/ids/description?recipient=https://connectorb:8081/api/ids/data [errored]
connect ECONNREFUSED 127.0.0.1:8080
22⠄ JSONError in test-script
↳ Get Applicant's Self-Description Error
POST https://localhost:8080/api/ids/description?recipient=https://localhost:8083/api/ids/data [errored]
connect ECONNREFUSED 127.0.0.1:8080
24⠄ JSONError in test-script
❏ Connector / Broker Service
↳ Broker Service Inquiries
POST https://localhost:8081/api/ids/description?recipient=https://broker-reverseproxy/infrastructure&elementId=https://localhost/connectors [errored]
connect ECONNREFUSED 127.0.0.1:8081
26. BRK_01
↳ Broker Service Inquiries Error
POST https://localhost:8081/api/ids/description?recipient=https://broekr-reverseproxy/infrastructure&elementId=https://localhost/connectors [errored]
connect ECONNREFUSED 127.0.0.1:8081
28⠄ JSONError in test-script
↳ Broker registration
POST https://localhost:8081/api/ids/connector/update?recipient=https://broker-reverseproxy/infrastructure [errored]
connect ECONNREFUSED 127.0.0.1:8081
30. BRK_02
❏ Connector / Data Usage Control
↳ Definition of usage policies 1/3
GET [errored]
runtime:extensions~request: request url is empty
32. USC_01-1
↳ Definition of usage policies 2/3
GET /offers [errored]
Invalid URI "http:///offers"
34. USC_01-2
↳ Definition of usage policies 3/3
GET /rules [errored]
Invalid URI "http:///rules"
36. USC_01-3
↳ Definition of usage policies Error
GET https://localhost:8081/api/contracts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee [errored]
connect ECONNREFUSED 127.0.0.1:8081
38⠄ JSONError in test-script
┌─────────────────────────┬──────────┬──────────┐
│ │ executed │ failed │
├─────────────────────────┼──────────┼──────────┤
│ iterations │ 1 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ requests │ 19 │ 19 │
├─────────────────────────┼──────────┼──────────┤
│ test-scripts │ 57 │ 4 │
├─────────────────────────┼──────────┼──────────┤
│ prerequest-scripts │ 43 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ assertions │ 15 │ 15 │
├─────────────────────────┴──────────┴──────────┤
│ total run duration: 2s │
├───────────────────────────────────────────────┤
│ total data received: 0B (approx) │
└───────────────────────────────────────────────┘
# failure detail
01. Error
connect ECONNREFUSED 127.0.0.1:8081
at request
inside "Connector / Set-up / Successful Offer Creation 1/2"
02. JSONError Create offer and retrieve offer ID
Unexpected token u in JSON at position 0
at assertion:0 in test-script
inside "Connector / Set-up / Successful Offer Creation 1/2"
03. Error
connect ECONNREFUSED 127.0.0.1:8081
at request
inside "Connector / Set-up / Successful Resource Creation 2/2"
04. JSONError Created offer exists
Unexpected token u in JSON at position 0
at assertion:0 in test-script
inside "Connector / Set-up / Successful Resource Creation 2/2"
05. Error
connect ECONNREFUSED 127.0.0.1:8081
at request
inside "Connector / Set-up / Successful Artifact Creation 1/2"
06. JSONError Create artifact and retrieve offer ID
Unexpected token u in JSON at position 0
at assertion:0 in test-script
inside "Connector / Set-up / Successful Artifact Creation 1/2"
07. Error
connect ECONNREFUSED 127.0.0.1:8081
at request
inside "Connector / Set-up / Successful Artifact Creation 2/2"
08. JSONError Created artifact exists
Unexpected token u in JSON at position 0
at assertion:0 in test-script
inside "Connector / Set-up / Successful Artifact Creation 2/2"
09. Error
connect ECONNREFUSED 127.0.0.1:8081
at request
inside "Connector / Set-up / Successful Rule Creation 1/2"
10. JSONError Create rule and retrieve offer ID
Unexpected token u in JSON at position 0
at assertion:0 in test-script
inside "Connector / Set-up / Successful Rule Creation 1/2"
11. Error
connect ECONNREFUSED 127.0.0.1:8081
at request
inside "Connector / Set-up / Successful Rule Creation 2/2"
12. JSONError Created rule exists
Unexpected token u in JSON at position 0
at assertion:0 in test-script
inside "Connector / Set-up / Successful Rule Creation 2/2"
13. Error
connect ECONNREFUSED 127.0.0.1:8081
at request
inside "Connector / Set-up / Successful Contract Creation 1/2"
14. JSONError Create contract and retrieve offer ID
Unexpected token u in JSON at position 0
at assertion:0 in test-script
inside "Connector / Set-up / Successful Contract Creation 1/2"
15. Error
connect ECONNREFUSED 127.0.0.1:8081
at request
inside "Connector / Set-up / Successful Contract Creation 2/2"
16. JSONError Created contract exists
Unexpected token u in JSON at position 0
at assertion:0 in test-script
inside "Connector / Set-up / Successful Contract Creation 2/2"
17. Error
Invalid URI "http:///offers"
at request
inside "Connector / Set-up / Successful Offer To Contract Addition"
18. JSONError Created contract exists
Unexpected token u in JSON at position 0
at assertion:0 in test-script
inside "Connector / Set-up / Successful Offer To Contract Addition"
19. Error
Invalid URI "http:///rules"
at request
inside "Connector / Set-up / Successful Rule To Contract Addition"
20. JSONError Add rule to contract
Unexpected token u in JSON at position 0
at assertion:0 in test-script
inside "Connector / Set-up / Successful Rule To Contract Addition"
21. Error
connect ECONNREFUSED 127.0.0.1:8080
at request
inside "Connector / Information Model / Get Applicant's Self-Description"
22. JSONError
Unexpected token u in JSON at position 0
at test-script
inside "Connector / Information Model / Get Applicant's Self-Description"
23. Error
connect ECONNREFUSED 127.0.0.1:8080
at request
inside "Connector / Information Model / Get Applicant's Self-Description Error"
24. JSONError
Unexpected token u in JSON at position 0
at test-script
inside "Connector / Information Model / Get Applicant's Self-Description Error"
25. Error
connect ECONNREFUSED 127.0.0.1:8081
at request
inside "Connector / Broker Service / Broker Service Inquiries"
26. JSONError BRK_01
Unexpected token u in JSON at position 0
at assertion:0 in test-script
inside "Connector / Broker Service / Broker Service Inquiries"
27. Error
connect ECONNREFUSED 127.0.0.1:8081
at request
inside "Connector / Broker Service / Broker Service Inquiries Error"
28. JSONError
Unexpected token u in JSON at position 0
at test-script
inside "Connector / Broker Service / Broker Service Inquiries Error"
29. Error
connect ECONNREFUSED 127.0.0.1:8081
at request
inside "Connector / Broker Service / Broker registration"
30. AssertionError BRK_02
expected { Object (id, _details, ...) } to have property 'code'
at assertion:0 in test-script
inside "Connector / Broker Service / Broker registration"
31. Error
runtime:extensions~request: request url is empty
at request
inside "Connector / Data Usage Control / Definition of usage policies 1/3"
32. JSONError USC_01-1
Unexpected token u in JSON at position 0
at assertion:0 in test-script
inside "Connector / Data Usage Control / Definition of usage policies 1/3"
33. Error
Invalid URI "http:///offers"
at request
inside "Connector / Data Usage Control / Definition of usage policies 2/3"
34. JSONError USC_01-2
Unexpected token u in JSON at position 0
at assertion:0 in test-script
inside "Connector / Data Usage Control / Definition of usage policies 2/3"
35. Error
Invalid URI "http:///rules"
at request
inside "Connector / Data Usage Control / Definition of usage policies 3/3"
36. JSONError USC_01-3
Unexpected token u in JSON at position 0
at assertion:0 in test-script
inside "Connector / Data Usage Control / Definition of usage policies 3/3"
37. Error
connect ECONNREFUSED 127.0.0.1:8081
at request
inside "Connector / Data Usage Control / Definition of usage policies Error"
38. JSONError
Unexpected token u in JSON at position 0
at test-script
inside "Connector / Data Usage Control / Definition of usage policies Error"
The command '/bin/sh -c newman run "Testsuite.postman_collection.json" --folder "$component" -e "env/Applicant_IDS_"$component"_Test_Configuration.postman_environment.json" --insecure' returned a non-zero code: 1
2) For the MDB tests it gives:
sqs@sqs-VirtualBox:~/IDS-testbed-1-testsuite-integration/Testsuite$ docker build --network broker-localhost_default -t test . --build-arg component=Broker
Sending build context to Docker daemon 46.08kB
Step 1/7 : FROM postman/newman:latest
---> 601ee88e5e39
Step 2/7 : WORKDIR /newman
---> Using cache
---> ad088b1300a7
Step 3/7 : COPY . .
---> Using cache
---> fc3a9da9ecf2
Step 4/7 : ARG component
---> Using cache
---> 4d88c6c1091d
Step 5/7 : RUN if [[ -z "$component" ]] ; then echo Error: IDS component to test not provided! ; fi
---> Using cache
---> 938bd826e570
Step 6/7 : RUN newman run "Testsuite.postman_collection.json" --folder "$component" -e "env/Applicant_IDS_"$component"_Test_Configuration.postman_environment.json" --insecure
---> Running in 71c292767a5f
newman
Testsuite
❏ Broker / General Requirements
↳ Self-Description
GET https://localhost:443 [errored]
connect ECONNREFUSED 127.0.0.1:443
2⠄ JSONError in test-script
↳ Minimal endpoint /browse
GET https://localhost:443/browse [errored]
connect ECONNREFUSED 127.0.0.1:443
4. BR_GEN_03-1
↳ Minimal endpoint /browse Copy
GET https://localhost:443/browse [errored]
connect ECONNREFUSED 127.0.0.1:443
6. BR_GEN_03-1
↳ Minimal endpoint /infrastructure
POST https://localhost:8080/api/ids/description?recipient=https://broker-reverseproxy/infrastructure [errored]
connect ECONNREFUSED 127.0.0.1:8080
8. BR_GEN_03-2
❏ Broker / Functional Requirements
↳ HTTPS
GET http://localhost:81 [errored]
connect ECONNREFUSED 127.0.0.1:81
10⠄ JSONError in test-script
┌─────────────────────────┬──────────┬──────────┐
│ │ executed │ failed │
├─────────────────────────┼──────────┼──────────┤
│ iterations │ 1 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ requests │ 5 │ 5 │
├─────────────────────────┼──────────┼──────────┤
│ test-scripts │ 10 │ 2 │
├─────────────────────────┼──────────┼──────────┤
│ prerequest-scripts │ 7 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ assertions │ 3 │ 3 │
├─────────────────────────┴──────────┴──────────┤
│ total run duration: 656ms │
├───────────────────────────────────────────────┤
│ total data received: 0B (approx) │
└───────────────────────────────────────────────┘
# failure detail
01. Error
connect ECONNREFUSED 127.0.0.1:443
at request
inside "Broker / General Requirements / Self-Description"
02. JSONError
Unexpected token u in JSON at position 0
at test-script
inside "Broker / General Requirements / Self-Description"
03. Error
connect ECONNREFUSED 127.0.0.1:443
at request
inside "Broker / General Requirements / Minimal endpoint /browse"
04. AssertionError BR_GEN_03-1
expected { Object (id, _details, ...) } to have property 'code'
at assertion:0 in test-script
inside "Broker / General Requirements / Minimal endpoint /browse"
05. Error
connect ECONNREFUSED 127.0.0.1:443
at request
inside "Broker / General Requirements / Minimal endpoint /browse Copy"
06. AssertionError BR_GEN_03-1
expected { Object (id, _details, ...) } to have property 'code'
at assertion:0 in test-script
inside "Broker / General Requirements / Minimal endpoint /browse Copy"
07. Error
connect ECONNREFUSED 127.0.0.1:8080
at request
inside "Broker / General Requirements / Minimal endpoint /infrastructure"
08. AssertionError BR_GEN_03-2
expected { Object (id, _details, ...) } to have property 'code'
at assertion:0 in test-script
inside "Broker / General Requirements / Minimal endpoint /infrastructure"
09. Error
connect ECONNREFUSED 127.0.0.1:81
at request
inside "Broker / Functional Requirements / HTTPS"
10. JSONError
Unexpected token u in JSON at position 0
at test-script
inside "Broker / Functional Requirements / HTTPS"
The command '/bin/sh -c newman run "Testsuite.postman_collection.json" --folder "$component" -e "env/Applicant_IDS_"$component"_Test_Configuration.postman_environment.json" --insecure' returned a non-zero code: 1
There are some values in the Testsuite.postman_collection.json
file that could be wrong.
Also, I do not know the reason why it is failing the execution of the Tests. Do you know @kretzschi what could be the reason for these errors in the execution of the Testsuite?
@jfernandezsqs
I tried to find an issue. I started the tests on a clean VM and all tests passed as expected:
Did you ensured, that the Testbed was running when executing the tests? Seems like no connection to Connector/Broker was established. If you are very sure on your side, I will investigate further.
There are some values in the Testsuite.postman_collection.json file that could be wrong.
Line 567 and 579 (Why is it 8083?) --> https://localhost:8083/api/ids/data" Line 682 and 689 --> https://broekr-reverseproxy/infrastructure Also, I do not know the reason why it is failing the execution of the Tests. Do you know @kretzschi what could be the reason for these errors in the execution of the Testsuite?
No, this is not the reason. The errors are coded with purpose to cover error cases.
Hello @kretzschi! I can run the testsuite, it was a mistake from my side regarding the host value introduced in the command to execute the tests.
With the Broker test cases there are no issues. However, with the Connector test cases there is an error which is detailed here:
❏ Connector / Broker Service
↳ Broker Service Inquiries
POST https://localhost:8081/api/ids/description?recipient=https://broker-reverseproxy/infrastructure&elementId=https://localhost/connectors [200 OK, 599B, 2.2s]
1. BRK_01
…
# failure detail
1. AssertionError BRK_01
expected undefined to exist
at assertion:0 in test-script
inside "Connector / Broker Service / Broker Service Inquiries"
The command '/bin/sh -c newman run "Testsuite.postman_collection.json" --folder "$component" -e "env/Applicant_IDS_"$component"_Test_Configuration.postman_environment.json" --insecure' returned a non-zero code: 1
Looking at the Testsuite.postman_collection.json
I think that line 627 and line 638 are incorrect. The elementID
should be https://localhost/connectors/
and not https://localhost/connectors
.
"url": {
"raw": "{{APPLICANT_TEMP_URL}}{{APPLICANT_CONNECTOR_DESCRIPTION_URL}}?recipient={{BROKER}}&elementId=https://localhost/connectors/",
"host": [
"{{APPLICANT_TEMP_URL}}{{APPLICANT_CONNECTOR_DESCRIPTION_URL}}"
],
"query": [
{
"key": "recipient",
"value": "{{BROKER}}"
},
{
"key": "elementId",
"value": "https://localhost/connectors/"
}
]
}
With these changes the execution gives no errors.
Also, in the file Applicant_IDS_Connector_Test_Configuration.postman_environment.json
the line 35 regarding the APPLICANT_MAINTAINER
has to change from https://www.isst.fraunhofer.de/
to https://sovity.de
.
Merged the current master into PR. Fixed the error. Add more tests and documentation.
Currently, there are issues with retrieving a DAT (even with the provided Testbed Postman Collection).
Hi @kretzschi!
I have tried the latest update of the Testsuite.
The reports in html
format are correctly generated but there is an error at the PDF
reports.
The pdf
reports are not generated.
I needed to install the following command in order to fix the issue:
sudo apt install htmldoc
Could you please include this command in the Testsuite/README.md
file?
@jfernandezsqs Done.
Hi @kretzschi!
There is an issue with the generation of the pdf
reports.
I attach here the two reports.
Broker_2022-06-01_16:57:11.pdf
Connector_2022-06-01_16:57:49.pdf
The error is that in the pdf
reports some information is cut off and is not readable in the report.
Here I attach an example.
The error message information is not appearing.
Is there a way to generate a pdf
report without losing information?
Otherwise, this reports in pdf
format cannot be established as a solution for reporting test case executions.
@jfernandezsqs Couldn't find an easy solution for this issue. It is strange, because the first request is formatted properly and not cut-off. Implemented a work around with the native html-reporter. Changed README accordingly. Will dive into this issue later to provide a more sophisticated report.
This is the very first version of the automated testsuite that is integrated into the IDS Testbed.
I created a seperate folder Testsuite where a postman collection is available.
The provided Dockerfile is a very first and simple way to start the automated tests with only one command.