Once we install a newer version of an image, we might want to remove the older versions. This program enables that. To use it, an operator is expect to run the following in the REPL: ``` > boot_image = BootImage[... id ...] > st = boot_image.remove_boot_image ``` Then it'll wait for storage volumes using that boot image to drain and after that it'll remove the image files and db records.
20 lines
521 B
Ruby
20 lines
521 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "spec_helper"
|
|
|
|
RSpec.describe BootImage do
|
|
subject(:boot_image) { described_class.new }
|
|
|
|
describe "#remove_boot_image" do
|
|
it "creates a strand to delete boot image" do
|
|
expect(Strand).to receive(:create_with_id) do |args|
|
|
expect(args[:prog]).to eq("RemoveBootImage")
|
|
expect(args[:label]).to eq("start")
|
|
expect(args[:stack]).to eq([{subject_id: 1}])
|
|
end
|
|
boot_image.id = 1
|
|
boot_image.remove_boot_image
|
|
end
|
|
end
|
|
end
|