From b9df883aa90af59e17aa492bdff8b946bd738bd5 Mon Sep 17 00:00:00 2001 From: Xinyuan Lin Date: Fri, 2 Oct 2026 18:03:50 -0700 Subject: [PATCH] refactor(config): remove the unused test-database JDBC URL Nothing on main has read storage.jdbc.url-for-test-cases since #6238 made the e2e TestUtils create its own per-run database on the embedded Postgres. Drop the key, its env override and StorageConfig's val, and the four RunSpec comments that explained their jdbcUrl assertion by contrast with it. The CI steps that create texera_db_for_test_cases stay: backport checks run main's build.yml against release/v1.1 and v1.2, whose e2e specs still connect to it. --- .../apache/texera/service/AccessControlServiceRunSpec.scala | 6 ++---- .../org/apache/texera/web/TexeraWebApplicationSpec.scala | 2 -- common/config/src/main/resources/storage.conf | 6 ------ .../org/apache/texera/common/config/StorageConfig.scala | 1 - .../org/apache/texera/service/ConfigServiceRunSpec.scala | 4 +--- .../texera/service/NotebookMigrationServiceRunSpec.scala | 6 ++---- 6 files changed, 5 insertions(+), 20 deletions(-) diff --git a/access-control-service/src/test/scala/org/apache/texera/service/AccessControlServiceRunSpec.scala b/access-control-service/src/test/scala/org/apache/texera/service/AccessControlServiceRunSpec.scala index 7f647ab0fc6..c7382334455 100644 --- a/access-control-service/src/test/scala/org/apache/texera/service/AccessControlServiceRunSpec.scala +++ b/access-control-service/src/test/scala/org/apache/texera/service/AccessControlServiceRunSpec.scala @@ -236,10 +236,8 @@ class AccessControlServiceRunSpec extends AnyFlatSpec with Matchers { // below also passes for an initialize() that opens nothing at all, off a pool some earlier // test in this JVM installed. initialized.sqlServerAfter.map(_ ne initialized.sqlServerBefore.orNull) shouldBe Some(true) - // Not the test-cases database: pointing the running service at it would have every access - // check read a schema that the CI e2e specs truncate underneath it. Only the URL is pinned — - // storage.conf ships username and password as the same string ("postgres"), so nothing here - // can tell the two credential arguments apart. + // Only the URL is pinned — storage.conf ships username and password as the same string + // ("postgres"), so nothing here can tell the two credential arguments apart. initialized.pooledJdbcUrl.get shouldBe StorageConfig.jdbcUrl } } diff --git a/amber/src/test/scala/org/apache/texera/web/TexeraWebApplicationSpec.scala b/amber/src/test/scala/org/apache/texera/web/TexeraWebApplicationSpec.scala index 3b62e3218fa..a7dfcd43a56 100644 --- a/amber/src/test/scala/org/apache/texera/web/TexeraWebApplicationSpec.scala +++ b/amber/src/test/scala/org/apache/texera/web/TexeraWebApplicationSpec.scala @@ -254,8 +254,6 @@ class TexeraWebApplicationSpec extends AnyFlatSpec with Matchers { databaseReachable, "run() requires a reachable Postgres at the configured JDBC URL (provided in CI)" ) - // Not the test-cases database: pointing the running server at it would have every dashboard - // read and write a schema that the CI e2e specs truncate underneath it. ranEnvironment pooledJdbcUrl shouldBe Some(StorageConfig.jdbcUrl) } diff --git a/common/config/src/main/resources/storage.conf b/common/config/src/main/resources/storage.conf index d8e7e19921e..45659b776fd 100644 --- a/common/config/src/main/resources/storage.conf +++ b/common/config/src/main/resources/storage.conf @@ -165,12 +165,6 @@ storage { url = "jdbc:postgresql://localhost:5432/texera_db?currentSchema=texera_db,public" url = ${?STORAGE_JDBC_URL} - # Some e2e test cases require the user system. To make sure running those test cases can pass the CI, and that - # running them locally do not contaminate developers' own texera_db, we use another database with a different - # name for running these test cases. - url-for-test-cases = "jdbc:postgresql://localhost:5432/texera_db_for_test_cases?currentSchema=texera_db,public" - url-for-test-cases = ${?STORAGE_JDBC_URL_FOR_TEST_CASES} - username = "postgres" username = ${?STORAGE_JDBC_USERNAME} diff --git a/common/config/src/main/scala/org/apache/texera/common/config/StorageConfig.scala b/common/config/src/main/scala/org/apache/texera/common/config/StorageConfig.scala index 2627b12f5d2..446905b53a1 100644 --- a/common/config/src/main/scala/org/apache/texera/common/config/StorageConfig.scala +++ b/common/config/src/main/scala/org/apache/texera/common/config/StorageConfig.scala @@ -30,7 +30,6 @@ object StorageConfig { // JDBC specifics val jdbcUrl: String = conf.getString("storage.jdbc.url") - val jdbcUrlForTestCases: String = conf.getString("storage.jdbc.url-for-test-cases") val jdbcUsername: String = conf.getString("storage.jdbc.username") val jdbcPassword: String = conf.getString("storage.jdbc.password") diff --git a/config-service/src/test/scala/org/apache/texera/service/ConfigServiceRunSpec.scala b/config-service/src/test/scala/org/apache/texera/service/ConfigServiceRunSpec.scala index 5f6cd1238ba..e1aa049fe2b 100644 --- a/config-service/src/test/scala/org/apache/texera/service/ConfigServiceRunSpec.scala +++ b/config-service/src/test/scala/org/apache/texera/service/ConfigServiceRunSpec.scala @@ -324,9 +324,7 @@ class ConfigServiceRunSpec // below also passes for an initialize() that opens nothing at all, off a pool some earlier // test in this JVM installed. initialized.sqlServerAfter.map(_ ne initialized.sqlServerBefore.orNull) shouldBe Some(true) - // Not the test-cases database: preloading the defaults into it would leave the deployment's - // own site_settings empty while the CI e2e specs truncate the rows that were written. Only - // the URL is pinned — storage.conf ships username and password as the same string + // Only the URL is pinned — storage.conf ships username and password as the same string // ("postgres"), so nothing here can tell the two credential arguments apart. initialized.pooledJdbcUrl.get shouldBe StorageConfig.jdbcUrl } diff --git a/notebook-migration-service/src/test/scala/org/apache/texera/service/NotebookMigrationServiceRunSpec.scala b/notebook-migration-service/src/test/scala/org/apache/texera/service/NotebookMigrationServiceRunSpec.scala index 64a99c07e27..826f6d94685 100644 --- a/notebook-migration-service/src/test/scala/org/apache/texera/service/NotebookMigrationServiceRunSpec.scala +++ b/notebook-migration-service/src/test/scala/org/apache/texera/service/NotebookMigrationServiceRunSpec.scala @@ -222,10 +222,8 @@ class NotebookMigrationServiceRunSpec extends AnyFlatSpec with Matchers { // below also passes for an initialize() that opens nothing at all, off a pool some earlier // test in this JVM installed. initialized.sqlServerAfter.map(_ ne initialized.sqlServerBefore.orNull) shouldBe Some(true) - // Not the test-cases database: pointing the running service at it would have every migration - // record land in a schema that the CI e2e specs truncate underneath it. Only the URL is - // pinned — storage.conf ships username and password as the same string ("postgres"), so - // nothing here can tell the two credential arguments apart. + // Only the URL is pinned — storage.conf ships username and password as the same string + // ("postgres"), so nothing here can tell the two credential arguments apart. initialized.pooledJdbcUrl.get shouldBe StorageConfig.jdbcUrl } }