Files
ubicloud/spec/routes/api/cli/lb/detach-vm_spec.rb
mohi-kalantari ce8d3faf95 Move healthcheck logic from LoadBalancersVms to LoadBalancerVmPort allowing multiple ports
By moving healthcheck logic, we can have multiple ports per LB with
the right health check implementation.

LoadBalancersVms table was not dropped and was kept as it was since
it had its own usages and we needed the states stored in it for migration

LB and Firewall progs are changed to apply the right nft rules for each
port. The prog will iterate over the lb.ports and create the right rules for
each port
2025-03-25 11:02:41 +01:00

22 lines
768 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.vm_ports_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.vm_ports_dataset.select_map(:state)).to eq ["detaching"]
end
end