Sha256: ce7bb7517fbe30e355d44959d6b18c5c18e6467de92941607a029c68e7ad04bb

Contents?: true

Size: 986 Bytes

Versions: 2

Compression:

Stored size: 986 Bytes

Contents

require_relative 'spec_helper'

module Larrow::Qingcloud
  describe Image do

    let(:base_image) do
      Image.list.select do |i| 
        i.status == :available and i.platform == 'linux'
      end.first
    end

    it 'list not empty' do
      expect(Image.list).not_to be_empty
    end

    it 'capture instance' do
      instance = Instance.
        create(image_id: base_image.id).
        first.
        stop(true)
      new_image = Image.create instance.id
      expect(new_image.status).to eq :available
      
      expect(instance.destroy).to be true
      expect(new_image.destroy).to be true
    end

    it 'create from snapshot' do
      instance = Instance.
        create(image_id: base_image.id).
        first
      snapshot = Snapshot.create(instance.id).first
      new_image = Image.create_from_snapshot snapshot.id

      expect(instance.destroy).to be true
      expect(snapshot.destroy).to be true
      expect(new_image.destroy).to be true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
larrow-qingcloud-0.0.2 spec/image_spec.rb
larrow-qingcloud-0.0.1 spec/image_spec.rb