cms-PdmV / cmsPdmV

CERN CMS McM repository
4 stars 10 forks source link

Tests for the main application entities #1155

Closed ggonzr closed 1 week ago

ggonzr commented 1 month ago

Related to: https://github.com/cms-PdmV/cmsPdmV/issues/1124

This includes several test cases to check the functionality of the main entities and their operations by consuming REST API endpoints. Some operations were not feasible to test, for example, those related to sending email notifications to users. The test module was refactored to reuse the PdmV REST module instead of providing its own implementation to send HTTP requests. Most of the test cases also check if a role can carry an operation like update an entity or inspect a request or if it is forbidden because of a lack of permissions.

The configuration for sending requests to the testing environment can be set via the following environment variables:

Some test cases submit/inject requests to other CMS services like ReqMgr2. Make sure the testing environment can authenticate these actions by using certificates and that it is possible to open SSH sessions to CERN internal servers to generate the configuration used in the submission process.

lmoureaux commented 2 weeks ago

Some test cases submit/inject requests to other CMS services like ReqMgr2. Make sure the testing environment can authenticate these actions by using certificates and that it is possible to open SSH sessions to CERN internal servers to generate the configuration used in the submission process.

Could these tests be marked with flags and disabled by default? I'm worried that running the tests with my personal certificate would end up creating jobs (I was able to use it to authenticate with ReqMgr in the past). Opening SSH sessions to lxplus won't be very OTP-compatible once deployed, and deploying a CouchDB instance within the CERN network is a whole lot more complicated than deploying containers locally.

ggonzr commented 2 weeks ago

Thanks for the feedback. Related to:

Could these tests be marked with flags and disabled by default? I'm worried that running the tests with my personal certificate would end up creating jobs (I was able to use it to authenticate with ReqMgr in the past).

The latest commits implement this feature and skip tests injecting to ReqMgr2 unless REQMGR2_ENABLED is set. Related to submitting requests to ReqMgr2, only the request will be created but it is always targeting the development instance and it will never start running so no worries on this aspect.

Opening SSH sessions to lxplus won't be very OTP-compatible once deployed

You're right, thanks for highlighting this. Users who would like to execute these tests could follow the alternative described in KB0009800 before starting the execution.

and deploying a CouchDB instance within the CERN network is a whole lot more complicated than deploying containers locally.

It is not required as the deploy/action.sh script deploys these instances locally using containers. In case I'm missing something, could you give more details?