ubicloud/spec/routes/api/cli/ps/disconnect_spec.rb
Jeremy Evans 21128e2d8f Do not require location name when connecting/disconnecting subnets
Subnets must now be in the same location, so the location name would
be redundant.  Make the ps connect/disconnect similar to other cli
commands and no longer require the location name.

This removes the last remaining use of the convert_loc_name_to_id
helper method. All cli use allowing referencing objects by name
instead id now only supports objects in the same location.
2025-10-02 17:21:27 -07:00

24 lines
928 B
Ruby

# frozen_string_literal: true
require_relative "../spec_helper"
RSpec.describe Clover, "cli ps connect" do
before do
cli(%w[ps eu-central-h1/test-ps create])
cli(%w[ps eu-central-h1/test-ps2 create])
@ps1, @ps2 = PrivateSubnet.order(:name).all
cli(%W[ps eu-central-h1/#{@ps1.name} connect #{@ps2.ubid}])
end
it "disconnects requested private subnet from this subnet by id" do
expect(ConnectedSubnet.count).to eq 1
expect(cli(%W[ps eu-central-h1/test-ps disconnect #{@ps2.ubid}])).to eq "Disconnected private subnet #{@ps2.ubid} from #{@ps1.ubid}\n"
expect(ConnectedSubnet.count).to eq 0
end
it "disconnects requested private subnet from this subnet by name" do
expect(ConnectedSubnet.count).to eq 1
expect(cli(%W[ps eu-central-h1/test-ps disconnect test-ps2])).to eq "Disconnected private subnet test-ps2 from #{@ps1.ubid}\n"
expect(ConnectedSubnet.count).to eq 0
end
end