Sha256: bfecb93c0640342cd9737b70e886847fbcf966b9a1102ff5a731897b7f093a74

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

describe Sonic::Execute do
  before(:each) do
    @options = {
      project_root: "spec/fixtures/project",
      filter: "i-066b140d9479e9681,i-09482b1a6e330fbf7"
    }
  end

  describe "Sonic#execute" do
    it "should build up options for ssm send command with inline command" do
      execute = Sonic::Execute.new(["uname", "-a"], @options)
      options = execute.build_ssm_options
      expect(options[:instance_ids]).to eq %w[i-066b140d9479e9681 i-09482b1a6e330fbf7]
      expect(options[:document_name]).to eq "AWS-RunShellScript"
      expect(options[:comment]).to include "sonic "
      expect(options[:parameters]["commands"]).to eq ["uname -a"]
    end

    it "should build up options for ssm send command with file" do
      execute = Sonic::Execute.new(["file://command.txt"], @options)
      options = execute.build_ssm_options
      expect(options[:instance_ids]).to eq %w[i-066b140d9479e9681 i-09482b1a6e330fbf7]
      expect(options[:document_name]).to eq "AWS-RunShellScript"
      expect(options[:comment]).to include "sonic "
      expect(options[:parameters]["commands"]).to eq([
        '#!/usr/bin/env ruby',
        'puts "hi"'
      ])
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sonic-screwdriver-1.4.0 spec/lib/sonic/execute_spec.rb
sonic-screwdriver-1.3.2 spec/lib/sonic/execute_spec.rb
sonic-screwdriver-1.3.0 spec/lib/sonic/execute_spec.rb