6. Testing¶
Use this Worksheet to manage a test.
6.1. Testing Script¶
Area |
Node |
Organization |
Role |
Action |
Expected Result |
|---|---|---|---|---|---|
UI |
AAIS |
Regulator |
Regulator |
Log In |
Logged in |
UI |
AAIS |
Regulator |
Regulator |
Create Data Call |
Data Call Created in Draft |
UI |
AAIS |
Regulator |
Regulator |
Create New Draft |
New Draft |
UI |
AAIS |
Carrier |
Carrier |
Like Data Ccall |
Like recorded and appears on data call list |
UI |
Carrier |
Carrier |
Carrier |
Like Data Ccall |
Like recorded and appears on data call list |
UI |
AAIS |
Regulator |
Regulator |
Issue Data Call |
Data Call Is in Issued List |
UI |
AAIS |
Regulator |
Regulator |
View Liking Organizations |
List of Orgs that Liked |
UI |
AAIS |
AAIS |
Stat-Agent |
Update Issued Data Call |
Data Call Info Updated |
UI |
AAIS |
AAIS |
Stat-Agent |
Set Extraction Pattern |
Extraction Pattern Visible on Data Call |
UI |
AAIS |
Carrier |
Carrier |
Download Extraction Pattern |
Etraction Pattern downloaded |
UI |
Carrier |
Carrier |
Carrier |
Download Extraction Pattern |
Etraction Pattern downloaded |
Extraction Patterns |
N/A |
N/A |
N/A |
Create Extraction Pattern |
Extraction Pattern Tested |
. |
|||||
Data Load |
AAIS |
Carrier |
Carrier |
Load data using the Insurance Data Manager Service |
|
Data Load |
Carrier |
Carrier |
Carrier |
Load data using the Insurance Data Manager Service |
Upload Data
Consent to the Data Call
6.2. Assume each of the roles¶
Regulator – regulator
State Agent – stat-agent
Carrier – carrier
6.3. Execute the functions on the different nodes¶
AAIS Node
Analytics Node
Carrier Node
6.4. Table of Testing Scenarios¶
Nodeà |
AAIS |
Analytics |
Carrier |
|||
|---|---|---|---|---|---|---|
Roleà |
Administrator |
Regulator |
Carrier |
Stat-Agent |
Stat-Agent |
Carrier |
Scenario |
||||||
Login |
N/A |
Should see the data call list and the option to create a new data call |
Should see the data call list but no option to create a data call |
Should see the data call list |
Should see the data call list |
Should see the data call list |
Create a Data Call |
N/A |
Data call should appear in draft list if not issued on creation. |
N/A |
|||
Issue Data Call |
N/A |
Data call should appear in issued list |
N/A |
|||
Upload Data |
N/A |
Data Should Appear in the Mongo Database |
Should see data in the HDS |
|||
View Reports |
N/A |
|||||
Create An Extraction Pattern |
Extraction pattern is available to be applied to a data call |
|||||
Publish the Extraction Pattern |
Extraction pattern appears in list of available extraction patterns |
N/A |
N/A |
N/A |
||
Update an Extraction Pattern |
Extraction pattern is updated in the system |
N/A |
N/A |
N/A |
||
Assign Extraction Pattern |
N/A |
N/A |
N/A |
Extraction pattern should be visibly connected to the data call. |
||
Like / Unlike |
N/A |
N/A |
Only available for draft data calls. |
N/A |
||
Number of likes increases or decreases for the data call |
||||||
View Liking Organizations |
||||||
View Consenting Organizations |
Should see list of consenting carriers |
|||||
Consent |
N/A |
|||||
Create a User |
New user should show up in IBM Cloud list of users for this appid service |
|||||
Update Chaincode |
The new chaincode is used by the network. |
6.5. Create a User¶
The valid roles are “regulator”, “carrier”, “stat-agent”.
For the aais node you will want to create all three kinds.
For the analytics node, only create the stat-agent and regulator roles.
For the carrier node, only create the carrier role.
NOTE: make sure the carrierId matches a carrier id of data that is loaded into the mongodb.
6.5.1. Use the API to create a User¶
Role: Administrator
Open the swagger ui for the utilities and login to get a token
Open the swagger ui for the insurance data manager and authorize with the token
Open the “app Create User” request.
Try it and then fill in the sample data and execute
You should now be able to login with that user.
6.6. Login¶
Role: Any
For the different environments, there are different users.
Depending on the type of node, there are different kinds of users.
Login with the credentials created above.
6.7. Create a Data Call¶
Role: Regulator
Open the data call app (openidl-ui) for the node. (do this on the aais or analytics node)
Login as the specified user whose role should be “regulator”.
Click on “New Data Call” in the top right.
Enter all required information.
Click on save as draft or issue.
If saved as draft, confirm it shows in the draft list
If issued, confirm it shows in the issued list
6.8. Issue a Data Call¶
Role: Regulator
Login as a regulator
Select a data call from the drafts list
Click on issue
Confirm that it shows in the issued list now
6.9. Upload Data¶
Role: Carrier
Use the swagger ui for the insurance data manager to load data
Confirm that the data gets loaded into the mongo database
6.10. Create an Extraction Pattern¶
Role: Administrator
Extraction patterns are used to extract data from the harmonized data store and make it available on the analytics node.
A schema is available that documents the extraction pattern json format.
Find it in the openidl-extraction-pattern-developer directory in the openidl-main project in git.
The value of the viewDefinition.map and viewDefinition.reduce elements is javascript and should work as part of a map reduce in mongo. This can be tested using the openidl-extraction-pattern-developer tool. Look into the test cases to see how this can be done.
Create and test the extraction pattern document
Create a sample file for the input data.
There are two options for this, use the mapper or copy from mongo
Use the mapper
the openidl-mapper is included in the dependencies
check out the test-mapper.js for how to run it
you can use the generateSampleData.js to create
run ‘make generate_data’
Copy data from a known mongodb
Open mongo client
Go to collection
Select the items and “view as text”
Copy into a text file named inputMongoText.txt in the “process” folder
Run the utility “convertMongoTextToJson.js” npm run convertMongoTextToJson
Grab the valid json from the ouputMongoJson.json in the “processed” folder
Paste it into a file in the test/data directory
Create a javascript file with the map and reduce functions you want
Create a test that points to that above test data for input – copy from an existing one to get the pattern
Require your file with the map and reduce to get those functions to build the extraction pattern
Push the extraction pattern to an output file you can use in the follow on steps to publish into openidl
Run the tests to make sure your expectations pass
6.11. Update an Extraction Pattern¶
Follow the same steps to create an extraction pattern except, when publishing use the update existing extraction pattern api instead of the create new.
6.12. Publish the extraction pattern to the openIDL¶
Role: Administrator
Using the data call app api we’ll put the extraction pattern into the system
Open the api-docs for the data call app = data-call-app-base-url + /api-docs/ (see below to get the base url)
Authorize as defined in 11.4.7.5
Authorize with a token from the postman request for the token for the resource group
Open the create data call service in the swagger screen (if updating existing, use the update api instead)
Click on try it out
Paste the text of the extraction pattern into the example value
Click on execute
You should receive an ok result with success true
If there are errors then look into the logs for the data call app, it should tell you why the endorsement failed, usually it is something wrong with the format of the extraction pattern
6.13. Assign the extraction pattern to a data call¶
Role: Stat-Agent
log into the application as a stat agent
open the data call
set the extraction pattern to what you want
6.14. Like or Unlike a Data Call¶
Role: Carrier
log into the application as a carrier
open a draft data call
click on the like data call
go back to the list of draft data calls
the data call should have one more like (you may need to refresh the page)
go back into the data call
unlike the data call
go back to the list
the data call should have one less like (you may need to refresh the page)
6.15. View Organizations that Have Liked a Data Call¶
You may need to log out of the application and log back in then go to the draft data call to see the link appear.
Role: Carrier
Log in to the application
Open a draft data call
Next to the likes, click the “View Organizations” link.
A list of organizations appears.
6.16. View Organizations that Have Consented to a Data Call¶
Role: Regulator
Log into the application
Open an issued data call
Click on the “View Carriers” link next to the Carrier Consents count.
6.17. Consent to the data call¶
Role: Carrier
Log into the application
Open an issued data call
Click on “Consent to the Report”
The “Consent Recorded:” field should update with current date and time.
Go back to the list of data calls, this one should have another consent.
Check the mongo database for a new collection created by the extraction pattern execution. It will be for the specific carrier with a generated suffix identifier.
Confirm the analytics node gets the data as expected
Something should show up in the aws s3 bucket
The s3 bucket is openIDL-analytics
There could multiple files based on the extraction pattern
Make sure that there is the appropriate data in the files again based on the extraction pattern
6.18. Update Chaincode¶
From time to time, the chaincode needs to change. To deploy to the node, run the toolchain after checking into
All nodes should be updated together to make sure they all have the same chaincode. Run each.
You may need to change the version in the configuration of the BUILD stage.
6.19. The actual process should be¶
consent at date x
data call is at date y
load data at time of y
is there some kind of window of time to allow data to be captured
like in draft
consent
analytics node should be looking through the data calls to find the finished data calls and firing the extraction at that time
each carrier node polls to know when to run the extraction pattern
the movement of data into s3 should not happen
6.20. Testing Utilities¶
A best practice is never to commit credentials to git. To get around this for our test environments, we keep the credentials in a box folder. openIDL_environments. Make a sub folder for your environment and node in the same way you named the resource group.
6.20.1. Data Call Helpers¶
TODO: Verify
In the course of testing the application, many elements need to be repeated many times. This can and should be done using the UI to verify that the UI is working correctly. To facilitate rapid testing of the api’s however, it is advantageous to be able to execute the functionality from a command line. The data-call-app has some testing utilities to create and consent to data calls.
Use one of the following:
node test/api/api-create-data-call.js
node test/api/api-consent-to-data-call.js
node test/api/api-create-and-consent-to-data-call.js
Make sure to update the data call information before running these.
6.20.2. Viewing the MongoDB for testing purposes¶
The mongo database is available in the cloud
See section useDeploy MongoDB for details on connecting to mongo.
6.20.3. Getting the URL for the application¶
TODO ??
6.20.4. Determining the base URL for an Application¶
TODO ??
6.20.5. Getting Credentials for APIs¶
TODO ??
6.20.6. Debugging a Consent Call¶
Trying to follow the path of the consent operation is a complex undertaking. The flow is something like this:
Carrier consents to data call
The UI calls the createConsent service in the data-call-app
Data call app submits the transaction “CreateConsent” to the ledger api
The extraction pattern is executed by the data call processor and the mongo db is updated with a collection that represents the results of the extraction pattern
7. App Debugging¶
7.1. Checking the logs for the different components¶
The logs for the different pods can be accessed through kubectl.
Setup aws and configure your eks command to point to the specific cluster:
something like:
aws eks update-kubeconfig –region us-east-1 –name aais-dev-blk-cluster
Then you can use the usual kubectl commands to get the pods:
kubectl get ns
Then you can get the pods in a namespace
kubectl -n aais-net get po
Then you can get the logs for one of the pods and follow it too.
kubectl -n aais-net logs peer0-0 -c peer0
7.2. DNS Troubleshooting¶
If your route53 is incorrect because the domain and subdomain are incorrect, then follow these steps:
Update input file with .com
Delete the hosted zones from Route53 that was created including the records and the zones
Delete all but the NS and SOA records, then
Delete the hosted zone
Rerun the pipeline AWS_Resources
Rerun the pipeline for K8s_Resources
If you get an access denied error in the log for the data-call-app, rerun the register users baf action.
Alternately, it could be an error in the config file for the channel name - should be defaultchannel and anal-<organizationName> where the organizationName must be 4 or less characters.