Skip to content

Commit

Permalink
Merge pull request #16997 from yrudman/fix-replication-validation-bef…
Browse files Browse the repository at this point in the history
…ore-pglogical-schema-created

Fix replication validation for not saved subscriptions
(cherry picked from commit e7b6dce)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1552790
  • Loading branch information
carbonin authored and simaishi committed Mar 7, 2018
1 parent e4eb8f1 commit 0c1006b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/pglogical_subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def pglogical(refresh = false)
end

def validate(new_connection_params = {})
find_password
find_password if new_connection_params['password'].blank?
connection_hash = attributes.merge(new_connection_params.delete_blanks)
MiqRegionRemote.validate_connection_settings(connection_hash['host'],
connection_hash['port'],
Expand Down
9 changes: 9 additions & 0 deletions spec/models/pglogical_subscription_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,15 @@
.with("my.example.com", nil, "root", "thepassword", "vmdb_production")
sub.validate
end

it "validates connection parameters without accessing database or initializing subscription parameters" do
sub = described_class.new

expect(pglogical).not_to receive(:subscription_show_status)
expect(MiqRegionRemote).to receive(:validate_connection_settings)
.with("my.example.com", nil, "root", "mypass", "vmdb_production")
sub.validate('host' => "my.example.com", 'user' => "root", 'password' => "mypass", 'dbname' => "vmdb_production")
end
end

describe "#backlog" do
Expand Down

0 comments on commit 0c1006b

Please sign in to comment.