Skip to content

Commit 0090f1a

Browse files
benthecarmanclaude
andcommitted
Address PR review feedback
- Add #[cfg(test)] to RefUnwindSafe impl (matches VssStore) - Take connection_string as String instead of &str - Bump actions/checkout to v6 in postgres CI workflow Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0df3811 commit 0090f1a

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

.github/workflows/postgres-integration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: CI Checks - PostgreSQL Integration Tests
22

3-
on: [push, pull_request]
3+
on: [ push, pull_request ]
44

55
concurrency:
66
group: ${{ github.workflow }}-${{ github.ref }}
@@ -27,7 +27,7 @@ jobs:
2727
2828
steps:
2929
- name: Checkout code
30-
uses: actions/checkout@v3
30+
uses: actions/checkout@v6
3131
- name: Install Rust stable toolchain
3232
run: |
3333
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain stable

src/builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ impl NodeBuilder {
639639
/// [PostgreSQL]: https://www.postgresql.org
640640
#[cfg(feature = "postgres")]
641641
pub fn build_with_postgres_store(
642-
&self, node_entropy: NodeEntropy, connection_string: &str, kv_table_name: Option<String>,
642+
&self, node_entropy: NodeEntropy, connection_string: String, kv_table_name: Option<String>,
643643
) -> Result<Node, BuildError> {
644644
let kv_store =
645645
crate::io::postgres_store::PostgresStore::new(connection_string, kv_table_name)
@@ -1117,7 +1117,7 @@ impl ArcedNodeBuilder {
11171117
self.inner
11181118
.read()
11191119
.unwrap()
1120-
.build_with_postgres_store(*node_entropy, &connection_string, kv_table_name)
1120+
.build_with_postgres_store(*node_entropy, connection_string, kv_table_name)
11211121
.map(Arc::new)
11221122
}
11231123

src/io/postgres_store/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ pub struct PostgresStore {
5353
// RefUnwindSafe. std::sync::Mutex (used by SqliteStore) doesn't have this issue because
5454
// it poisons on panic. This impl is needed for do_read_write_remove_list_persist which
5555
// requires K: KVStoreSync + RefUnwindSafe.
56+
#[cfg(test)]
5657
impl std::panic::RefUnwindSafe for PostgresStore {}
5758

5859
impl PostgresStore {
@@ -61,7 +62,7 @@ impl PostgresStore {
6162
/// Connects to the PostgreSQL database at the given `connection_string`.
6263
///
6364
/// The given `kv_table_name` will be used or default to [`DEFAULT_KV_TABLE_NAME`].
64-
pub fn new(connection_string: &str, kv_table_name: Option<String>) -> io::Result<Self> {
65+
pub fn new(connection_string: String, kv_table_name: Option<String>) -> io::Result<Self> {
6566
let internal_runtime = tokio::runtime::Builder::new_multi_thread()
6667
.enable_all()
6768
.thread_name_fn(|| {
@@ -74,7 +75,6 @@ impl PostgresStore {
7475
.build()
7576
.unwrap();
7677

77-
let connection_string = connection_string.to_string();
7878
let inner = tokio::task::block_in_place(|| {
7979
internal_runtime.block_on(async {
8080
PostgresStoreInner::new(&connection_string, kv_table_name).await
@@ -686,7 +686,7 @@ mod tests {
686686
}
687687

688688
fn create_test_store(table_name: &str) -> PostgresStore {
689-
PostgresStore::new(&test_connection_string(), Some(table_name.to_string())).unwrap()
689+
PostgresStore::new(test_connection_string(), Some(table_name.to_string())).unwrap()
690690
}
691691

692692
fn cleanup_store(store: &PostgresStore) {

tests/integration_tests_postgres.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async fn channel_full_cycle_with_postgres_store() {
2929
let node_a = builder_a
3030
.build_with_postgres_store(
3131
config_a.node_entropy,
32-
&test_connection_string(),
32+
test_connection_string(),
3333
Some("channel_cycle_a".to_string()),
3434
)
3535
.unwrap();
@@ -42,7 +42,7 @@ async fn channel_full_cycle_with_postgres_store() {
4242
let node_b = builder_b
4343
.build_with_postgres_store(
4444
config_b.node_entropy,
45-
&test_connection_string(),
45+
test_connection_string(),
4646
Some("channel_cycle_b".to_string()),
4747
)
4848
.unwrap();
@@ -80,7 +80,7 @@ async fn postgres_node_restart() {
8080
let node = builder
8181
.build_with_postgres_store(
8282
node_entropy,
83-
&connection_string,
83+
connection_string.clone(),
8484
Some("restart_test".to_string()),
8585
)
8686
.unwrap();
@@ -113,7 +113,7 @@ async fn postgres_node_restart() {
113113
let node = builder
114114
.build_with_postgres_store(
115115
node_entropy,
116-
&connection_string,
116+
connection_string.clone(),
117117
Some("restart_test".to_string()),
118118
)
119119
.unwrap();

0 commit comments

Comments
 (0)