Skip to content

Commit e5b59c6

Browse files
committed
This test suite need a full rewrite, it showing it age .
1 parent bf73ad7 commit e5b59c6

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

.github/workflows/ruby.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ jobs:
107107
PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
108108
PGHOST: localhost
109109
PGPORT: 5432
110-
PGUSER: jruby
111-
PGPASSWORD: jruby
110+
PGUSER: arjdbc
111+
PGPASSWORD: arjdbc
112112

113113
steps:
114114
- uses: actions/checkout@v4
@@ -127,9 +127,9 @@ jobs:
127127
sudo ln -s /usr/bin/diff /usr/bin/gdiff || true
128128
- name: Setup database
129129
run: |
130-
PGPASSWORD=postgres psql -h localhost -U postgres -c "CREATE USER jruby WITH SUPERUSER CREATEDB LOGIN PASSWORD 'jruby';"
131-
PGPASSWORD=jruby psql -h localhost -d postgres -c "create database activerecord_unittest;" -U jruby
132-
PGPASSWORD=jruby psql -h localhost -d postgres -c "create database activerecord_unittest2;" -U jruby
130+
PGPASSWORD=postgres psql -h localhost -U postgres -c "CREATE USER arjdbc WITH SUPERUSER CREATEDB LOGIN PASSWORD 'arjdbc';"
131+
PGPASSWORD=arjdbc psql -h localhost -d postgres -c "create database activerecord_unittest;" -U arjdbc
132+
PGPASSWORD=arjdbc psql -h localhost -d postgres -c "create database activerecord_unittest2;" -U arjdbc
133133
- name: Build
134134
run: |
135135
rake jar # compiles ext generates: lib/arjdbc/jdbc/adapter_java.jar
@@ -258,8 +258,8 @@ jobs:
258258
INSERT_RETURNING: ${{ matrix.insert_returning }}
259259
PGHOST: localhost
260260
PGPORT: 5432
261-
PGUSER: jruby
262-
PGPASSWORD: jruby
261+
PGUSER: arjdbc
262+
PGPASSWORD: arjdbc
263263

264264
steps:
265265
- uses: actions/checkout@v4
@@ -275,7 +275,7 @@ jobs:
275275
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
276276
- name: Setup PostgreSQL user
277277
run: |
278-
PGPASSWORD=postgres psql -h localhost -U postgres -c "CREATE USER jruby WITH SUPERUSER CREATEDB LOGIN PASSWORD 'jruby';"
278+
PGPASSWORD=postgres psql -h localhost -U postgres -c "CREATE USER arjdbc WITH SUPERUSER CREATEDB LOGIN PASSWORD 'arjdbc';"
279279
- name: Build
280280
run: |
281281
rake jar

rakelib/db.rake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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 "jruby" role' unless PostgresHelper.postgres_role?
42+
fail 'could not create test database: missing "arjdbc" role' unless PostgresHelper.postgres_role?
4343

4444
load 'test/db/postgres_config.rb' # rescue nil
4545
puts POSTGRES_CONFIG.inspect if $VERBOSE
@@ -53,7 +53,7 @@ CREATE DATABASE #{POSTGRES_CONFIG[:database]} OWNER #{POSTGRES_CONFIG[:username]
5353
ENCODING '#{POSTGRES_CONFIG[:encoding]}' LC_COLLATE '#{POSTGRES_CONFIG[:collate]}' LC_CTYPE '#{POSTGRES_CONFIG[:collate]}';
5454
SQL
5555

56-
params = { '-U' => ENV['PSQL_USER'] || 'jruby' }
56+
params = { '-U' => ENV['PGUSER'] || 'arjdbc' }
5757
params['-q'] = nil unless $VERBOSE
5858

5959
puts "Creating PostgreSQL (test) database: #{POSTGRES_CONFIG[:database]}"

test/db/postgres_config.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
POSTGRES_CONFIG = {
22
:adapter => 'postgresql',
3-
:database => 'arjdbc_test',
3+
:database => ENV['PGDATABASE'] || 'arjdbc_test',
44
:host => 'localhost',
5-
:username => 'arjdbc',
6-
:password => 'arjdbc',
5+
:username => ENV['PGUSER'] || 'arjdbc',
6+
:password => ENV['PGPASSWORD'] || 'arjdbc',
77
:connect_timeout => 10, # seconds
88
:encoding => 'utf8',
99
:collate => 'en_US.UTF-8',

test/db/postgresql/rake_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ def psql(args)
115115
end
116116

117117
# Use the test database user or fallback to ENV
118-
username = db_config[:username] || ENV['PSQL_USERNAME'] || 'jruby'
118+
username = db_config[:username] || ENV['PGUSER'] || 'arjdbc'
119119
args = "--username=#{username} #{args}"
120120

121121
puts "psql args: #{args}"
122122

123123
# Set PGPASSWORD for authentication
124124
env = {}
125-
env['PGPASSWORD'] = db_config[:password] || 'jruby'
125+
env['PGPASSWORD'] = db_config[:password] || 'arjdbc'
126126

127127
IO.popen(env, "#{PSQL_EXE} #{args}") { |io| io.read }
128128
end

test/shared_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ module PostgresHelper
2525
class << self
2626
def postgres_role?(warn = nil)
2727
if psql = which('psql')
28-
user = ENV['PSQL_USER'] || 'jruby'
29-
password = ENV['PGPASSWORD'] || (user == 'jruby' ? 'jruby' : '')
28+
user = ENV['PGUSER'] || 'arjdbc'
29+
password = ENV['PGPASSWORD'] || 'arjdbc'
3030
cmd = "PGPASSWORD=#{password} #{psql} -d postgres -c '\\l' -U #{user} #{psql_params} 2>&1"
3131
if `#{cmd}` && $?.exitstatus == 0
3232
true

0 commit comments

Comments
 (0)