Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing the admin git operations fails #3845

Closed
heartsucker opened this issue Oct 4, 2018 · 1 comment
Closed

Testing the admin git operations fails #3845

heartsucker opened this issue Oct 4, 2018 · 1 comment

Comments

@heartsucker
Copy link
Contributor

Description

==================================== ERRORS ====================================
 ERROR at teardown of TestGitOperations.test_update_with_duplicate_branch_and_tag 

tmpdir = local('/tmp/pytest-of-root/pytest-0/test_update_with_duplicate_bra0')

    @pytest.fixture
    def securedrop_git_repo(tmpdir):
        os.chdir(str(tmpdir))
        # Clone the SecureDrop repository into the temp directory.
        cmd = ['git', 'clone',
               'https://github.com/freedomofpress/securedrop.git']
        subprocess.check_call(cmd)
        os.chdir(os.path.join(str(tmpdir), 'securedrop/admin'))
        subprocess.check_call('git reset --hard'.split())
        # Now we will put in our own git configuration
        with io.open('../.git/config', 'w') as fobj:
            fobj.write(GIT_CONFIG)
        # Let us move to an older tag
        subprocess.check_call('git checkout 0.6'.split())
        yield tmpdir
    
        # Save coverage information in same directory as unit test coverage
        test_name = str(tmpdir).split('/')[-1]
        subprocess.check_call(['cp',
                               '{}/securedrop/admin/.coverage'.format(
                                   str(tmpdir)),
                               '{}/../.coverage.{}'.format(CURRENT_DIR,
>                                                          test_name)])

/opt/tests/test_integration.py:475: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

popenargs = (['cp', '/tmp/pytest-of-root/pytest-0/test_update_with_duplicate_bra0/securedrop/admin/.coverage', '/opt/tests/../.coverage.test_update_with_duplicate_bra0'],)
kwargs = {}, retcode = 1
cmd = ['cp', '/tmp/pytest-of-root/pytest-0/test_update_with_duplicate_bra0/securedrop/admin/.coverage', '/opt/tests/../.coverage.test_update_with_duplicate_bra0']

    def check_call(*popenargs, **kwargs):
        """Run command with arguments.  Wait for command to complete.  If
        the exit code was zero then return, otherwise raise
        CalledProcessError.  The CalledProcessError object will have the
        return code in the returncode attribute.
    
        The arguments are the same as for the Popen constructor.  Example:
    
        check_call(["ls", "-l"])
        """
        retcode = call(*popenargs, **kwargs)
        if retcode:
            cmd = kwargs.get("args")
            if cmd is None:
                cmd = popenargs[0]
>           raise CalledProcessError(retcode, cmd)
E           CalledProcessError: Command '['cp', '/tmp/pytest-of-root/pytest-0/test_update_with_duplicate_bra0/securedrop/admin/.coverage', '/opt/tests/../.coverage.test_update_with_duplicate_bra0']' returned non-zero exit status 1

/usr/lib/python2.7/subprocess.py:186: CalledProcessError
---------------------------- Captured stdout setup -----------------------------
HEAD is now at 78990897 Merge pull request #3835 from zenmonkeykstop/3780-docs-update-testinfra
---------------------------- Captured stderr setup -----------------------------
Cloning into 'securedrop'...
Note: checking out '0.6'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 4cbab07f... SecureDrop 0.6
----------------------------- Captured stderr call -----------------------------
Switched to a new branch '0.9.1'
Note: checking out '0.6'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 4cbab07f... SecureDrop 0.6
------------------------------ Captured log call -------------------------------
connectionpool.py          824 DEBUG    Starting new HTTPS connection (1): api.github.com
connectionpool.py          396 DEBUG    https://api.github.com:443 "GET /repos/freedomofpress/securedrop/releases/latest HTTP/1.1" 200 None
--------------------------- Captured stderr teardown ---------------------------
cp: cannot stat '/tmp/pytest-of-root/pytest-0/test_update_with_duplicate_bra0/securedrop/admin/.coverage': No such file or directory
=================================== FAILURES ===================================
_________ TestGitOperations.test_update_with_duplicate_branch_and_tag __________

self = <test_integration.TestGitOperations instance at 0x7f4a6fa8dd40>
securedrop_git_repo = local('/tmp/pytest-of-root/pytest-0/test_update_with_duplicate_bra0')

    def test_update_with_duplicate_branch_and_tag(self,
                                                  securedrop_git_repo):
        gpgdir = os.path.join(os.path.expanduser('~'), '.gnupg')
        set_reliable_keyserver(gpgdir)
    
        github_url = 'https://api.github.com/repos/freedomofpress/securedrop/releases/latest'  # noqa: E501
        latest_release = requests.get(github_url).json()
        latest_tag = str(latest_release["tag_name"])
    
        # Create a branch with the same name as a tag.
        subprocess.check_call(['git', 'checkout', '-b', latest_tag])
        # Checkout the older tag again in preparation for the update.
        subprocess.check_call('git checkout 0.6'.split())
    
        cmd = os.path.join(os.path.dirname(CURRENT_DIR),
                           'securedrop_admin/__init__.py')
        ansible_base = os.path.join(str(securedrop_git_repo),
                                    'securedrop/install_files/ansible-base')
    
        child = pexpect.spawn('coverage run {0} --root {1} update'.format(
                              cmd, ansible_base))
>       output = child.read()

/opt/tests/test_integration.py:602: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/.tox/py2/local/lib/python2.7/site-packages/pexpect/spawnbase.py:441: in read
    self.expect(self.delimiter)
/opt/.tox/py2/local/lib/python2.7/site-packages/pexpect/spawnbase.py:341: in expect
    timeout, searchwindowsize, async_)
/opt/.tox/py2/local/lib/python2.7/site-packages/pexpect/spawnbase.py:369: in expect_list
    return exp.expect_loop(timeout)
/opt/.tox/py2/local/lib/python2.7/site-packages/pexpect/expect.py:119: in expect_loop
    return self.timeout(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pexpect.expect.Expecter object at 0x7f4a6f134f50>
err = TIMEOUT('Timeout exceeded.',)

    def timeout(self, err=None):
        spawn = self.spawn
    
        spawn.before = spawn.buffer
        spawn.after = TIMEOUT
        index = self.searcher.timeout_index
        if index >= 0:
            spawn.match = TIMEOUT
            spawn.match_index = index
            return index
        else:
            spawn.match = None
            spawn.match_index = None
            msg = str(spawn)
            msg += '\nsearcher: %s' % self.searcher
            if err is not None:
                msg = str(err) + '\n' + msg
>           raise TIMEOUT(msg)
E           TIMEOUT: Timeout exceeded.
E           <pexpect.pty_spawn.spawn object at 0x7f4a6f134a50>
E           command: /opt/.tox/py2/bin/coverage
E           args: ['/opt/.tox/py2/bin/coverage', 'run', '/opt/securedrop_admin/__init__.py', '--root', '/tmp/pytest-of-root/pytest-0/test_update_with_duplicate_bra0/securedrop/install_files/ansible-base', 'update']
E           buffer (last 100 chars): 'op updates...\r\nFetching origin\r\nINFO: Update needed\r\nINFO: Verifying signature on latest update...\r\n'
E           before (last 100 chars): 'op updates...\r\nFetching origin\r\nINFO: Update needed\r\nINFO: Verifying signature on latest update...\r\n'
E           after: <class 'pexpect.exceptions.TIMEOUT'>
E           match: None
E           match_index: None
E           exitstatus: None
E           flag_eof: False
E           pid: 559
E           child_fd: 14
E           closed: False
E           timeout: 30
E           delimiter: <class 'pexpect.exceptions.EOF'>
E           logfile: None
E           logfile_read: None
E           logfile_send: None
E           maxread: 2000
E           ignorecase: False
E           searchwindowsize: None
E           delaybeforesend: 0.05
E           delayafterclose: 0.1
E           delayafterterminate: 0.1
E           searcher: searcher_re:
E               0: EOF

/opt/.tox/py2/local/lib/python2.7/site-packages/pexpect/expect.py:82: TIMEOUT
---------------------------- Captured stdout setup -----------------------------
HEAD is now at 78990897 Merge pull request #3835 from zenmonkeykstop/3780-docs-update-testinfra
---------------------------- Captured stderr setup -----------------------------
Cloning into 'securedrop'...
Note: checking out '0.6'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 4cbab07f... SecureDrop 0.6
----------------------------- Captured stderr call -----------------------------
Switched to a new branch '0.9.1'
Note: checking out '0.6'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 4cbab07f... SecureDrop 0.6
------------------------------ Captured log call -------------------------------
connectionpool.py          824 DEBUG    Starting new HTTPS connection (1): api.github.com
connectionpool.py          396 DEBUG    https://api.github.com:443 "GET /repos/freedomofpress/securedrop/releases/latest HTTP/1.1" 200 None
================ 1 failed, 64 passed, 1 error in 106.42 seconds ================
ERROR: InvocationError: '/usr/bin/env /opt/.tox/py2/bin/coverage run --source=securedrop_admin,bootstrap /opt/.tox/py2/bin/py.test -v tests'
___________________________________ summary ____________________________________

Link: https://circleci.com/gh/freedomofpress/securedrop/18363

@redshiftzero
Copy link
Contributor

I think these are the same flakes as in #3814 and #3553

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants