Page MenuHomePhabricator

MPIC: Backend integration tests
Open, LowPublic3 Estimated Story Points

Description

T360707

Description

This task should cover, at least for now, enough test cases for all existing endpoints of the instrument controller in the backend. At this time it's where most of the functionality resides.

At this moment there is already a branch (https://gitlab.wikimedia.org/repos/data-engineering/mpic/-/tree/integration-tests?ref_type=heads) where a few integration test cases are done and working fine. That should be the starting point for this task. These test can be run with npm run integration-test.

Existing integration test cases have been created with chai library and, at this moment, they only can be run locally because the pipeline is not ready to run them. At the Notes section there is a nice-to-have proposal to fix that.

Acceptance criteria

  • There is integration test case for GET /instruments [200 OK]
  • There is integration test case for GET /api/v1/instruments [200 OK]
  • There is integration test case for GET /instrument/:slug [200 OK, 404 Not Found]
  • There is integration test case for POST /instruments [201 Created, 400 Bad Request, 409 Conflict]
  • There is integration test case for PUT /instrument/:slug [200 OK, 400 Bad Request]
  • There is integration test case for DELETE /instrument/:id [200 OK]
  • There is integration test case for PATCH /instrument/:id to enable/disable [200 OK]

Required

  • TBD?

Notes

A nice to have here would be to include a MariaDBservice in the GitLab pipeline to be able to run these tests using the pipeline. Some details at https://docs.gitlab.com/ee/ci/services/

Event Timeline

Sfaci set the point value for this task to 3.Jun 27 2024, 12:19 PM

@Jrbranaa we are also ready to test this backend work. Is this something you are ready to start helping us with as part of SDS 2.1 as early as this week?

@VirginiaPoundstone I'm taking a closer look at this and will get back to you by tomorrow.

Just in case it helps I wanted to say that this part is still a bit messy because we have been prioritizing new features in place of working on this. Unit tests (npm run unit-test) are working for the main branch and integration ones (npm run integration-test) are working on the branch I mentioned in the description (https://gitlab.wikimedia.org/repos/data-engineering/mpic/-/tree/integration-tests?ref_type=heads). We hadn't time yet to unify and clean all this.

At the same time, some test cases could be outdated because we have been adding new features and changing a bit the existing ones but we hadn't time to update the related test cases. And not everything is cover at this time for the same reason.

Sfaci updated the task description. (Show Details)
Sfaci updated the task description. (Show Details)

There is a MR ready for review to put in order the existing integration test cases and add some new others to cover new functionality: https://gitlab.wikimedia.org/repos/data-engineering/mpic/-/merge_requests/86

The branch that I mentioned above (https://gitlab.wikimedia.org/repos/data-engineering/mpic/-/tree/integration-tests?ref_type=heads) is now outdated and we will remove it after merging this new MR. All the test cases there have been included in the mentioned MR and they have been improved and extended.

Change #1062101 had a related patch set uploaded (by Clare Ming; author: Clare Ming):

[operations/deployment-charts@master] Metrics Platform Instrument Configuration: Deploy to staging

https://gerrit.wikimedia.org/r/1062101

Change #1062101 merged by jenkins-bot:

[operations/deployment-charts@master] Metrics Platform Instrument Configuration: Deploy to staging

https://gerrit.wikimedia.org/r/1062101

Change #1062105 had a related patch set uploaded (by Clare Ming; author: Clare Ming):

[operations/deployment-charts@master] Metrics Platform Instrument Configuration: Deploy to production

https://gerrit.wikimedia.org/r/1062105

Change #1062105 merged by jenkins-bot:

[operations/deployment-charts@master] Metrics Platform Instrument Configuration: Deploy to production

https://gerrit.wikimedia.org/r/1062105

@VirginiaPoundstone I've assigned this to @EChukwukere-WMF to work on. It seems that there are some existing tests developed already so his focus will be to expand upon those tests if needed and look to migrate these to the existing API testing framework.

Just in case it helps, I would like to add that we are very interested on automating these integration tests. We already created a ticket to explore about it (T371922: MPIC: Automate integration tests). At this time we have to run them manually because we need a database but it seems that GitLab services could run a database as a container within the pipeline (is that feature supported by our current GitLab installation?). That way these tests could be run automatically every time we push/merge something.
In fact this is something that we also miss when working with the APIs and the existing test suite we have for them. If I'm not wrong we already explored this feature there and the result of that exploration was that this is something not supported by the pipeline we have there (Gerrit + Jenkins).

cjming reassigned this task from Emeka-okechukwu to EChukwukere-WMF.
cjming moved this task from Radar to In Process on the Data Products (Data Products Sprint 19) board.
cjming added a subscriber: Emeka-okechukwu.