fix(dev): stabilize macOS signing and isolate test keys

This commit is contained in:
t8y2 committed 2026-09-25 02:39:41 +08:00
1 parent 7b825db71b
commit 55c07f5852
99 files changed
+1022 -533

No files matched your search

+1 -2
View File
@@ -125,7 +125,6 @@ mod tests {
use super::{export_table_data_csv_core, CsvQuoteMode, TableCsvExportOptions};
use crate::connection::AppState;
use crate::models::connection::{ConnectionConfig, DatabaseType};
use crate::storage::Storage;
fn salesforce_config(id: &str) -> ConnectionConfig {
let mut config = serde_json::from_value::<ConnectionConfig>(serde_json::json!({
@@ -148,7 +147,7 @@ mod tests {
#[tokio::test]
async fn salesforce_table_csv_export_is_refused_before_a_file_is_created() {
let directory = tempfile::tempdir().unwrap();
let storage = Storage::open(&directory.path().join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&directory.path().join("storage.db")).await.unwrap();
let state = AppState::new(storage);
let config = salesforce_config("sfdc-csv");
state.configs.write().await.insert(config.id.clone(), config);
+1 -2
View File
@@ -4077,7 +4077,6 @@ mod tests {
use super::{ExportProgress, LenientExportErrors};
use crate::connection::AppState;
use crate::models::connection::DatabaseType;
use crate::storage::Storage;
use crate::types::SpatialColumn;
use crate::types::{ObjectInfo, ObjectSourceKind, TableInfo};
use serde_json::{json, Value};
@@ -6510,7 +6509,7 @@ mod tests {
}
async fn test_app_state(scratch_dir: &std::path::Path) -> AppState {
let storage = Storage::open(&scratch_dir.join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&scratch_dir.join("storage.db")).await.unwrap();
AppState::new(storage)
}
@@ -4014,7 +4014,6 @@ mod tests {
use crate::db::agent_driver::{AgentDriverClient, AgentLaunchSpec};
use crate::models::connection::ConnectionConfig;
use crate::storage::Storage;
let directory = tempfile::tempdir().unwrap();
let mut file = tempfile::NamedTempFile::new_in(directory.path()).unwrap();
@@ -4047,7 +4046,7 @@ for line in sys.stdin:
.await
.unwrap();
client.try_optional_handshake("test").await.unwrap();
let storage = Storage::open(&directory.path().join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&directory.path().join("storage.db")).await.unwrap();
let state = crate::connection::AppState::new(storage);
let config: ConnectionConfig = serde_json::from_value(serde_json::json!({
"id": "legacy",
+3 -3
View File
@@ -2665,7 +2665,7 @@ mod tests {
#[tokio::test]
async fn manual_file_missing_session_never_falls_back_to_ordinary_execution() {
let directory = tempfile::tempdir().unwrap();
let storage = crate::storage::Storage::open(&directory.path().join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&directory.path().join("storage.db")).await.unwrap();
let state = AppState::new(storage);
let request = SqlFileRequest {
txn_session_id: Some("expired-session".to_string()),
@@ -2945,7 +2945,7 @@ mod tests {
async fn file_progress_executor_preserves_success_cancellation_and_failure() {
let directory = std::env::temp_dir().join(format!("dbx-file-progress-{}", uuid::Uuid::new_v4()));
tokio::fs::create_dir_all(&directory).await.unwrap();
let storage = crate::storage::Storage::open(&directory.join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&directory.join("storage.db")).await.unwrap();
let state = AppState::new(storage);
let comments = "-- no database operation\n".repeat(40_000).into_bytes();
for (bytes, cancel, terminal) in [
@@ -3348,7 +3348,7 @@ mod tests {
async fn streaming_gaussdb_on_error_stop_overrides_continue_on_error_at_script_position() {
let dir = std::env::temp_dir().join(format!("dbx-sql-file-stop-on-error-{}", uuid::Uuid::new_v4()));
std::fs::create_dir_all(&dir).unwrap();
let storage = crate::storage::Storage::open(&dir.join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&dir.join("storage.db")).await.unwrap();
let state = crate::connection::AppState::new(storage);
let config: crate::models::connection::ConnectionConfig = serde_json::from_value(serde_json::json!({
"id": "gauss-stream",
+2 -3
View File
@@ -2300,7 +2300,6 @@ mod tests {
use crate::plugins::{
InstalledPlugin, PluginDriverManifest, PluginDriverSession, PluginManifest, PluginRuntimeEnv,
};
use crate::storage::Storage;
use crate::xlsx_export::{build_xlsx_workbook, XlsxWorksheetData};
use serde_json::json;
use std::io::Read;
@@ -2390,7 +2389,7 @@ mod tests {
"query_timeout_secs": 30
}))
.unwrap();
let storage = Storage::open(&dir.join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&dir.join("storage.db")).await.unwrap();
let state = AppState::new(storage);
state.configs.write().await.insert(config.id.clone(), config.clone());
let export_id = format!("export-{}", uuid::Uuid::new_v4());
@@ -2566,7 +2565,7 @@ mod tests {
"query_timeout_secs": 30
}))
.unwrap();
let storage = Storage::open(&dir.join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&dir.join("storage.db")).await.unwrap();
let state = AppState::new(storage);
state.configs.write().await.insert(config.id.clone(), config);
let export_id = format!("export-{}", uuid::Uuid::new_v4());
+10 -11
View File
@@ -7507,7 +7507,6 @@ where
mod tests {
use super::*;
use crate::models::connection::{ConnectionConfig, DatabaseType};
use crate::storage::Storage;
use crate::xlsx_export::{build_xlsx_workbook_multi, XlsxWorksheetData};
use std::io::{Cursor, Write};
@@ -9493,7 +9492,7 @@ mod tests {
#[tokio::test]
async fn truncate_xlsx_with_malformed_tail_preserves_existing_rows() {
let dir = tempfile::tempdir().unwrap();
let storage = Storage::open(&dir.path().join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&dir.path().join("storage.db")).await.unwrap();
let state = AppState::new(storage);
let connection_id = "xlsx-truncate-tail";
let pool_key = format!("{connection_id}:session:import");
@@ -9585,7 +9584,7 @@ mod tests {
#[tokio::test]
async fn cancelling_xlsx_after_validation_prevents_non_transactional_truncate() {
let dir = tempfile::tempdir().unwrap();
let storage = Storage::open(&dir.path().join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&dir.path().join("storage.db")).await.unwrap();
let state = AppState::new(storage);
let connection_id = "cancel-xlsx-after-validation";
let pool_key = format!("{connection_id}:session:import");
@@ -9673,7 +9672,7 @@ mod tests {
#[tokio::test]
async fn cancelling_before_first_truncate_batch_preserves_existing_rows() {
let dir = tempfile::tempdir().unwrap();
let storage = Storage::open(&dir.path().join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&dir.path().join("storage.db")).await.unwrap();
let state = AppState::new(storage);
let connection_id = "cancel-truncate-first-batch";
let pool_key = format!("{connection_id}:session:import");
@@ -11312,7 +11311,7 @@ mod tests {
#[tokio::test]
async fn sqlserver_staging_cleanup_failure_invalidates_cached_pool() {
let dir = tempfile::tempdir().unwrap();
let storage = Storage::open(&dir.path().join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&dir.path().join("storage.db")).await.unwrap();
let state = AppState::new(storage);
let pool_key = "sqlserver-cleanup-failure";
let database_path = dir.path().join("target.db");
@@ -11360,7 +11359,7 @@ mod tests {
use std::sync::Arc;
let dir = tempfile::tempdir().unwrap();
let storage = Storage::open(&dir.path().join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&dir.path().join("storage.db")).await.unwrap();
let state = AppState::new(storage);
let pool_key = "cancel-sql-sub-batches:session:import";
let database_path = dir.path().join("target.db");
@@ -11427,7 +11426,7 @@ mod tests {
#[tokio::test]
async fn pending_postgres_copy_is_not_flushed_after_cancellation() {
let dir = tempfile::tempdir().unwrap();
let storage = Storage::open(&dir.path().join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&dir.path().join("storage.db")).await.unwrap();
let state = AppState::new(storage);
let mut accumulator = Some(PostgresCopyAccumulator::with_limits("COPY items".to_string(), 1024, 100));
accumulator.as_mut().unwrap().append_row(b"1\n");
@@ -11455,7 +11454,7 @@ mod tests {
#[tokio::test]
async fn postgres_copy_internal_flush_stops_before_write_when_cancelled() {
let dir = tempfile::tempdir().unwrap();
let storage = Storage::open(&dir.path().join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&dir.path().join("storage.db")).await.unwrap();
let state = AppState::new(storage);
let plan = CompiledImportPlan {
mapped_source_indexes: vec![0],
@@ -11579,7 +11578,7 @@ mod tests {
impl SqliteAppendTestContext {
async fn new(test_name: &str, max_rows: usize) -> Self {
let dir = tempfile::tempdir().unwrap();
let storage = Storage::open(&dir.path().join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&dir.path().join("storage.db")).await.unwrap();
let state = AppState::new(storage);
let pool_key = format!("{test_name}:session:import");
let database_path = dir.path().join("target.db");
@@ -11695,7 +11694,7 @@ mod tests {
#[tokio::test]
async fn delimited_sqlite_append_import_flushes_the_final_window() {
let dir = tempfile::tempdir().unwrap();
let storage = Storage::open(&dir.path().join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&dir.path().join("storage.db")).await.unwrap();
let state = AppState::new(storage);
let connection_id = "sqlite-delimited-append";
let pool_key = format!("{connection_id}:session:import");
@@ -11929,7 +11928,7 @@ mod tests {
#[tokio::test]
async fn oracle_jdbc_import_maps_xls_rows_to_insert_all() {
let dir = tempfile::tempdir().unwrap();
let storage = Storage::open(&dir.path().join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&dir.path().join("storage.db")).await.unwrap();
let state = AppState::new(storage);
let connection_id = "oracle-jdbc-import";
let config: ConnectionConfig = serde_json::from_value(serde_json::json!({
+1 -1
View File
@@ -10871,7 +10871,7 @@ CREATE TABLE "Other"."prefix""Source"."NAME" ("ID" INT);"#;
async fn test_app_state() -> (AppState, std::path::PathBuf) {
let dir = std::env::temp_dir().join(format!("dbx-transfer-test-{}", uuid::Uuid::new_v4()));
std::fs::create_dir_all(&dir).unwrap();
let storage = crate::storage::Storage::open(&dir.join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&dir.join("storage.db")).await.unwrap();
(AppState::new(storage), dir)
}
@@ -244,7 +244,7 @@ mod tests {
async fn state_fixture() -> (Arc<AppState>, tempfile::TempDir) {
let directory = tempfile::tempdir().unwrap();
let storage = crate::storage::Storage::open(&directory.path().join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&directory.path().join("storage.db")).await.unwrap();
let state = Arc::new(AppState::new_with_plugin_dir(storage, directory.path().join("plugins")));
(state, directory)
}
@@ -3,7 +3,7 @@ use serde_json::json;
async fn sqlite_fixture() -> (tempfile::TempDir, Arc<AppState>, TransferRequest, String, String) {
let directory = tempfile::tempdir().unwrap();
let storage = crate::storage::Storage::open(&directory.path().join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&directory.path().join("storage.db")).await.unwrap();
let state = Arc::new(AppState::new_with_plugin_dir(storage, directory.path().join("plugins")));
for id in ["source", "target"] {
let path = directory.path().join(format!("{id}.db"));
@@ -118,7 +118,7 @@ async fn transfer_rebuild_preview_plans_without_executing_ddl() {
#[tokio::test]
async fn transfer_keyset_pagination_copies_every_row_across_many_batches() {
let directory = tempfile::tempdir().unwrap();
let storage = crate::storage::Storage::open(&directory.path().join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&directory.path().join("storage.db")).await.unwrap();
let state = Arc::new(AppState::new_with_plugin_dir(storage, directory.path().join("plugins")));
for id in ["source", "target"] {
let path = directory.path().join(format!("{id}.db"));
+1 -1
View File
@@ -1083,7 +1083,7 @@ mod tests {
async fn sqlite_dependency_fixture() -> (AppState, crate::db::sqlite::SqliteHandle, tempfile::TempDir) {
let directory = tempfile::tempdir().unwrap();
let storage = crate::storage::Storage::open(&directory.path().join("storage.db")).await.unwrap();
let storage = crate::persistence::test_storage::open(&directory.path().join("storage.db")).await.unwrap();
let state = AppState::new(storage);
let pool =
crate::db::sqlite::connect_path_create_if_missing(directory.path().join("target.db").to_str().unwrap())