Skip to content

Commit d13e949

Browse files
committed
(FM-7789) - PostgreSQL Test Cleanup
1 parent 5ce085f commit d13e949

26 files changed

+191
-437
lines changed

.sync.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
---
2+
.gitlab-ci.yml:
3+
unmanaged: true
4+
25
.travis.yml:
36
docker_sets:
47
- set: docker/centos-7
@@ -9,6 +12,9 @@
912
branches:
1013
- release
1114

15+
appveyor.yml:
16+
delete: true
17+
1218
Gemfile:
1319
required:
1420
':system_tests':
@@ -29,8 +35,6 @@ Gemfile:
2935
Rakefile:
3036
changelog_user: puppetlabs
3137

32-
appveyor.yml:
33-
delete: true
34-
35-
.gitlab-ci.yml:
36-
unmanaged: true
38+
spec/spec_helper.rb:
39+
mock_with: ':rspec'
40+
coverage_report: true

lib/puppet/provider/postgresql_psql/ruby.rb

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,12 @@ def get_environment # rubocop:disable Style/AccessorMethodName : Refactor does n
5555

5656
def run_command(command, user, group, environment)
5757
command = command.join ' '
58-
if Puppet::PUPPETVERSION.to_f < 3.0
59-
require 'puppet/util/execution'
60-
Puppet::Util::Execution.withenv environment do
61-
Puppet::Util::SUIDManager.run_and_capture(command, user, group)
62-
end
63-
elsif Puppet::PUPPETVERSION.to_f < 3.4
64-
Puppet::Util.withenv environment do
65-
Puppet::Util::SUIDManager.run_and_capture(command, user, group)
66-
end
67-
else
68-
output = Puppet::Util::Execution.execute(command, uid: user,
69-
gid: group,
70-
failonfail: false,
71-
combine: true,
72-
override_locale: true,
73-
custom_environment: environment)
74-
[output, $CHILD_STATUS.dup]
75-
end
58+
output = Puppet::Util::Execution.execute(command, uid: user,
59+
gid: group,
60+
failonfail: false,
61+
combine: true,
62+
override_locale: true,
63+
custom_environment: environment)
64+
[output, $CHILD_STATUS.dup]
7665
end
7766
end

lib/puppet/provider/postgresql_replication_slot/ruby.rb

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,12 @@ def self.run_sql_command(sql)
4444
end
4545

4646
def self.run_command(command, user, group)
47-
if Puppet::PUPPETVERSION.to_f < 3.4
48-
Puppet::Util::SUIDManager.run_and_capture(command, user, group)
49-
else
50-
output = Puppet::Util::Execution.execute(command, uid: user,
51-
gid: group,
52-
failonfail: false,
53-
combine: true,
54-
override_locale: true,
55-
custom_environment: {})
56-
[output, $CHILD_STATUS.dup]
57-
end
47+
output = Puppet::Util::Execution.execute(command, uid: user,
48+
gid: group,
49+
failonfail: false,
50+
combine: true,
51+
override_locale: true,
52+
custom_environment: {})
53+
[output, $CHILD_STATUS.dup]
5854
end
5955
end

metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,5 @@
8484
],
8585
"pdk-version": "1.9.0",
8686
"template-url": "https://github.com/puppetlabs/pdk-templates/",
87-
"template-ref": "1.9.0-0-g7281db5"
88-
}
87+
"template-ref": "heads/master-0-g615413e"
88+
}

spec/acceptance/00-utf8_encoding_spec.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
require 'spec_helper_acceptance' # rubocop:disable Style/FileName
22

3-
# These tests are designed to ensure that the module, when ran with defaults,
4-
# sets up everything correctly and allows us to connect to Postgres.
53
describe 'postgresql::server', unless: UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
64
pp = <<-MANIFEST
75
class { 'postgresql::globals':
@@ -11,8 +9,7 @@ class { 'postgresql::globals':
119
class { 'postgresql::server': }
1210
MANIFEST
1311
it 'with defaults' do
14-
apply_manifest(pp, catch_failures: true)
15-
apply_manifest(pp, catch_changes: true)
12+
idempotent_apply(default, pp)
1613
end
1714

1815
describe port(5432) do

spec/acceptance/alternative_port_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
class { 'postgresql::server': port => '55433' }
99
MANIFEST
1010

11-
apply_manifest(pp, catch_failures: true)
12-
apply_manifest(pp, catch_changes: true)
11+
idempotent_apply(default, pp)
1312
end
1413

1514
describe port(55433) do # rubocop:disable Style/NumericLiterals

spec/acceptance/db_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ class { 'postgresql::server':
2020
}
2121
MANIFEST
2222

23-
apply_manifest(pp, catch_failures: true)
24-
apply_manifest(pp, catch_changes: true)
23+
idempotent_apply(default, pp)
2524

2625
# Verify that the postgres password works
2726
shell("echo 'localhost:*:*:postgres:\'space password\'' > /root/.pgpass")

spec/acceptance/default_parameters_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
class { 'postgresql::server': }
99
MANIFEST
1010

11-
apply_manifest(pp, catch_failures: true)
12-
apply_manifest(pp, catch_changes: true)
11+
idempotent_apply(default, pp)
1312
end
1413

1514
describe port(5432) do

spec/acceptance/overridden_settings_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ class { 'postgresql::server':
3131
MANIFEST
3232

3333
it 'with additional hiera entries' do
34-
apply_manifest(pp, catch_failures: true)
35-
apply_manifest(pp, catch_changes: true)
34+
idempotent_apply(default, pp)
3635
end
3736

3837
describe port(5432) do

spec/acceptance/postgresql_conn_validator_spec.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ class { 'postgresql::server':
3434
}
3535
MANIFEST
3636

37-
apply_manifest(pp, catch_failures: true)
38-
apply_manifest(pp, catch_changes: true)
37+
idempotent_apply(default, pp)
3938
end
4039

4140
it 'works with connect settings hash' do
@@ -53,8 +52,7 @@ class { 'postgresql::server':
5352
}
5453
MANIFEST
5554

56-
apply_manifest(pp, catch_failures: true)
57-
apply_manifest(pp, catch_changes: true)
55+
idempotent_apply(default, pp)
5856
end
5957

6058
it 'fails gracefully' do

0 commit comments

Comments
 (0)