Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable H2_Spec #12498

Closed
wants to merge 12 commits into from
27 changes: 17 additions & 10 deletions test/Generic_JDBC_Tests/src/H2_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ type H2_JDBC_Config
database_root = data_dir / ("h2_tests" + (Date_Time.now.format "yyyy-MM-dd_HHmmss.f"))
url = "jdbc:h2:" + database_root.path + "/test"
cleanup =
IO.println "AAAAA deleting"
database_root . delete_if_exists recursive=True
IO.println "AAAAA deleted"
IO.println "AAAAA exists before "+database_root.exists.to_text
cleanup
IO.println "AAAAA exists after "+database_root.exists.to_text
Panic.with_finalizer cleanup <|
database_root . create_directory
action url
Expand All @@ -34,23 +38,20 @@ type H2_JDBC_Config
conn = Generic_JDBC_Connection.connect url
conn.should_succeed
cleanup =
IO.println "AAAAA closing"
conn.close
IO.println "AAAAA closed"
Panic.with_finalizer cleanup <|
action conn

add_specs suite_builder =
config = H2_JDBC_Config.Value

# Remove https://github.com/enso-org/enso/issues/12489
is_windows = Platform.os == Platform.OS.Windows
windows_pending = if is_windows then "disabled on windows" else Nothing

if is_windows.not then
Generic_JDBC_Connection_Spec.add_specs_for_backend config suite_builder
Generic_JDBC_Connection_Spec.add_specs_for_backend config suite_builder

## These tests are here instead of in Generic_JDBC_Connection_Spec because
they are backend-dependent.
suite_builder.group "(H2) Generic JDBC Connection" pending=windows_pending group_builder->
suite_builder.group "(H2) Generic JDBC Connection" group_builder->
with_connection = config.with_connection

# Cleans things up afterwards, but also before for easier debugging.
Expand All @@ -67,9 +68,15 @@ add_specs suite_builder =
lower x = x.to_case ..Lower

group_builder.specify "should be able to create a connection via Database.connect" <|
config.with_database url->
conn = Database.connect (Generic_JDBC_Details.Value url)
conn.should_be_a Generic_JDBC_Connection
handler cp =
IO.println "AAAAA caught p "+cp.payload.to_text
IO.println "AAAAA ==== st"
cp.internal_original_exception.printStackTrace
IO.println "AAAAA ==== ste"
Panic.catch Any handler=handler <|
config.with_database url->
conn = Database.connect (Generic_JDBC_Details.Value url)
conn.should_be_a Generic_JDBC_Connection

group_builder.specify "should be able to get table info" <|
with_connection conn-> cleanup_tables conn ["foo", "bar"] <|
Expand Down
Loading