Files
ubicloud/spec/routes/api/cli/pg/remove-config-entries_spec.rb
Jeremy Evans 2b5e08c13c Add pg remove-config-entries to the cli
This uses the existing update_config sdk feature, with nil values,
which the api treats as deleting the entries.
2025-08-21 12:37:36 -07:00

20 lines
982 B
Ruby

# frozen_string_literal: true
require_relative "../spec_helper"
RSpec.describe Clover, "cli pg remove-config-entries" do
before do
expect(Config).to receive(:postgres_service_project_id).and_return(@project.id).at_least(:once)
end
it "adds/updated config entries" do
cli(%w[pg eu-central-h1/test-pg create -s standard-2 -S 64])
pg = PostgresResource.first
expect(pg.user_config).to eq({})
expect(cli(%w[pg eu-central-h1/test-pg add-config-entries allow_in_place_tablespaces=on allow_alter_system=off])).to eq "Updated config:\nallow_alter_system=off\nallow_in_place_tablespaces=on\n"
expect(pg.reload.user_config).to eq({"allow_in_place_tablespaces" => "on", "allow_alter_system" => "off"})
expect(cli(%w[pg eu-central-h1/test-pg remove-config-entries allow_system_table_mods allow_alter_system])).to eq "Updated config:\nallow_in_place_tablespaces=on\n"
expect(pg.reload.user_config).to eq({"allow_in_place_tablespaces" => "on"})
end
end