Skip to content

Commit 5bd1fdc

Browse files
committed
update tests for oracle
1 parent b071712 commit 5bd1fdc

File tree

8 files changed

+24
-5
lines changed

8 files changed

+24
-5
lines changed

tests/core/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ async fn test_routing_with_db_fs() {
5050
config.site_prefix = "/prefix/".to_string();
5151
let state = AppState::init(&config).await.unwrap();
5252

53+
if matches!(
54+
state.db.info.database_type,
55+
sqlpage::webserver::database::SupportedDatabase::Oracle
56+
) {
57+
return;
58+
}
59+
5360
let drop_sql = "DROP TABLE IF EXISTS sqlpage_files";
5461
state.db.connection.execute(drop_sql).await.unwrap();
5562
let create_table_sql =

tests/data_formats/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ async fn test_json_body() -> actix_web::Result<()> {
4141

4242
#[actix_web::test]
4343
async fn test_csv_body() -> actix_web::Result<()> {
44-
let req = get_request_to("/tests/data_formats/csv_data.sql")
44+
let app_data = make_app_data().await;
45+
if matches!(
46+
app_data.db.info.database_type,
47+
sqlpage::webserver::database::SupportedDatabase::Oracle
48+
) {
49+
return Ok(());
50+
}
51+
52+
let req = crate::common::get_request_to_with_data("/tests/data_formats/csv_data.sql", app_data)
4553
.await?
4654
.to_srv_request();
4755
let resp = main_handler(req).await?;

tests/sql_test_files/component_rendering/columns_component_json_nomssql_nopostgres.sql renamed to tests/sql_test_files/component_rendering/columns_component_json_nomssql_nopostgres_nooracle.sql

File renamed without changes.

tests/sql_test_files/component_rendering/run_sql_from_database.sql renamed to tests/sql_test_files/component_rendering/run_sql_from_database_nooracle.sql

File renamed without changes.

tests/sql_test_files/component_rendering/temp_table_accessible_in_run_sql_nomssql.sql renamed to tests/sql_test_files/component_rendering/temp_table_accessible_in_run_sql_nomssql_nooracle.sql

File renamed without changes.

tests/sql_test_files/data/delayed_function_call.sql renamed to tests/sql_test_files/data/delayed_function_call_nooracle.sql

File renamed without changes.

tests/sql_test_files/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use actix_web::test;
2+
use sqlpage::webserver::database::SupportedDatabase;
23
use sqlpage::AppState;
34
use std::time::Duration;
45
use tokio::sync::oneshot;
@@ -7,7 +8,7 @@ use tokio::task::JoinHandle;
78
#[actix_web::test]
89
async fn run_all_sql_test_files() {
910
let app_data = crate::common::make_app_data().await;
10-
let test_files = get_sql_test_cases();
11+
let test_files = get_sql_test_cases(app_data.db.info.database_type);
1112

1213
let (shutdown_tx, shutdown_rx) = oneshot::channel();
1314
let (echo_handle, port) = crate::common::start_echo_server(shutdown_rx);
@@ -49,12 +50,15 @@ struct SqlTestCase {
4950
format: SqlTestFormat,
5051
}
5152

52-
fn get_sql_test_cases() -> Vec<SqlTestCase> {
53+
fn get_sql_test_cases(db_type: SupportedDatabase) -> Vec<SqlTestCase> {
5354
let mut tests = Vec::new();
5455
tests.extend(read_sql_tests_in_dir(
5556
"tests/sql_test_files/component_rendering",
5657
SqlTestFormat::Html,
5758
));
59+
if matches!(db_type, SupportedDatabase::Oracle) {
60+
return tests;
61+
}
5862
tests.extend(read_sql_tests_in_dir(
5963
"tests/sql_test_files/data",
6064
SqlTestFormat::Json,

tests/transactions/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ async fn test_transaction_error() -> actix_web::Result<()> {
99
let path = match data.db.info.database_type {
1010
SupportedDatabase::MySql => "/tests/transactions/failed_transaction_mysql.sql",
1111
SupportedDatabase::Mssql => "/tests/transactions/failed_transaction_mssql.sql",
12-
SupportedDatabase::Snowflake => {
13-
return Ok(()); //snowflake doesn't support transactions
12+
SupportedDatabase::Snowflake | SupportedDatabase::Oracle => {
13+
return Ok(()); //snowflake and oracle don't support transactions in this test way
1414
}
1515
_ => "/tests/transactions/failed_transaction.sql",
1616
};

0 commit comments

Comments
 (0)