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.
22 lines
788 B
Ruby
22 lines
788 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "../spec_helper"
|
|
|
|
RSpec.describe Clover, "cli lb attach-vm" do
|
|
before do
|
|
cli(%w[vm eu-central-h1/test-vm create a])
|
|
@vm = Vm.first
|
|
cli(%w[ps eu-central-h1/test-ps create])
|
|
@ps = PrivateSubnet.first
|
|
cli(%W[lb eu-central-h1/test-lb create #{@ps.ubid} 12345 54321])
|
|
cli(%W[lb eu-central-h1/test-lb attach-vm #{@vm.ubid}])
|
|
@lb = LoadBalancer.first
|
|
end
|
|
|
|
it "detaches VM from load balancer" do
|
|
expect(@lb.load_balancers_vms_dataset.select_map(:state)).to eq ["down"]
|
|
expect(cli(%W[lb eu-central-h1/test-lb detach-vm #{@vm.ubid}])).to eq "Detached VM with id #{@vm.ubid} from load balancer with id #{@lb.ubid}\n"
|
|
expect(@lb.load_balancers_vms_dataset.select_map(:state)).to eq ["detaching"]
|
|
end
|
|
end
|