Sha256: 3ea5af5eff4bf7d94adaa59a8f7f61225572c1dc443f41d838516dee63c249fa

Contents?: true

Size: 1.38 KB

Versions: 26

Compression:

Stored size: 1.38 KB

Contents

# encoding: UTF-8
describe 'winrm client primitives' do
  before(:all) do
    @winrm = winrm_connection
  end

  describe 'open and close shell', integration: true do
    it 'should #open_shell and #close_shell' do
      sid = @winrm.open_shell
      expect(sid).to be_a_uid
      expect(@winrm.close_shell(sid)).to be true
    end

    it 'should #run_command and #cleanup_command' do
      sid = @winrm.open_shell

      cmd_id = @winrm.run_command(sid, 'ipconfig', %w(/all))
      expect(sid).to be_a_uid

      expect(@winrm.cleanup_command(sid, cmd_id)).to be true
      @winrm.close_shell(sid)
    end

    it 'should #get_command_output' do
      sid = @winrm.open_shell
      cmd_id = @winrm.run_command(sid, 'ipconfig', %w(/all))

      output = @winrm.get_command_output(sid, cmd_id)
      expect(output).to have_exit_code 0
      expect(output).to have_stdout_match(/.+/)
      expect(output).to have_no_stderr

      @winrm.cleanup_command(sid, cmd_id)
      @winrm.close_shell(sid)
    end

    it 'should #get_command_output with a block' do
      sid = @winrm.open_shell
      cmd_id = @winrm.run_command(sid, 'ipconfig', %w(/all))

      outvar = ''
      @winrm.get_command_output(sid, cmd_id) do |stdout, _stderr|
        outvar << stdout
      end
      expect(outvar).to match(/Windows IP Configuration/)

      @winrm.cleanup_command(sid, cmd_id)
      @winrm.close_shell(sid)
    end
  end
end

Version data entries

26 entries across 26 versions & 4 rubygems

Version Path
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/winrm-1.8.1/spec/winrm_primitives_spec.rb
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/gems/winrm-1.8.1/spec/winrm_primitives_spec.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/gems/winrm-1.8.1/spec/winrm_primitives_spec.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/gems/winrm-1.8.1/spec/winrm_primitives_spec.rb
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/gems/winrm-1.8.1/spec/winrm_primitives_spec.rb
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/winrm-1.8.1/spec/winrm_primitives_spec.rb
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/winrm-1.8.1/spec/winrm_primitives_spec.rb
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/winrm-1.8.1/spec/winrm_primitives_spec.rb
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/winrm-1.8.1/spec/winrm_primitives_spec.rb
winrm-1.8.1 spec/winrm_primitives_spec.rb
winrm-1.8.0 spec/winrm_primitives_spec.rb
winrm-1.7.2 spec/winrm_primitives_spec.rb
winrm-1.7.0 spec/winrm_primitives_spec.rb
winrm-1.6.1 spec/winrm_primitives_spec.rb
winrm-1.6.0 spec/winrm_primitives_spec.rb
winrm-1.5.0 spec/winrm_primitives_spec.rb
winrm-1.4.0 spec/winrm_primitives_spec.rb
winrm-1.3.5 spec/winrm_primitives_spec.rb
winrm-1.3.5.dev spec/winrm_primitives_spec.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/winrm-1.3.4/spec/winrm_primitives_spec.rb