Skip to content

Conversation

@pott-cho
Copy link
Contributor

Close: #267
Added new integration tests:

  • sampling_policy_flow_with_fake_giganto_server: Validates the basic flow of policy registration and data reception.
  • sampling_policy_notify_flow_with_delete: Verifies stream termination and local file cleanup upon policy deletion.
  • sampling_policy_multiple_streams: Ensures individual streams operate correctly when multiple policies are active simultaneously.

Enhanced test readability:

  • timeseries_with_conn: Now validates that multiple Conn events within the same 15-minute slot are correctly aggregated.

@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.58%. Comparing base (9f1fb86) to head (0342f07).

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #283       +/-   ##
===========================================
+ Coverage   10.96%   48.58%   +37.62%     
===========================================
  Files           7        7               
  Lines         529      531        +2     
===========================================
+ Hits           58      258      +200     
+ Misses        471      273      -198     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pott-cho pott-cho requested a review from JonghoKim-jj January 22, 2026 10:03

use super::{Client, Conn, TimeSeries};
use super::time_series::clear_last_transfer_time;
use super::{Client, Conn, REQUIRED_GIGANTO_VERSION, TimeSeries};
Copy link
Contributor

Choose a reason for hiding this comment

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

Since it's common practice to import super::* in test modules, how about we do that here?

Suggested change
use super::{Client, Conn, REQUIRED_GIGANTO_VERSION, TimeSeries};
use super::*;

publish_repeat_delay: Duration,
}

struct TestServers {
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest renaming this struct (TestServers).
How about TestServerHandles or TestServerControls?


#[tokio::test]
async fn sampling_policy_flow_with_fake_giganto_server() {
use review_protocol::request::Handler;
Copy link
Contributor

Choose a reason for hiding this comment

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

How about moving this import to the top of the file?

time,
&policy,
event_time,
&crate::subscribe::Event::Conn(conn_event),
Copy link
Contributor

Choose a reason for hiding this comment

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

If super::* is imported, this can be simplified:

Suggested change
&crate::subscribe::Event::Conn(conn_event),
&Event::Conn(conn_event),

async fn sampling_policy_notify_flow_with_delete() {
use review_protocol::request::Handler;

let _lock = TOKEN.lock().await;
Copy link
Contributor

Choose a reason for hiding this comment

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

How about we remove TOKEN and use the serial_test crate instead? (https://crates.io/crates/serial_test)
It seems TOKEN was introduced to prevent concurrent access to the shared object.

Comment on lines 499 to 500
use crate::subscribe::TimeSeries;
const THREE_MIN: i64 = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

How about moving this import and constant definition to the top of the file?

Comment on lines +584 to +587
timeout(Duration::from_secs(5), notify_recv.recv())
.await
.expect("ingest notify timeout")
.expect("ingest notify recv");
Copy link
Contributor

Choose a reason for hiding this comment

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

(1) The expect() messages seem to differ from our convention. We usually describe the expected result.

(2) How about adding an assertion to verify that the received value matches the policy ID?

Suggested change
timeout(Duration::from_secs(5), notify_recv.recv())
.await
.expect("ingest notify timeout")
.expect("ingest notify recv");
let id = timeout(Duration::from_secs(5), notify_recv.recv())
.await
.expect("Received ingest notify before timeout")
.expect("Policy ID");
assert_eq!(id, policy.id);

Comment on lines +596 to +599
if last_time_series_path.exists() {
let content = fs::read_to_string(&last_time_series_path).unwrap_or_default();
eprintln!("time_data.json content: {content}");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed several eprintln! calls throughout the tests, both inside and outside of if blocks.
Are these intended for temporary debugging?

If they are meant to provide context for failures, I suggest refactoring them into the assert! or assert_eq! macros as custom messages.
This would make the code cleaner and more idiomatic.

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.

Add subscription pipeline integration tests (fake Giganto server, stream lifecycle)

3 participants