Skip to content

Commit 4143a22

Browse files
committed
Let Windows diagnostic use Julia readiness check
1 parent ef00bf7 commit 4143a22

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

.github/workflows/issue236-windows.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ jobs:
3939
mysql-version: "8.4"
4040
root-password: root
4141

42-
- name: Check MySQL server
43-
shell: pwsh
44-
run: mysql -h127.0.0.1 -P3306 -uroot -proot -e "SELECT VERSION();"
45-
4642
- name: Run issue 236 diagnostic
4743
shell: pwsh
4844
env:

test/issue236_windows.jl

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,21 @@ function connect_root(; db=nothing)
5151
end
5252
end
5353

54+
function wait_for_connection(; db=nothing, timeout=30.0)
55+
start = time()
56+
last_err = nothing
57+
while time() - start < timeout
58+
try
59+
return connect_root(; db=db)
60+
catch err
61+
last_err = err
62+
logline("WAIT_CONNECTION db=", db, " error=", sprint(showerror, err))
63+
sleep(1)
64+
end
65+
end
66+
error("MySQL did not become ready: ", sprint(showerror, last_err))
67+
end
68+
5469
function placeholders(n::Integer)
5570
return join(fill("?", n), ",")
5671
end
@@ -99,7 +114,7 @@ function run_case(conn, name::String, shape::Symbol, params; mysql_store_result:
99114
end
100115

101116
function prepare_database()
102-
conn = connect_root()
117+
conn = wait_for_connection()
103118
try
104119
version = DBInterface.execute(conn, "SELECT VERSION() AS version") |> Tables.columntable
105120
logline("SERVER_VERSION ", only(version.version))
@@ -110,7 +125,7 @@ function prepare_database()
110125
DBInterface.close!(conn)
111126
end
112127

113-
conn = connect_root(db="issue236")
128+
conn = wait_for_connection(db="issue236")
114129
DBInterface.execute(conn, "CREATE TABLE myTable (id BIGINT UNSIGNED NOT NULL PRIMARY KEY)")
115130

116131
stmt = DBInterface.prepare(conn, "INSERT INTO myTable (id) VALUES (?)")

0 commit comments

Comments
 (0)