Skip to content

Commit

Permalink
Add integration test for IPv6 address in URL for SQL DBs (#4077)
Browse files Browse the repository at this point in the history
Add an integration test for connecting to SQL databases with an IPv6
address in a connection string.

This serves as a regression test for the fix for PostgreSQL and MySQL in
1548dc1, as well as confirms that this
already works on MS SQL.

Ref: #4051
Ref: prisma/prisma#18079
  • Loading branch information
aqrln authored Jul 25, 2023
1 parent 512cf35 commit ecb5e33
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions schema-engine/sql-migration-tests/tests/initialization/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,28 @@ fn connecting_to_a_postgres_database_with_missing_schema_creates_it(api: TestApi
assert!(schema_exists)
}
}

#[test_connector(exclude(Sqlite))]
fn ipv6_addresses_are_supported_in_connection_strings(api: TestApi) {
let url = api.connection_string().replace("localhost", "[::1]");
assert!(url.contains("[::1]"));

let provider = api.provider();

let schema = format!(
r#"
datasource db {{
provider = "{provider}"
url = "{url}"
}}
"#
);

let engine = schema_api(Some(schema.clone()), None).unwrap();
tok(
engine.ensure_connection_validity(schema_core::json_rpc::types::EnsureConnectionValidityParams {
datasource: schema_core::json_rpc::types::DatasourceParam::SchemaString(SchemaContainer { schema }),
}),
)
.unwrap();
}

0 comments on commit ecb5e33

Please sign in to comment.