Files
ubicloud/spec/routes/api/cli/pg/destroy_spec.rb
Burak Yucesoy 98d7cc7e0e Make storage_size a required parameter
storage_size is one of the core parameters like size. Giving it a default feels
wrong. It is also not possible to use a single default value as valid storage_size
sizes vary by the instance size. So far we used smallest allowed storage size for
given the instance size as the default, but I think it is better to ask the user
to provide it explicitly.
2025-06-20 07:56:16 +03:00

21 lines
789 B
Ruby

# frozen_string_literal: true
require_relative "../spec_helper"
RSpec.describe Clover, "cli pg destroy" do
before do
expect(Config).to receive(:postgres_service_project_id).and_return(@project.id).at_least(:once)
end
it "destroys PostgreSQL database" do
expect(PostgresResource.count).to eq 0
cli(%w[pg eu-central-h1/test-pg create -s standard-2 -S 64])
expect(PostgresResource.count).to eq 1
pg = PostgresResource.first
expect(pg).to be_a PostgresResource
expect(Semaphore.where(strand_id: pg.id, name: "destroy")).to be_empty
expect(cli(%w[pg eu-central-h1/test-pg destroy -f])).to eq "PostgreSQL database, if it exists, is now scheduled for destruction\n"
expect(Semaphore.where(strand_id: pg.id, name: "destroy")).not_to be_empty
end
end