ianmiell / shutit

Automation framework for programmers
http://ianmiell.github.io/shutit/
MIT License
2.15k stars 110 forks source link

shutit testing mode #266

Closed ianmiell closed 8 years ago

ianmiell commented 8 years ago
ianmiell commented 8 years ago

TODO: force debug down / quiet mode TODO: bug testing with git-101-tutorial (simple run-through)

ianmiell commented 8 years ago

Type mismatch on passed-in value:

HERE2 - same?
host_child
<pexpect.pty_spawn.spawn object at 0x7f60eecc0ed0>
    conn_module.setup_target_child(shutit, target_child)
  File "/usr/local/lib/python2.7/dist-packages/shutit_setup.py", line 68, in setup_target_child
    shutit_pexpect_session = shutit.get_shutit_pexpect_session_from_id(target_child_id)
  File "/usr/local/lib/python2.7/dist-packages/shutit_global.py", line 1942, in get_shutit_pexpect_session_from_id
    return shutit.fail('Should not get here in get_shutit_pexpect_session_from_id',throw_exception=True)
  File "/usr/local/lib/python2.7/dist-packages/shutit_global.py", line 207, in fail
    raise ShutItFailException(msg)

from code:


    def get_shutit_pexpect_session_from_id(self, shutit_pexpect_id):                                                                                                                                          
        """                                                                                                                                                                                                   
        """                                                                                                                                                                                                   
        print '================================================================================='                                                                                                             
        print 'HERE'                                                                                                                                                                                          
        print shutit_pexpect_id                                                                                                                                                                               
        print self.shutit_pexpect_sessions                                                                                                                                                                    
        print '================================================================================='                                                                                                             
        for key in self.shutit_pexpect_sessions:                                                                                                                                                              
            print '================================================================================='                                                                                                         
            print 'HERE2 - same?'                                                                                                                                                                             
            print self.shutit_pexpect_sessions[key].pexpect_session_id                                                                                                                                        
            print shutit_pexpect_id                                                                                                                                                                           
            print '================================================================================='                                                                                                         
            if self.shutit_pexpect_sessions[key].pexpect_session_id == shutit_pexpect_id:                                                                                                                     
                return self.shutit_pexpect_sessions[key]                                                                                                                                                      
        return shutit.fail('Should not get here in get_shutit_pexpect_session_from_id',throw_exception=True)     
ianmiell commented 8 years ago

Full stack trace:

Traceback (most recent call last):
  File "/usr/local/bin/shutit", line 9, in <module>
    load_entry_point('shutit==0.9.218', 'console_scripts', 'shutit')()
  File "/usr/local/lib/python2.7/dist-packages/shutit_main.py", line 609, in main
    do_build()
  File "/usr/local/lib/python2.7/dist-packages/shutit_main.py", line 421, in do_build
    build_module(module)
  File "/usr/local/lib/python2.7/dist-packages/shutit_main.py", line 362, in build_module
    if not module.build(shutit):
  File "/usr/local/lib/python2.7/dist-packages/shutit_module.py", line 59, in wrapper
    ret = func(self, shutit)
  File "/space/git/git-101-tutorial/git_101_tutorial.py", line 27, in build
    'ok_container_name':'imiell/git-101-tutorial:step_4'
  File "/usr/local/lib/python2.7/dist-packages/shutit_global.py", line 378, in challenge
    follow_on_context=follow_on_context)
  File "/usr/local/lib/python2.7/dist-packages/shutit_pexpect.py", line 2634, in challenge
    self._challenge_done(result='ok',follow_on_context=follow_on_context,congratulations=congratulations,skipped=skipped)
  File "/usr/local/lib/python2.7/dist-packages/shutit_pexpect.py", line 2423, in _challenge_done
    self.replace_container(container_name)
  File "/usr/local/lib/python2.7/dist-packages/shutit_pexpect.py", line 373, in replace_container
    conn_module.setup_target_child(shutit, target_child)
  File "/usr/local/lib/python2.7/dist-packages/shutit_setup.py", line 68, in setup_target_child
    shutit_pexpect_session = shutit.get_shutit_pexpect_session_from_id(target_child_id)
  File "/usr/local/lib/python2.7/dist-packages/shutit_global.py", line 1942, in get_shutit_pexpect_session_from_id
    return shutit.fail('Should not get here in get_shutit_pexpect_session_from_id',throw_exception=True)
  File "/usr/local/lib/python2.7/dist-packages/shutit_global.py", line 207, in fail
    raise ShutItFailException(msg)
shutit_module.ShutItFailException: Should not get here in get_shutit_pexpect_session_from_id

Type mismatch:

2016-09-28 19:41:17,421 INFO: Downloading image, please be patient
Traceback (most recent call last):
  File "/usr/local/bin/shutit", line 9, in <module>
    load_entry_point('shutit==0.9.218', 'console_scripts', 'shutit')()
  File "/usr/local/lib/python2.7/dist-packages/shutit_main.py", line 609, in main
    do_build()
  File "/usr/local/lib/python2.7/dist-packages/shutit_main.py", line 421, in do_build
    build_module(module)
  File "/usr/local/lib/python2.7/dist-packages/shutit_main.py", line 362, in build_module
    if not module.build(shutit):
  File "/usr/local/lib/python2.7/dist-packages/shutit_module.py", line 59, in wrapper
    ret = func(self, shutit)
  File "/space/git/git-101-tutorial/git_101_tutorial.py", line 27, in build
    'ok_container_name':'imiell/git-101-tutorial:step_4'
  File "/usr/local/lib/python2.7/dist-packages/shutit_global.py", line 378, in challenge
    follow_on_context=follow_on_context)
  File "/usr/local/lib/python2.7/dist-packages/shutit_pexpect.py", line 2635, in challenge
    self._challenge_done(result='ok',follow_on_context=follow_on_context,congratulations=congratulations,skipped=skipped)
  File "/usr/local/lib/python2.7/dist-packages/shutit_pexpect.py", line 2424, in _challenge_done
    self.replace_container(container_name)
  File "/usr/local/lib/python2.7/dist-packages/shutit_pexpect.py", line 373, in replace_container
    print 'AHHHHHHHHHHHHHHHHH ' + target_child
TypeError: cannot concatenate 'str' and 'spawn' objects
ianmiell commented 8 years ago

g now fails

Configure git to tell it who you are (user.name and user.email). Don't forget that CTRL-h will give you hints.

Hit CTRL-h for help, CTRL-g to reset state, CTRL-s to skip
2016-09-29 10:21:38,900 INFO: State submitted, checking your work...
Traceback (most recent call last):
  File "/usr/local/bin/shutit", line 9, in <module>
    load_entry_point('shutit==0.9.219', 'console_scripts', 'shutit')()
  File "/usr/local/lib/python2.7/dist-packages/shutit_main.py", line 609, in main
    do_build()
  File "/usr/local/lib/python2.7/dist-packages/shutit_main.py", line 421, in do_build
    build_module(module)
  File "/usr/local/lib/python2.7/dist-packages/shutit_main.py", line 362, in build_module
    if not module.build(shutit):
  File "/usr/local/lib/python2.7/dist-packages/shutit_module.py", line 59, in wrapper
    ret = func(self, shutit)
  File "/space/git/git-101-tutorial/git_101_tutorial.py", line 40, in build
    'ok_container_name':'imiell/git-101-tutorial:step_5'
  File "/usr/local/lib/python2.7/dist-packages/shutit_global.py", line 385, in challenge
    follow_on_context=follow_on_context)
  File "/usr/local/lib/python2.7/dist-packages/shutit_pexpect.py", line 2615, in challenge
    follow_on_context=follow_on_context
  File "/usr/local/lib/python2.7/dist-packages/shutit_pexpect.py", line 2627, in challenge
    output = self.send_and_get_output(check_command,timeout=timeout,retry=1,record_command=record_command,echo=False, loglevel=loglevel, fail_on_empty_before=False, preserve_newline=preserve_newline, delaybeforesend=delaybeforesend)
  File "/usr/local/lib/python2.7/dist-packages/shutit_pexpect.py", line 1392, in send_and_get_output
    self.send(shutit_util.get_send_command(send), check_exit=False, retry=retry, echo=echo, timeout=timeout, record_command=record_command, loglevel=loglevel, fail_on_empty_before=fail_on_empty_before, delaybeforesend=delaybeforesend)
  File "/usr/local/lib/python2.7/dist-packages/shutit_pexpect.py", line 2208, in send
    self.sendline(send,delaybeforesend=delaybeforesend)
  File "/usr/local/lib/python2.7/dist-packages/shutit_pexpect.py", line 349, in sendline
    self.pexpect_send(string+'\n',delaybeforesend=delaybeforesend)
  File "/usr/local/lib/python2.7/dist-packages/shutit_pexpect.py", line 343, in pexpect_send
    self.pexpect_child.send(string)
  File "/usr/local/lib/python2.7/dist-packages/pexpect/pty_spawn.py", line 526, in send
    return os.write(self.child_fd, b)
OSError: [Errno 9] Bad file descriptor
ianmiell commented 8 years ago

CTRL-g doesn't replace the container properly, ie it is still looking for the old one and fails to interact on a -1 file descriptor

ianmiell commented 8 years ago

Specifically, it appears to be a difference between calling _challenge_done with 'ok' results vs 'reset'. suggest trying to make them work the same way, then change one thing at a time.

ianmiell commented 8 years ago

Resolved this.