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

✅ Resurrect core integration tests #472

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft

Conversation

JMicheli
Copy link
Collaborator

I'm starting this as a draft because I think there's work to do, but I want to see codecov's results for it.

This moves the contents of the old, unused core/integration-tests to the normal path for integration tests core/tests and adds a couple of actual integration tests.

I think the tests could be expanded and better-written. I tried to translate some other old tests but it seems the core API has changed enough that it wasn't obvious how they should be re-written.

Copy link

codecov bot commented Oct 11, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
core/src/db/client.rs 0.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
apps/server/src/utils/http.rs 90.56% <100.00%> (ø)
core/src/context.rs 54.34% <ø> (+32.60%) ⬆️
core/src/filesystem/hash.rs 95.83% <100.00%> (+55.01%) ⬆️
core/src/filesystem/image/mod.rs 100.00% <100.00%> (ø)
core/src/filesystem/media/mod.rs 100.00% <100.00%> (ø)
core/src/job/scheduler.rs 17.56% <ø> (+17.56%) ⬆️
core/src/db/client.rs 65.38% <0.00%> (+65.38%) ⬆️

... and 27 files with indirect coverage changes


🚨 Try these New Features:

Copy link
Collaborator

@aaronleopold aaronleopold left a comment

Choose a reason for hiding this comment

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

I gave this a read through, thanks for getting them more up-to-speed with the current API and long backlog of changes which happened since I removed them from the workspace!

I think the tests could be expanded and better-written. I tried to translate some other old tests but it seems the core API has changed enough that it wasn't obvious how they should be re-written.

I totally agree, IIRC the scanner + job system itself has had 1-2 rewrites since these tests were written. Happy to collaborate as needed to think through what the best system moving forward might be 🙂

@@ -10,7 +10,7 @@
"studio": "yarn dlx prisma studio",
"build": "cargo build --release",
"format": "cargo fmt --package stump_core",
"integration-tests": "cargo integration-tests",
"run-tests": "cargo test",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can just remove this tbh, thanks for updating it though!

Comment on lines 43 to 44
/// TODO - something less heinous, there must be a way to wait on a job
tokio::time::sleep(Duration::from_secs(1)).await;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Haha I know we chatted on Discord about this, but to reiterate here I think tokio::select!ing on the event bus and a reasonable timeout is the way to go here

.await
.unwrap();

assert_ne!(items.len(), 0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can probably assert the actual expected number of items, since we know(?) how many should be scanned when we create the test library

Comment on lines +12 to +17
let migration_res = core.run_migrations().await;
assert!(
migration_res.is_ok(),
"Failed to run migrations: {:?}",
migration_res
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a note that IIRC this won't actually run migrations in debug/test. I think it will just push onto the DB. I'd have to double check to be sure. Either way, it is needed

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