Files
ubicloud/spec/routes/api/cli/vm/restart_spec.rb
Jeremy Evans 9d5f0a2cbc Validate Vm#public_key when saving
This implements a fairly loose validation of the public key format.
It does not check specific key types, nor try to decode the base64
key and check it for validity.  It does check that the format in
general is valid, and that at least one valid key is present.
It will reject public keys, because those don't have a space.

This requires changes to many specs to have them use a valid public
key format.  In many cases, that is done by changing a single
dash to a space.
2025-04-26 05:34:41 +09:00

17 lines
497 B
Ruby

# frozen_string_literal: true
require_relative "../spec_helper"
RSpec.describe Clover, "cli vm restart" do
before do
cli(%w[vm eu-central-h1/test-vm create] << "a a")
@vm = Vm.first
end
it "restarts vm" do
expect(Semaphore.where(strand_id: @vm.id, name: "restart")).to be_empty
expect(cli(%w[vm eu-central-h1/test-vm restart])).to eq "Scheduled restart of VM with id #{@vm.ubid}\n"
expect(Semaphore.where(strand_id: @vm.id, name: "restart")).not_to be_empty
end
end