File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed
Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 9191 postgres :
9292 image : postgres:17
9393 env :
94- POSTGRES_USER : jruby
95- POSTGRES_PASSWORD : jruby
96- POSTGRES_HOST_AUTH_METHOD : trust
94+ POSTGRES_PASSWORD : postgres
95+ POSTGRES_DB : postgres
9796 ports :
9897 - 5432:5432
9998 options : --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
@@ -122,6 +121,7 @@ jobs:
122121 bundler-cache : true # runs 'bundle install' and caches installed gems automatically
123122 - name : Setup database
124123 run : |
124+ PGPASSWORD=postgres psql -h localhost -U postgres -c "CREATE USER jruby WITH SUPERUSER CREATEDB LOGIN PASSWORD 'jruby';"
125125 PGPASSWORD=jruby psql -c "create database activerecord_unittest;" -U jruby
126126 PGPASSWORD=jruby psql -c "create database activerecord_unittest2;" -U jruby
127127 - name : Build
@@ -235,9 +235,8 @@ jobs:
235235 postgres :
236236 image : postgres:17
237237 env :
238- POSTGRES_USER : jruby
239- POSTGRES_PASSWORD : jruby
240- POSTGRES_HOST_AUTH_METHOD : trust
238+ POSTGRES_PASSWORD : postgres
239+ POSTGRES_DB : postgres
241240 ports :
242241 - 5432:5432
243242 options : --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
@@ -265,6 +264,9 @@ jobs:
265264 with :
266265 ruby-version : ${{ matrix.ruby-version }}
267266 bundler-cache : true # runs 'bundle install' and caches installed gems automatically
267+ - name : Setup PostgreSQL user
268+ run : |
269+ PGPASSWORD=postgres psql -h localhost -U postgres -c "CREATE USER jruby WITH SUPERUSER CREATEDB LOGIN PASSWORD 'jruby';"
268270 - name : Build
269271 run : |
270272 rake jar
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ GRANT ALL PRIVILEGES ON `test\_%`.* TO #{MYSQL_CONFIG[:username]}@localhost;
3939 task :postgresql do
4040 require File . expand_path ( '../../test/shared_helper' , __FILE__ )
4141 fail 'could not create test database: psql executable not found' unless psql = which ( 'psql' )
42- fail 'could not create test database: missing "postgres " role' unless PostgresHelper . postgres_role?
42+ fail 'could not create test database: missing "jruby " role' unless PostgresHelper . postgres_role?
4343
4444 load 'test/db/postgres_config.rb' # rescue nil
4545 puts POSTGRES_CONFIG . inspect if $VERBOSE
Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ module PostgresHelper
2525 class << self
2626 def postgres_role? ( warn = nil )
2727 if psql = which ( 'psql' )
28- if `#{ psql } -c '\\ l' -U jruby #{ psql_params } 2>&1` && $?. exitstatus == 0
28+ cmd = "PGPASSWORD=#{ ENV [ 'PGPASSWORD' ] || 'jruby' } #{ psql } -c '\\ l' -U jruby #{ psql_params } 2>&1"
29+ if `#{ cmd } ` && $?. exitstatus == 0
2930 true
3031 else
3132 if warn . nil?
You can’t perform that action at this time.
0 commit comments