momentohq / client-sdk-javascript

Official JavaScript SDK for Momento Serverless Cache
Apache License 2.0
55 stars 20 forks source link

refactor: organize integration tests by service #1410

Closed malandis closed 1 month ago

malandis commented 1 month ago

Organizes the integration tests by service, and importantly by directory. By organizing by directory, we have an unambiguous regex to use for jest to match integration tests by service, eg jest cache/ to run all cache service tests. Integration test authoring stays maintainable because developers just need to place their integration test file under the appropriate service directory.

For clarity we have refactored common-integration-tests, the integration tests under node-js, and those under web to have the same directory structure.

We have updated the scripts in the package.json files to match on the service (as a directory) as opposed to individual test files.

A note on the organization:

In a following PR we will introduce makefiles that will invoke these scripts and update GitHub Actions. That is, the makefiles will run npm run integration-test-<>. That way the source of truth for the tests will be the scripts in package.json, since various shell scripts still reference these.

malandis commented 1 month ago

lgtm w/2 questions:

  1. Are you planning to do a Makefile in a follow-up PR, and, as mentioned on your other PR,

Yes. In the description of this one I mentioned I would follow up on this one too :-). The volume of changes was large and I kept getting merge conflicts with other ongoing PRs.

  1. Don't we want to still keep control plane tests in their own targets since it's a different DNS name?

We can address this in a follow up PR. For now we can get the tests running by service and invocable by Makefile, then update the canary, then loop back for the per-endpoint invocation.