Skip to content

Commit 54638ee

Browse files
author
Chojan Shang
authored
fix(mysql/sync): spawn to fix sync tests (#17)
1 parent 15786d3 commit 54638ee

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
uses: actions-rs/cargo@v1
9494
with:
9595
command: test
96-
args: --workspace -- --ignored
96+
args: --workspace -- --include-ignored
9797

9898
pass:
9999
name: All tests passed

mysql/tests/it/sync.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,21 +131,20 @@ where
131131
.enable_all()
132132
.build()
133133
.unwrap();
134-
let port = rt.block_on(async {
134+
135+
rt.spawn(async move {
135136
let listener = TcpListener::bind("127.0.0.1:0").await.unwrap();
136137
let port = listener.local_addr().unwrap().port();
137138
tokio::spawn(async move {
138139
let (s, _) = listener.accept().await.unwrap();
139140
AsyncMysqlIntermediary::run_on(self, s).await
140141
});
141-
port
142-
});
143-
// rt.shutdown_background();
144142

145-
let mut db =
146-
mysql::Conn::new(Opts::from_url(&format!("mysql://127.0.0.1:{}", port)).unwrap())
147-
.unwrap();
148-
c(&mut db);
143+
let mut db =
144+
mysql::Conn::new(Opts::from_url(&format!("mysql://127.0.0.1:{}", port)).unwrap())
145+
.unwrap();
146+
c(&mut db);
147+
});
149148
}
150149
}
151150

0 commit comments

Comments
 (0)