-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
load pulpcore db configuration by asking django, not by parsing python
- Loading branch information
Showing
2 changed files
with
33 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require 'test_helper' | ||
|
||
describe Features::PulpcoreDatabase do | ||
include DefinitionsTestHelper | ||
|
||
subject { Features::PulpcoreDatabase.new } | ||
|
||
describe '.configuration' do | ||
it 'returns hash with DB config' do | ||
expected_command = <<~CMD.strip | ||
PULP_SETTINGS=/etc/pulp/settings.py runuser -u pulp -- pulpcore-manager shell --command 'from django.conf import settings; import json; print(json.dumps(settings.DATABASES["default"]))' | ||
CMD | ||
manager_return = <<~JSON | ||
{"ENGINE": "django.db.backends.postgresql", "NAME": "pulpcore", "USER": "pulp", "PASSWORD": "password", "HOST": "remotedb", "PORT": "5432"} | ||
JSON | ||
subject.expects(:execute!).with(expected_command).returns(manager_return) | ||
expected = { "adapter" => "postgresql", "host" => "remotedb", "port" => "5432", | ||
"database" => "pulpcore", "username" => "pulp", "password" => "password" } | ||
assert_equal expected, subject.configuration | ||
end | ||
end | ||
end |