From 1b907b356fe910e70e67c2cb9fd861f2d4dade07 Mon Sep 17 00:00:00 2001 From: Miguel Fernandez Date: Thu, 23 Nov 2023 15:45:15 +0100 Subject: [PATCH] Re-write a test that depends on the line numbers of a source file (sqlite) --- libs/test-setup/src/test_api_args.rs | 2 +- .../sql-migration-tests/tests/migrations/sqlite.rs | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/libs/test-setup/src/test_api_args.rs b/libs/test-setup/src/test_api_args.rs index 548136554b35..fc07f908b286 100644 --- a/libs/test-setup/src/test_api_args.rs +++ b/libs/test-setup/src/test_api_args.rs @@ -207,7 +207,7 @@ impl TestApiArgs { } pub fn max_ddl_refresh_delay(&self) -> Option { - self.db.max_ddl_refresh_delay.clone() + self.db.max_ddl_refresh_delay } } diff --git a/schema-engine/sql-migration-tests/tests/migrations/sqlite.rs b/schema-engine/sql-migration-tests/tests/migrations/sqlite.rs index de5a77dca3f3..9596535f25a1 100644 --- a/schema-engine/sql-migration-tests/tests/migrations/sqlite.rs +++ b/schema-engine/sql-migration-tests/tests/migrations/sqlite.rs @@ -182,13 +182,9 @@ fn unique_constraint_errors_in_migrations(api: TestApi) { .send_unwrap_err() .to_user_facing(); - let expected_json = expect![[r#" - { - "is_panic": false, - "message": "SQLite database error\nUNIQUE constraint failed: Fruit.name\n 0: sql_schema_connector::apply_migration::apply_migration\n at schema-engine/connectors/sql-schema-connector/src/apply_migration.rs:10\n 1: sql_migration_tests::commands::schema_push::SchemaPush\n with \u001b[3mmigration_id\u001b[0m\u001b[2m=\u001b[0mSome(\"the-migration\")\n at schema-engine/sql-migration-tests/src/commands/schema_push.rs:43", - "backtrace": null - }"#]]; - expected_json.assert_eq(&serde_json::to_string_pretty(&res).unwrap()) + assert!(serde_json::to_string_pretty(&res) + .unwrap() + .contains("UNIQUE constraint failed: Fruit.name")); } #[test]