Skip to content

Commit

Permalink
Fix PostgreSQL automated tests for single machine installation (#2298)
Browse files Browse the repository at this point in the history
* Fix tests for single machine installation

* Update changelog
  • Loading branch information
to-bar authored May 6, 2021
1 parent dc1ae4b commit ea81b69
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

- [#2262](https://github.com/epiphany-platform/epiphany/issues/2262) - [Ubuntu] elasticsearch-curator in version 5.8.3 is not available from APT repo
- [#2259](https://github.com/epiphany-platform/epiphany/issues/2259) - [Upgrade] Automated tests fail when run after upgrade
- [#2292](https://github.com/epiphany-platform/epiphany/issues/2292) - PostgreSQL automated tests fail when run on a single machine
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,27 @@

postgresql_host = '127.0.0.1'
postgresql_default_port = 5432
pgbouncer_default_port = 6432
pgbouncer_default_port = 6432

config_docs = Hash.new
for kind in ['logging', 'postgresql']
config_docs[kind.to_sym] = readDataYaml("configuration/#{kind}")
end

ELASTICSEARCH = { # must be global until we introduce modules
host: listInventoryHosts("logging")[0],
api_port: 9200,
admin_password: readDataYaml("configuration/logging")["specification"]["admin_password"]
admin_password: !config_docs[:logging].nil? ? config_docs[:logging]["specification"]["admin_password"] : nil
}
replicated = readDataYaml("configuration/postgresql")["specification"]["extensions"]["replication"]["enabled"]
replication_user = readDataYaml("configuration/postgresql")["specification"]["extensions"]["replication"]["replication_user_name"]
replication_password = readDataYaml("configuration/postgresql")["specification"]["extensions"]["replication"]["replication_user_password"]
use_repmgr = readDataYaml("configuration/postgresql")["specification"]["extensions"]["replication"]["use_repmgr"]
max_wal_senders = readDataYaml("configuration/postgresql")["specification"]["config_file"]["parameter_groups"].detect {|i| i["name"] == 'REPLICATION'}["subgroups"].detect {|i| i["name"] == "Sending Server(s)"}["parameters"].detect {|i| i["name"] == "max_wal_senders"}["value"]
wal_keep_segments = readDataYaml("configuration/postgresql")["specification"]["config_file"]["parameter_groups"].detect {|i| i["name"] == 'REPLICATION'}["subgroups"].detect {|i| i["name"] == "Sending Server(s)"}["parameters"].detect {|i| i["name"] == "wal_keep_segments"}["value"]

pgbouncer_enabled = readDataYaml("configuration/postgresql")["specification"]["extensions"]["pgbouncer"]["enabled"]
pgaudit_enabled = readDataYaml("configuration/postgresql")["specification"]["extensions"]["pgaudit"]["enabled"]

replicated = config_docs[:postgresql]["specification"]["extensions"]["replication"]["enabled"]
replication_user = config_docs[:postgresql]["specification"]["extensions"]["replication"]["replication_user_name"]
replication_password = config_docs[:postgresql]["specification"]["extensions"]["replication"]["replication_user_password"]
use_repmgr = config_docs[:postgresql]["specification"]["extensions"]["replication"]["use_repmgr"]
max_wal_senders = config_docs[:postgresql]["specification"]["config_file"]["parameter_groups"].detect {|i| i["name"] == 'REPLICATION'}["subgroups"].detect {|i| i["name"] == "Sending Server(s)"}["parameters"].detect {|i| i["name"] == "max_wal_senders"}["value"]
wal_keep_segments = config_docs[:postgresql]["specification"]["config_file"]["parameter_groups"].detect {|i| i["name"] == 'REPLICATION'}["subgroups"].detect {|i| i["name"] == "Sending Server(s)"}["parameters"].detect {|i| i["name"] == "wal_keep_segments"}["value"]
pgbouncer_enabled = config_docs[:postgresql]["specification"]["extensions"]["pgbouncer"]["enabled"]
pgaudit_enabled = config_docs[:postgresql]["specification"]["extensions"]["pgaudit"]["enabled"]
pg_user = 'testuser'
pg_pass = 'testpass'

Expand Down
1 change: 1 addition & 0 deletions core/src/epicli/data/common/tests/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def readDataYaml(kind)
YAML.load_stream(File.read path) do |ruby|
datayaml << ruby
end
# returns nil if kind not found
return datayaml.select {|x| x["kind"] == kind }[0]
end

Expand Down

0 comments on commit ea81b69

Please sign in to comment.