Sha256: 172a992f61c876dad083c997cd5962bf0717469897793c6d102453be705262a3

Contents?: true

Size: 1.79 KB

Versions: 6

Compression:

Stored size: 1.79 KB

Contents

require "spec_helper"
require "cloudstack-cli"

describe VirtualMachine do

  it "should support all CRUD actions" do
    vmname = "testvm1"

    # CREATE
    out, err = capture_io{ CloudstackCli::Cli.start [
      "vm",
      "create",
      vmname,
      "--zone=#{ZONE}",
      "--template=#{TEMPLATE}",
      "--offering=#{OFFERING_S}",
      "--networks=test-network",
      "--port-rules=:80",
      "--assumeyes",
      CONFIG,
    ]}
    err.must_equal ""

    # READ - LIST
    out, err = capture_io{ CloudstackCli::Cli.start [
      "vm",
      "list",
      CONFIG
    ]}
    err.must_equal ""
    out.must_match(
      /.*(#{vmname}).*/
    )

    # READ - SHOW
    out, err = capture_io{ CloudstackCli::Cli.start [
      "vm",
      "show",
      vmname,
      CONFIG
    ]}
    err.must_equal ""
    out.must_match(
      /.*(#{vmname}).*/
    )

    # UPDATE - STOP
    out, err = capture_io{ CloudstackCli::Cli.start [
      "vm",
      "stop",
      vmname,
      "--force",
      CONFIG,
    ]}
    err.must_equal ""

    # UPDATE - UPDATE ;-)
    new_vmname = "testvm11"
    out, err = capture_io{ CloudstackCli::Cli.start [
      "vm",
      "update",
      vmname,
      "--name=#{new_vmname}",
      "--force",
      CONFIG,
    ]}
    err.must_equal ""

    # UPDATE - START
    out, err = capture_io{ CloudstackCli::Cli.start [
      "vm",
      "start",
      new_vmname,
      CONFIG,
    ]}
    err.must_equal ""

    # UPDATE - REBOOT
    out, err = capture_io{ CloudstackCli::Cli.start [
      "vm",
      "reboot",
      new_vmname,
      "--force",
      CONFIG,
    ]}
    err.must_equal ""

    # DELETE
    out, err = capture_io{ CloudstackCli::Cli.start [
      "vm",
      "destroy",
      new_vmname,
      "--expunge",
      "--force",
      CONFIG,
    ]}
    err.must_equal ""
    
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cloudstack-cli-1.6.3 spec/cloudstack-cli/commands/virtual_machine_spec.rb
cloudstack-cli-1.6.2 spec/cloudstack-cli/commands/virtual_machine_spec.rb
cloudstack-cli-1.6.1 spec/cloudstack-cli/commands/virtual_machine_spec.rb
cloudstack-cli-1.6.0 spec/cloudstack-cli/commands/virtual_machine_spec.rb
cloudstack-cli-1.5.13 spec/cloudstack-cli/commands/virtual_machine_spec.rb
cloudstack-cli-1.5.12 spec/cloudstack-cli/commands/virtual_machine_spec.rb