ahelal / kitchen-ansiblepush

test-kitchen plugin to use ansible in push mode
41 stars 22 forks source link

Provisioner fails if machine was rebooted during tests #10

Closed conorsch closed 8 years ago

conorsch commented 8 years ago

When running kitchen test on a playbook that includes a reboot, the playbook completes successfully, but kitchen throws an error:

PLAY RECAP ******************************************************************** 
ubuntu-trusty64            : ok=5    changed=1    unreachable=0    failed=0   

       *************** AnsiblePush end run *******************
>>>>>> Converge failed on instance <default-ubuntu-trusty64>.
>>>>>> Please see .kitchen/logs/default-ubuntu-trusty64.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH command failed (connection closed by remote host)
>>>>>> ----------------------
zlib(finalizer): the stream was freed prematurely.

Example playbook:


---
- name: Reboot server
  hosts: all
  tasks:
    - name: Reboot server
      command: shutdown -r now
      async: 0
      poll: 0
      sudo: yes

    - name: Wait for server to come back.
      local_action:
        module: wait_for
        host: "{{ ansible_ssh_host }}"
        port: "{{ ansible_ssh_port | default(22) }}"
        delay: 15
      sudo: false

    - name: Refresh host facts.
      action: setup

    - name: Print nonsense debugging task.
      debug:
        msg: Green is my favorite color.

Some of the roles I'm testing require a reboot (e.g. installing kernel updates) before running Serverspec. Can you suggest a workaround here?

conorsch commented 8 years ago

Dig some digging and realized this is an upstream issue. Found the issue you opened here: https://github.com/test-kitchen/test-kitchen/issues/769, @ahelal.

ahelal commented 8 years ago

I did not have a chance to dig deep into that. I just avoid reboot during the tests.

But I have not figured a way around that for now

ahelal commented 8 years ago

since its test-kitchen issue and the PR is pending https://github.com/test-kitchen/test-kitchen/pull/564

I will close this issue

nemonik commented 1 year ago

I'm still seeing this exact problem using

#encoding: utf-8
source 'https://rubygems.org'

gem 'rake', '13.0.6'
gem 'test-kitchen', '3.5.0'
gem 'test-kitchen', '3.5.0'
gem 'kitchen-ansiblepush', '0.11.0'
gem 'kitchen-ec2', '3.15.0'
gem 'inspec', '5.21.29'
gem 'kitchen-inspec', '2.6.1'
gem 'minitest', '5.18.0'

My playbook has a reboot... The instance reboots, the playbook continues, completes and an exception is promptly thrown with the following exception

#<Thread:0x0000ffff98e17a38 /home/me/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/test-kitchen-3.5.0/lib/kitchen/command.rb:164 run> terminated with exception (report_on_exception is true):
/home/me/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/net-ssh-7.1.0/lib/net/ssh/transport/packet_stream.rb:74:in `select': closed stream (IOError)

Any thoughts as to what I should do?