ubicloud/spec/routes/api/cli/pg/reset-superuser-password_spec.rb
Jeremy Evans cbf2d95cbb Revert the backout of the CLI support
This reverts commit b741fe9005.

This was backed out as problems started occuring shortly after
a large CLI pull request was merged.  However, log analysis
shows that the CLI was unrelated to the problems.
2025-02-11 16:09:46 -08:00

18 lines
780 B
Ruby

# frozen_string_literal: true
require_relative "../spec_helper"
RSpec.describe Clover, "cli pg reset-superuser-password" do
before do
expect(Config).to receive(:postgres_service_project_id).and_return(@project.id).at_least(:once)
end
it "schedules reset of superuser password for database" do
cli(%w[pg eu-central-h1/test-pg create])
expect(Semaphore.where(name: "update_superuser_password")).to be_empty
pg = PostgresResource.first
expect(cli(%w[pg eu-central-h1/test-pg reset-superuser-password fooBar123456])).to eq "Superuser password reset scheduled for PostgreSQL database with id: #{pg.ubid}"
expect(Semaphore.where(name: "update_superuser_password")).not_to be_empty
expect(pg.reload.superuser_password).to eq "fooBar123456"
end
end