Skip to content

Commit 2270a1c

Browse files
committed
Disable fsync for test database clusters
To make tests a little bit faster, as proposed in #689. And fix indention by the way.
1 parent 642ec32 commit 2270a1c

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

spec/helpers.rb

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -281,27 +281,28 @@ def setup_cluster(postgresql_conf)
281281
FileUtils.rm_rf(@pgdata, verbose: $DEBUG)
282282

283283
trace "Running initdb"
284-
log_and_run @logfile, pg_bin_path('initdb'), '-E', 'UTF8', '--no-locale', '-D', @pgdata.to_s
284+
log_and_run @logfile, pg_bin_path('initdb'), '-E', 'UTF8', '--no-locale', '--no-sync', '-D', @pgdata.to_s
285285

286286
trace "Enable SSL"
287287
# Enable SSL in server config
288288
File.open(@pgdata+"postgresql.conf", "a+") do |fd|
289-
fd.puts <<-EOT
290-
ssl = on
291-
ssl_ca_file = 'ruby-pg-ca-cert'
292-
ssl_cert_file = 'ruby-pg-server-cert'
293-
ssl_key_file = 'ruby-pg-server-key'
294-
#{postgresql_conf}
295-
EOT
289+
fd.puts <<~EOT
290+
ssl = on
291+
ssl_ca_file = 'ruby-pg-ca-cert'
292+
ssl_cert_file = 'ruby-pg-server-cert'
293+
ssl_key_file = 'ruby-pg-server-key'
294+
fsync = off
295+
#{postgresql_conf}
296+
EOT
296297
end
297298

298299
# Enable MD5 authentication in hba config
299300
hba_content = File.read(@pgdata+"pg_hba.conf")
300301
File.open(@pgdata+"pg_hba.conf", "w") do |fd|
301-
fd.puts <<-EOT
302-
# TYPE DATABASE USER ADDRESS METHOD
303-
host all testusermd5 ::1/128 md5
304-
EOT
302+
fd.puts <<~EOT
303+
# TYPE DATABASE USER ADDRESS METHOD
304+
host all testusermd5 ::1/128 md5
305+
EOT
305306
fd.puts hba_content
306307
end
307308

0 commit comments

Comments
 (0)