Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose versions data through the collection API #1033

Merged
merged 19 commits into from
Dec 11, 2023
Merged

Expose versions data through the collection API #1033

merged 19 commits into from
Dec 11, 2023

Conversation

Ndpnt
Copy link
Member

@Ndpnt Ndpnt commented Dec 6, 2023

Implements #1028.

@Ndpnt Ndpnt force-pushed the versions-api branch 4 times, most recently from 1648eb5 to b65aeae Compare December 6, 2023 16:05
@Ndpnt Ndpnt requested a review from MattiSG December 6, 2023 17:03
CHANGELOG.md Outdated Show resolved Hide resolved

app.listen(port);

if (process.env.NODE_ENV !== 'test') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we refuse to start the server when testing? 🤔 This is counter-intuitive and might lead to a lot of wasted time.
At least, a comment should be added explaining the rationale and a message should be output to let the user know that the server is not starting in test mode.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Event when testing the server is started, there is only no server log to avoid polluting the test log.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I clearly misread the line below. Sorry for the noise.

I believe this would be better addressed by changing the logger config in test mode rather than changing the instructions: always ask to log, but the logger decides what is output in test mode (perhaps nothing).

src/archivist/recorder/repositories/git/index.test.js Outdated Show resolved Hide resolved
src/archivist/recorder/repositories/git/index.test.js Outdated Show resolved Hide resolved
src/archivist/recorder/repositories/mongo/index.test.js Outdated Show resolved Hide resolved
src/api/routes/versions.test.js Outdated Show resolved Hide resolved
src/api/routes/versions.test.js Outdated Show resolved Hide resolved
src/api/routes/versions.test.js Outdated Show resolved Hide resolved
src/api/routes/versions.test.js Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! The test classes seem relevant to me 🙂

I personally would support a slightly more terse version of those tests where we would test in a single it block that the status code, the content-type and the content are as the expected ones. The current approach is certainly more precise and enables exact pinpointing of potential issues. However, those tests are also expensive to create and maintain (see for example here the mistake in some test descriptions). I would not see a problem decreasing the quality by grouping those tests and having less description text to maintain 🙂

This is not a request for changes.

CHANGELOG.md Outdated Show resolved Hide resolved
@Ndpnt Ndpnt requested a review from MattiSG December 11, 2023 10:17
Copy link
Member

@MattiSG MattiSG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and tested locally, works well! 👏

I did not check the upgrade instructions.

I found one interesting inconsistency that, from my point of view, does not need fixing but is worth noting: the data sources for /services and for /version are not the same. One is the declarations, the other is the versions. This means that, if the config is inconsistent (loading declarations and versions from two different collections), the return values will be inconsistent, with a service+type that was exposed in /services being unavailable under `/version.

CHANGELOG.md Outdated Show resolved Hide resolved

app.listen(port);

if (process.env.NODE_ENV !== 'test') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I clearly misread the line below. Sorry for the noise.

I believe this would be better addressed by changing the logger config in test mode rather than changing the instructions: always ask to log, but the logger decides what is output in test mode (perhaps nothing).

Co-authored-by: Matti Schneider <matti@opentermsarchive.org>
@Ndpnt Ndpnt merged commit 9c0b385 into main Dec 11, 2023
7 checks passed
@Ndpnt Ndpnt deleted the versions-api branch December 11, 2023 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants