Testing
Unit tests
Unit tests can be started from command line by the following command:
make test
Code coverage can be generated by:
make cover
for HTML output or:
make coverage
for plain text output.
Profiling
Profiler can be started from command line by the following command;
make profile
BDD tests
Behaviour tests for this service are included in Insights Behavioral Spec repository. In order to run these tests, the following steps need to be made:
- clone the Insights Behavioral Spec repository
- go into the cloned subdirectory
insights-behavioral-spec
- run the
notification_writer_tests.sh
from this subdirectory
List of all test scenarios prepared for this service is available at https://github.com/RedHatInsights/insights-behavioral-spec#ccx-notification-service
End-to-end test
If you want to test from an e2e perspective:
- Use
molodec
to generate and upload an archive for a given cluster. - Use
molodec
again, but define a different set of rules to hit with the generated archive, using the-r
flag (please, check themolodec
help output for further info). - Check if the notification is properly received
ServiceLog case
If you are trying to test the e2e notification in Service Log, you should pay attention in the second step described above. The new rules to be hit by the archive should contain an error key that is tagged with one of the configured tags for the notification.
Please note that those tags are configured here
Right now, it only notified about managed (osd_customer
) tagged rules,
so you need to pick a rule that contains that tag.
One way to check it is to run molodec list
and look for a rule marked as
“managed” in the command output.