Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix replication validation for not saved subscriptions #16997

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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