Skip to content

Commit 9625476

Browse files
authored
Merge pull request #1802 from input-output-hk/djo/flakiness_and_remove_block_in_place
UpkeepService tests flakiness
2 parents 3caf4de + 96b194a commit 9625476

File tree

5 files changed

+45
-44
lines changed

5 files changed

+45
-44
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mithril-aggregator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-aggregator"
3-
version = "0.5.37"
3+
version = "0.5.38"
44
description = "A Mithril Aggregator server"
55
authors = { workspace = true }
66
edition = { workspace = true }

mithril-aggregator/src/services/upkeep.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,17 @@ mod tests {
136136
let main_db_connection = main_db_file_connection(&main_db_path).unwrap();
137137
let cardano_tx_connection = cardano_tx_db_file_connection(&ctx_db_path).unwrap();
138138

139-
let service = AggregatorUpkeepService::new(
140-
Arc::new(main_db_connection),
141-
Arc::new(SqliteConnectionPool::build_from_connection(
142-
cardano_tx_connection,
143-
)),
144-
Arc::new(SignedEntityTypeLock::default()),
145-
TestLogger::file(&log_path),
146-
);
147-
148-
// Separate block to ensure the log is flushed after run
139+
// Separate block to force log flushing by dropping the service that owns the logger
149140
{
141+
let service = AggregatorUpkeepService::new(
142+
Arc::new(main_db_connection),
143+
Arc::new(SqliteConnectionPool::build_from_connection(
144+
cardano_tx_connection,
145+
)),
146+
Arc::new(SignedEntityTypeLock::default()),
147+
TestLogger::file(&log_path),
148+
);
149+
150150
service.run().await.expect("Upkeep service failed");
151151
}
152152

@@ -175,18 +175,18 @@ mod tests {
175175
.join("upkeep.log");
176176

177177
let signed_entity_type_lock = Arc::new(SignedEntityTypeLock::default());
178-
let service = AggregatorUpkeepService::new(
179-
Arc::new(main_db_connection().unwrap()),
180-
Arc::new(SqliteConnectionPool::build(1, cardano_tx_db_connection).unwrap()),
181-
signed_entity_type_lock.clone(),
182-
TestLogger::file(&log_path),
183-
);
178+
signed_entity_type_lock
179+
.lock(SignedEntityTypeDiscriminants::CardanoTransactions)
180+
.await;
184181

185-
// Separate block to ensure the log is flushed after run
182+
// Separate block to force log flushing by dropping the service that owns the logger
186183
{
187-
signed_entity_type_lock
188-
.lock(SignedEntityTypeDiscriminants::CardanoTransactions)
189-
.await;
184+
let service = AggregatorUpkeepService::new(
185+
Arc::new(main_db_connection().unwrap()),
186+
Arc::new(SqliteConnectionPool::build(1, cardano_tx_db_connection).unwrap()),
187+
signed_entity_type_lock.clone(),
188+
TestLogger::file(&log_path),
189+
);
190190
service.run().await.expect("Upkeep service failed");
191191
}
192192

mithril-signer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-signer"
3-
version = "0.2.159"
3+
version = "0.2.160"
44
description = "A Mithril Signer"
55
authors = { workspace = true }
66
edition = { workspace = true }

mithril-signer/src/upkeep_service.rs

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,17 @@ mod tests {
136136
let main_db_connection = main_db_file_connection(&main_db_path).unwrap();
137137
let cardano_tx_connection = cardano_tx_db_file_connection(&ctx_db_path).unwrap();
138138

139-
let service = SignerUpkeepService::new(
140-
Arc::new(main_db_connection),
141-
Arc::new(SqliteConnectionPool::build_from_connection(
142-
cardano_tx_connection,
143-
)),
144-
Arc::new(SignedEntityTypeLock::default()),
145-
TestLogger::file(&log_path),
146-
);
147-
148-
// Separate block to ensure the log is flushed after run
139+
// Separate block to force log flushing by dropping the service that owns the logger
149140
{
141+
let service = SignerUpkeepService::new(
142+
Arc::new(main_db_connection),
143+
Arc::new(SqliteConnectionPool::build_from_connection(
144+
cardano_tx_connection,
145+
)),
146+
Arc::new(SignedEntityTypeLock::default()),
147+
TestLogger::file(&log_path),
148+
);
149+
150150
service.run().await.expect("Upkeep service failed");
151151
}
152152

@@ -175,18 +175,19 @@ mod tests {
175175
.join("upkeep.log");
176176

177177
let signed_entity_type_lock = Arc::new(SignedEntityTypeLock::default());
178-
let service = SignerUpkeepService::new(
179-
Arc::new(main_db_connection().unwrap()),
180-
Arc::new(SqliteConnectionPool::build(1, cardano_tx_db_connection).unwrap()),
181-
signed_entity_type_lock.clone(),
182-
TestLogger::file(&log_path),
183-
);
178+
signed_entity_type_lock
179+
.lock(SignedEntityTypeDiscriminants::CardanoTransactions)
180+
.await;
184181

185-
// Separate block to ensure the log is flushed after run
182+
// Separate block to force log flushing by dropping the service that owns the logger
186183
{
187-
signed_entity_type_lock
188-
.lock(SignedEntityTypeDiscriminants::CardanoTransactions)
189-
.await;
184+
let service = SignerUpkeepService::new(
185+
Arc::new(main_db_connection().unwrap()),
186+
Arc::new(SqliteConnectionPool::build(1, cardano_tx_db_connection).unwrap()),
187+
signed_entity_type_lock.clone(),
188+
TestLogger::file(&log_path),
189+
);
190+
190191
service.run().await.expect("Upkeep service failed");
191192
}
192193

0 commit comments

Comments
 (0)