Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents

Manual testing with Postman

  1. Build cps-and-ncmp docker image for version to be tested. From Run maven from cps repo directory:

    Code Block
    languagebash
    mvn clean install -Pcps-ncmp-docker


  2. Change Edit docker-compose/docker-compose.yml to filter notifications: set NOTIFICATION_DATASPACE_FILTER_PATTERNS: ' to NON-EXISTING-DATASPACE'

    Code Block
    languageyml
    cps-and-ncmp:
      environment:
        notification.enabled: 'true'
        NOTIFICATION_DATASPACE_FILTER_PATTERNS: 'NON-EXISTING-DATASPACE'


  3. Start docker-compose with DMI plugin stub and monitoring enabled:

    Code Block
    languagebash
    docker-compose -f docker-compose/docker-compose.yml --profile dmi-stub --profile monitoring up


  4. Wait for CPS to

    be initialized

    start. Console output will show:

    Code Block
    languagetext
    cps-and-ncmp            | {"logTimeStamp":"2023-03-24T16:20:36.705Z","logLevel":"INFO","principalId":"cpsuser","serviceName":"cps-application","message":"Started Application in 47.336 seconds (JVM running for 48.444)","processId":"1","threadName":"main","class":"org.onap.cps.Application"}


  5. Test using Postman
    1. Start Postman, and import this collection.the NCMP de-register performance postman collection. (This step only needs to be done once.)
      Image Added

    2. Click the new collection, and open the "Variables" tab.
      Image Added

    3. Change the current value of TOTAL_CMHANDLES to the desired value, e.g. 10000Click , and click the "Save" button. This is the number of CM handles that will be registered (and later de-registered).
      Image Added

    4. Select "Register CM handles", and click "Send". (The Postman collection will use a script to automatically create the request body with 10000 CM handles.)
      Image Added

    5. Wait until all CM handles are in READY state.
      This will be done by running this This can take a while, especially with lot of handles.
      We can check how many handles are ready by running a query on the database.
      Here are instructions using the postgresql Postgres command line interface (psql), but you may alternatively use the Postgres GUI client.
      1. Open a new terminal window, and install postgres-client if needed:

        Code Block
        $ sudo apt install postgresql-client
        Reading package lists... Done
        Building dependency tree... Done
        Reading state information... Done
        postgresql-client is already the newest version (14+238).
        0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.


      2. Run psql command to connect to the database (default password is cps):

        Code Block
        $ psql -h localhost -p 5432 cpsdb cps
        Password for user cps: 
        psql (14.6 (Ubuntu 14.6-0ubuntu0.22.04.1), server 14.1)
        Type "help" for help.
        
        cpsdb=# 


      3. Run the following query to count the number of handles in the READY state. You will need to repeat this command, until all are ready (e.g. 10000).

        Code Block
        cpsdb=# SELECT count(*) FROM public.fragment where attributes @> '{"cm-handle-state": "READY"}';
         count 
        -------
          23843540
        (1 row)
        
        cpsdb=# SELECT count(*) FROM public.fragment where attributes @> '{"cm-handle-state": "READY"}';
         count 
        -------
         10000
        (1 row)


      4. Now that all CM handles are ready, we can proceed to test de-registration. Go back to Postman.

    6. Select In Postman, select "De-Register CM handles", and click "Send".
      Image Added
    7. Record the time taken

...

Filter by label (Content by label)
showLabelsfalse
max5
spacesDW
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel = "testing" and type = "page" and space = "DW"
labelstesting

...

hiddentrue

...

    1. (54.91 s in this case).
      Image Added
  1. Stop docker-compose:

    Code Block
    languagebash
    docker-compose -f docker-compose/docker-compose.yml down


  2. Clean up docker containers and volumes:

    Code Block
    languagebash
    docker container prune -f && docker volume prune -f


Automated testing

There is a script in the cps repo for automatic testing of NCMP handle de-registration. The script will test registering and de-registering 100, 500, 1000, 5000, 10,000 and 20,000 by default. To use it, simply run the script.

Before testing, you may need to edit docker-compose/docker-compose.yml to filter notifications: set NOTIFICATION_DATASPACE_FILTER_PATTERNS to NON-EXISTING-DATASPACE

Code Block
languageyml
cps-and-ncmp:
  environment:
    notification.enabled: 'true'
    NOTIFICATION_DATASPACE_FILTER_PATTERNS: 'NON-EXISTING-DATASPACE'

Run the script:

Code Block
$ ./test-tools/test-deregistration.sh
~/Work/ONAP/cps/cps/test-tools ~/Work/ONAP/cps/cps
Testing deregistration of 100 out of 100 CM handles
Restarting docker
Removing grafana-container    ... done
Removing kafka                ... done
Removing cps-and-ncmp         ... done
Removing zookeeper            ... done
Removing dbpostgresql         ... done
Removing ncmp-dmi-plugin-stub ... done
Removing prometheus-container ... done
Removing network docker-compose_default
Creating network "docker-compose_default" with the default driver
Creating volume "docker-compose_grafana" with default driver
Creating dbpostgresql         ... done
Creating ncmp-dmi-plugin-stub ... done
Creating zookeeper            ... done
Creating prometheus-container ... done
Creating kafka                ... done
Creating cps-and-ncmp         ... done
Creating grafana-container    ... done
Waiting for CPS to start
Creating request bodies
[2023-03-24T17:24:19+00:00] Creating CM handles
Waiting for CM handles to be in READY state
There are 0 CM handles in READY state.
There are 100 CM handles in READY state.
Grabbing metrics before deregistration
[2023-03-24T17:25:23+00:00] Removing CM handles
There are 0 CM handles still in READY state.
Grabbing metrics after deregistration
Generating metrics report

Testing deregistration of 500 out of 500 CM handles
Restarting docker
...

While the script is running, you may monitor the progress in another terminal. A summary report will be generated at test-tools/metrics-reports/deregister-summary-{CURRENT-DATETIME}.tsv:

Code Block
$ tail -f test-tools/metrics-reports/deregister-summary-2023-03-24T17\:23\:28+00\:00.tsv 
Removed	Total	Time
 100	 100	1.099639
 500	 500	3.452250
1000	1000	6.132099
5000	5000	25.372256

The script will also produce Prometheus metrics reports for each individual test, stored in test-tools/metrics-reports. For example, this report is generated for de-registering 1000 out of 1000 CM handles: deregister-2023-03-24T17:29:20+00:00-1000-1000.tsv
Image Added