Remove "template=template0" from db connection params.
authorTom Clegg <tom@tomclegg.ca>
Thu, 16 Apr 2020 19:40:28 +0000 (15:40 -0400)
committerTom Clegg <tom@tomclegg.ca>
Thu, 16 Apr 2020 19:40:28 +0000 (15:40 -0400)
It's not a valid connection param. Only pass it to Rails in test mode
as a pseudo connection param.

No issue #

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@tomclegg.ca>

build/run-library.sh
sdk/python/tests/run_test_server.py
services/api/config/arvados_config.rb

index ac5dc718be1c6e36e86e743bf0805ab11c891da7..fd37f632b0350fac411e5d3e2fb819c8c045d7af 100755 (executable)
@@ -912,7 +912,9 @@ timer_reset() {
 }
 
 timer() {
-    echo -n "$(($SECONDS - $t0))s"
+    if [[ -n "$t0" ]]; then
+        echo -n "$(($SECONDS - $t0))s"
+    fi
 }
 
 report_outcomes() {
index 22d4f62ea0fd1bf5a8d6718e2d410b79d5377d72..734bb04270bcfc7c94891542add7806b390350bc 100644 (file)
@@ -676,7 +676,6 @@ def setup_config():
            "dbname": "arvados_test",
            "user": "arvados",
            "password": "insecure_arvados_test",
-            "template": "template0", # used by RailsAPI when [re]creating the database
         }
 
     localhost = "127.0.0.1"
index 8d2544dde1e81945e65a580886333098a3ccf6e8..502e3e787d1e1324217983f73cd841bce0e1ea1a 100644 (file)
@@ -253,6 +253,11 @@ end
 if ::Rails.env.to_s == "test" && db_config["test"].nil?
   $arvados_config["PostgreSQL"]["Connection"]["dbname"] = "arvados_test"
 end
+if ::Rails.env.to_s == "test"
+  # Use template0 when creating a new database. Avoids
+  # character-encoding/collation problems.
+  $arvados_config["PostgreSQL"]["Connection"]["template"] = "template0"
+end
 
 if $arvados_config["PostgreSQL"]["Connection"]["password"].empty?
   raise "Database password is empty, PostgreSQL section is: #{$arvados_config["PostgreSQL"]}"