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

Remove DEBUG output from functional tests, fix test requirements, add VNC server #3817

Merged

Conversation

zenmonkeykstop
Copy link
Contributor

@zenmonkeykstop zenmonkeykstop commented Sep 13, 2018

Status

Ready for review

Description of Changes

Fixes #3698 , #3718

Changes proposed in this pull request:
This PR includes @msheiny's change to selenium's output level from DEBUG to WARNING, cherrypicked from commit a1f0134

It also includes an update to the test requirements file, to remove a duplicate entry for werkzeug that probably slipped in in a merge and was preventing the tests from running.

It also includes support for viewing functional tests in progress, using VNC on OSX and Debian workstations.

Testing

To verify that functional tests run and do not include DEBUG-level output, from the securedrop directory, run:

make build-debs
cd securedrop 
./bin/dev-shell ./bin/run-test -v tests/functional/

Docker build should complete without error, and tests should run without debug-level output (specifically not the base64-encoded firefox profile data)

To verify that VNC is set up and available, kick off the functional tests as above, and once the Docker container has started and the tests are in progress, run:

make func-vnc

The system's default VNC viewer should start, displaying the functional tests' browsers.

Checklist

If you made non-trivial code changes:

  • I have written a test plan and validated it for this PR

msheiny and others added 2 commits September 12, 2018 12:22
Originally was on DEBUG and was sending out mountains of output into the
pytest process which made it difficult to assess anything.

(cherry picked from commit a1f0134)
@redshiftzero
Copy link
Contributor

Now that torproject.org is back up, the next step is to update the version of Tor Browser on tbb-0.9.0 (let's add to this branch @zenmonkeykstop so we can get CI fixed).

@redshiftzero
Copy link
Contributor

Pushed two commits to get the docker builds working again, note I also updated the pax flags for Tor Browser 8 based on our private infrastructure repo

However we're hitting a new issue here which looks to be mozilla/geckodriver#913 likely due to the old version of geckodriver we are using. Indeed problems with Tor Browser 8 were reported over in webfp/tor-browser-selenium#105. Going to bump up versions of geckodriver (and Selenium if necessary) and see if that resolves...

@redshiftzero
Copy link
Contributor

ok my attempts to resolve this CI issue so far are in commit 8da014e in tb-8-ci (not pushing here in case we take another path). I'm at the point where I've updated geckodriver to 0.21.0, firefox-esr to latest (>=60 is required by geckodriver 0.21.0), but I'm hitting the following on the first functional test:

self = <httplib.HTTPResponse instance at 0x7fbdc8448cf8>

    def _read_status(self):
        # Initialize with Simple-Response defaults
        line = self.fp.readline(_MAXLINE + 1)
        if len(line) > _MAXLINE:
            raise LineTooLong("header line")
        if self.debuglevel > 0:
            print "reply:", repr(line)
        if not line:
            # Presumably, the server closed the connection before
            # sending a valid response.
>           raise BadStatusLine(line)
E           BadStatusLine: ''

/usr/lib/python2.7/httplib.py:408: BadStatusLine

@kushaldas
Copy link
Contributor

We should have the same version of firefox-esr which is being used by the Tor Browser.

@redshiftzero
Copy link
Contributor

yep, in 8da014e I am using Firefox ESR 60 which is what Tor Browser 8 is based on

@zenmonkeykstop
Copy link
Contributor Author

I tried updating to 8.0 last night as well; the teardown() function didn't seem to run between tests, so docker container ended up with a few dozen sets of firefox-esr,xvfb, and firefox.real processes, before running out of memory and giving up the ghost.

msheiny and others added 6 commits September 26, 2018 16:31
Basically installed this because it can be used with pyvirtualdisplay as
a backend AND because it brings in the Xvnc tooling which will start an
X11 server as well as a VNC server.
Had to remove x11 display logic inside test scaffolding (initially tried
to integrate it there but it kept building and destroying the VNC server
per test).

Made a VNC helper command with support for GNOME desktop and macOS (havent
tested it on mac yet). Updated the docs
10 seconds is way too short.. 160 seconds.. maybe too long? Fingers
crossed I can work with the team to get the wait_for logic running
Typically these actions were done manually but lets get our good old
friend ansible to run them for us (at least under the upgrade env).
@zenmonkeykstop
Copy link
Contributor Author

As per gitter, upgrading to geckodriver 0.22.0 seems to resolve this issue. The BadStatusLine messages are happening with 0.21.0 because it sets connection keep-alives to 5sec - this has been bumped to 90sec in 0.22.0.

@zenmonkeykstop
Copy link
Contributor Author

@msheiny stuck in a commit to skip pw prompt for remote-viewer. Works for me on Ubuntu but give it a lash on Debian?

Copy link
Contributor

@msheiny msheiny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 not only are you a great canadian.. but you have fixed this PR from certain doom.

@msheiny
Copy link
Contributor

msheiny commented Sep 27, 2018

errr wait .. failing tests.. take it thats a new problem?

@msheiny
Copy link
Contributor

msheiny commented Sep 27, 2018

im also getting the same failures locally that are happening in CI

such as this gem
SessionNotCreatedException: Message: Unable to find a matching set of capabilities

i see a few github tickets that possibly reference a pathing issue .. checking

Due to defect freedomofpress#3793, when using Firefox Quantum, the incorrect message
is displayed on the source interface. This test will not pass until that
is resolved.
@redshiftzero redshiftzero force-pushed the 3698-remove-debug-output branch from 107687b to a995fc8 Compare September 27, 2018 20:01
@redshiftzero
Copy link
Contributor

redshiftzero commented Sep 27, 2018

There is some wonky CI logic in the staging-test-with-rebase job:

  1. In the tbb-0.9.0 branch, we removed the application test run here.
  2. Meanwhile, in the develop branch, we removed the testinfra test run (in this commit).

During the rebase on latest develop, we didn't reconcile these two changes. This is why we see in CI output:

    TASK [Dump raw test output] ****************************************************
    fatal: [app-staging]: FAILED! => {"msg": "'raw_test_results' is undefined"}
    	to retry, use: --limit @/root/sd/molecule/aws/side_effect.retry

Keeping the logic here as we want junit test output nicely parsed
for the integration of the Tor Browser based tests we will
eventually have in CI
staging.yml is a concatenation of multiple other variables files,
one was updated during rebase, one was not.
@eloquence
Copy link
Member

I'm assuming this fully resolves #3718 as well? If so, please update PR description accordingly; thanks! :)

In CI we are getting MoveTargetOutOfBoundsException, but not locally.
We have had errors in the past due to different viewport sizes in CI
and locally, so setting this to a standard size for the pages layout
tests (where the exception is occurring).
@redshiftzero redshiftzero force-pushed the 3698-remove-debug-output branch from 2bda0e0 to 0071eaa Compare September 28, 2018 23:15
We were getting a NoAlertPresentException due to new behavior in
geckodriver [0] where interacting with the driver closes the modal.
Thus, we do not need to explicitly accept the modal here.

[0] mozilla/geckodriver#1171
@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (tbb-0.9.0@4dd2687). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             tbb-0.9.0    #3817   +/-   ##
============================================
  Coverage             ?   84.52%           
============================================
  Files                ?       43           
  Lines                ?     2720           
  Branches             ?      295           
============================================
  Hits                 ?     2299           
  Misses               ?      355           
  Partials             ?       66

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4dd2687...d87d58d. Read the comment docs.

@redshiftzero redshiftzero changed the title Remove DEBUG output from functional tests, fix test requirements Remove DEBUG output from functional tests, fix test requirements, add VNC server Sep 29, 2018
@redshiftzero
Copy link
Contributor

all tests passing here now... so merging

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

Successfully merging this pull request may close these issues.

6 participants