Currently, response bodies mix trailing newline and no trailing newline, and it kind of works because bin/ubi is written in Ruby and uses IO#puts, which will automatically add a newline if the string being printed does not end with a newline. However, other languages may not have similar behavior, and for consistency, it is best if the server always uses newlines in cli responses.
20 lines
815 B
Ruby
20 lines
815 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "../spec_helper"
|
|
|
|
RSpec.describe Clover, "cli pg delete-firewall-rule" do
|
|
before do
|
|
expect(Config).to receive(:postgres_service_project_id).and_return(@project.id).at_least(:once)
|
|
end
|
|
|
|
it "deletes the specified firewall rule for the database" do
|
|
cli(%w[pg eu-central-h1/test-pg create])
|
|
pg = PostgresResource.first
|
|
fwr = pg.firewall_rules_dataset.first
|
|
expect(cli(%w[pg eu-central-h1/test-pg delete-firewall-rule a/b], status: 400)).to eq "! Invalid firewall rule id format\n"
|
|
expect(pg.firewall_rules_dataset).not_to be_empty
|
|
expect(cli(%W[pg eu-central-h1/test-pg delete-firewall-rule #{fwr.ubid}])).to eq "Firewall rule, if it exists, has been scheduled for deletion\n"
|
|
expect(pg.firewall_rules_dataset).to be_empty
|
|
end
|
|
end
|