Bug 1286686 - Initial move of Treeherder-Tests into /selenium folder#2302
Bug 1286686 - Initial move of Treeherder-Tests into /selenium folder#2302edmorley merged 1 commit intomozilla:masterfrom
Conversation
|
Thank you for opening the PR. If the tests aren't actually run at all, should we wait to merge the PR until they are hooked up? It's just that there are lots of files in this PR that will be deleted straight away (eg |
|
Also the Travis run is failing. |
|
Hooking them up will require work outside of this PR, but this needs to come first. You have a point about the travis/gitignore/jenkinsfile - I thought I'd leave them in as placeholders. @davehunt what do you think? |
|
Sorry I should have asked: is the intention to convert them to tests that run on commit in Treeherder's Travis run, or are they still being run in Jenkins? |
|
I was originally thinking that we'd migrate the tests directly into the existing suite and get them running in Travis from the start. That said, moving the existing tests into this repository more-or-less untouched and continuing to run them in Jenkins is an interesting idea. It means the two suites would co-exist but in the same repository, making it easier to manage the migration than it would be between two independent repositories. I would suggest at least putting these beside the selenium folder instead of within it. This is because the 'selenium' folder is already being used in Travis, and adding content will likely introduce build failures (as has done here). Maybe we could put these into a 'jenkins' folder, and then migrate them one-by-one into the 'selenium' folder? Both of these could have associated Jenkins jobs during the migration. |
tests/selenium/.travis.yml
Outdated
| @@ -0,0 +1,10 @@ | |||
| language: python | |||
There was a problem hiding this comment.
Exclude this file as it's only used from the root of a repository, and Treeherder already has one that runs the appropriate linting and tests.
tests/selenium/LICENSE
Outdated
| @@ -0,0 +1,3 @@ | |||
| This Source Code Form is subject to the terms of the Mozilla Public | |||
There was a problem hiding this comment.
Exclude this file as it's covered by LICENSE.txt in the top level of the repo.
tests/selenium/README.md
Outdated
| @@ -0,0 +1,69 @@ | |||
| # Tests for Mozilla's Treeherder | |||
There was a problem hiding this comment.
Let's reword the README to the context of a director rather than a repository. Also, we can remove all the badges.
|
@davehunt please review when you get the chance. |
|
I'm not sure it makes sense to commit the jenkins specific files at all? |
These are still needed while we run the tests in Jenkins. Once they're migrated to the Travis CI builds, we can remove them. |
|
I had suggested using a sibling directory to 'selenium' so these tests are not attempted to be run by Travis CI (which is failing). |
|
See #2302 (comment) |
|
I mean that perhaps it would be better to leave the files in their original repo whilst they are still being run on jenkins, and only commit files here as and when they are converted to run in Travis. |
That would mean two active repositories. Also it means Jenkins would be checkout out treeherder-tests, and then also having to checkout treeherder. This isn't much of an issue, but the git revision would be for the test repo rather than the application repo. FWIW we're only talking about Jenkinsfile here. |
|
Sorry reading back, my responses have been a bit disjointed. Hopefully this is more complete :-) It seems like there are a few possible approaches:
Options 2/3 seem preferable for the reason that it makes it easier for someone to fix the tests up, since they are already in this repo. However option 3 clutters this repo with things that are going to be removed soon, and means having to change jenkins configs to point at this repo (so extra work). The only advantage I can see with option 3 is that it avoids divergence between the repositories, however since the treeherder-tests repo is (or should be IMO) feature-frozen, I don't think that makes any difference? As such, option 2 seemed the next best? Or am I overlooking something? :-) |
I think you've summed things up nicely. My concern over option 2 is that the tests will exist in both repositories concurrently. Whilst we're not planning to add any tests, if we encountered a failure we may need to fix or improve a test. This would either require two repositories to be updated, or for them as you say to become divergent. My personal order of preference would be option 1, followed closely by option 3, and then option 2. That said, I'm not actively working on this, so I'm happy for those that are to make the decision. What I would say is that we should at all costs avoid introducing tests in the Travis CI build until they are considered stable and unlikely to cause failures. |
|
Reading over the comments I would make this suggestion:
I'm happy to update this to do the above [outside of updating the Jenkins path which falls on @davehunt ] if this sounds like a decent plan. |
|
@edmorley - thumbs up on the suggestion above or should I schedule a meeting to chat about this? |
|
Sounds fine to me :-) |
|
Ready for review. |
edmorley
left a comment
There was a problem hiding this comment.
Many thanks for updating this :-)
Unfortunately the Travis run is failing (normally we wait until it's green before requesting review). If you need any help fixing it just say.
Also, could you adjust the commit message? eg:
https://groups.google.com/forum/#!topic/mozilla.dev.platform/qERnoJniCds
tests/jenkins/Jenkinsfile
Outdated
| SAUCELABS_API_KEY = credentials('SAUCELABS_API_KEY') | ||
| } | ||
| stages { | ||
| stage('Lint') { |
There was a problem hiding this comment.
Our Travis run already lints these files, so this can be removed :-)
tests/jenkins/README.md
Outdated
| @@ -0,0 +1,55 @@ | |||
| # Tests for Mozilla's Treeherder | |||
There was a problem hiding this comment.
I think we can just delete this file - most of it is no longer relevant - and the advice for contributing doesn't really make sense since the Jenkins files are now feature-frozen.
| @@ -0,0 +1 @@ | |||
| flake8==3.3.0 No newline at end of file | |||
tests/jenkins/.gitignore
Outdated
| @@ -0,0 +1,7 @@ | |||
| __pycache__ | |||
There was a problem hiding this comment.
The .gitignore in the root of the repo makes most of this redundant, and I believe even the "results" entry isn't needed, since people won't be running the Jenkins tests locally (and a dirty git directory doesn't matter in a one-off CI environment that gets deleted at end of run).
There was a problem hiding this comment.
Are you suggesting that I remove the entire file as it is redundant, or just certain lines?
There was a problem hiding this comment.
Ah sorry, the entire file
| @@ -0,0 +1,6 @@ | |||
| mozlog==3.4 | |||
There was a problem hiding this comment.
Let's move this from tests/jenkins/requirements/tests.txt to tests/jenkins/requirements.txt, since it will otherwise be the only file in the requirements directory.
Also, this will need a # pyup: ignore file on the first line of the file, or pyup-bot will very persistently try to update the dependencies in this file.
tests/jenkins/tox.ini
Outdated
| [testenv] | ||
| passenv = DISPLAY PYTEST_ADDOPTS PYTEST_BASE_URL SAUCELABS_API_KEY SAUCELABS_USERNAME \ | ||
| JENKINS_URL JOB_NAME BUILD_NUMBER | ||
| deps = -rrequirements/tests.txt |
There was a problem hiding this comment.
The path here will need adjusting to -rrequirements.txt after the rename.
tests/jenkins/tox.ini
Outdated
| --log-raw=results/{envname}.log \ | ||
| {posargs} | ||
|
|
||
| [testenv:flake8] |
There was a problem hiding this comment.
Let's remove the flake8 parts.
|
Sorry forgot to say - could you squash the commits too? :-) |
|
I'd suggest excluding the new jenkins folder from the python-linters job and adding |
4632ad8 to
b3a7922
Compare
|
I am guessing that my changes to the .travis.yml file have incorrect syntax :( |
.travis.yml
Outdated
| - source ~/venv/bin/activate | ||
| - pip install --disable-pip-version-check --upgrade pip==8.1.1 | ||
| exclude: | ||
| tests/jenkins/ |
There was a problem hiding this comment.
To exclude this you'll need to add the path to the setup.cfg file for pycodestyle, flake8, and isort.
.travis.yml
Outdated
| - ./bin/vendor-libmysqlclient.sh ~/venv | ||
| # Create the test database for `manage.py check --deploy`. | ||
| - mysql -u root -e 'create database test_treeherder;' | ||
| --ignore=tests/jenkins/ |
There was a problem hiding this comment.
This needs to be moved to the py.test command line in the script section. You'll see there's already arguments such as --ignore=tests/selenium/ so you just need to add another one for this path.
6eacc5b to
5d3cf5b
Compare
It's only isort that's failing now. Maybe there's something wrong with the skip syntax. I'll see if I can replicate it locally. Worst case is we fix up the few issues, which would be a necessary improvement for moving the code into the selenium directory anyway. |
|
It looks like we just need to remove the trailing forward slash on the skip value. |
setup.cfg
Outdated
|
|
||
| [isort] | ||
| skip = .git,__pycache__,.vagrant,node_modules,migrations | ||
| skip = .git,__pycache__,.vagrant,node_modules,migrations,tests/jenkins/ |
There was a problem hiding this comment.
It appears that the trailing / causes isort to not skip this directory. Probably to be consistent let's remove this from all appearances of this directory in the file.
There was a problem hiding this comment.
Yeah just adding ,jenkins should do the trick :-)
edmorley
left a comment
There was a problem hiding this comment.
Thank you for the updates - very close now! :-)
| page = TreeherderPage(selenium, base_url).open() | ||
| top_datestamp = page.result_sets[0].datestamp | ||
| bottom_datestamp = page.result_sets[9].datestamp | ||
| daterange = page.open_date_range(2016-05-06, 2016-05-07).open() |
There was a problem hiding this comment.
Should this date be a string instead?
There was a problem hiding this comment.
This test was from an old draft- so glad you caught this and the filter_by_date as the work was already in other tests. Deleted!
| end_date = page.result_sets[9].datestamp | ||
|
|
||
| assert not top_datestamp == start_date | ||
| assert not bottom_datestamp == end_date No newline at end of file |
There was a problem hiding this comment.
Missing end of file newline
tests/jenkins/tox.ini
Outdated
| @@ -0,0 +1,20 @@ | |||
| [tox] | |||
| skipsdist = true | |||
| envlist = py27, flake8 | |||
There was a problem hiding this comment.
I think the flake8 entry here is now no longer needed?
| @@ -0,0 +1,17 @@ | |||
| # This Source Code Form is subject to the terms of the Mozilla Public | |||
| # License, v. 2.0. If a copy of the MPL was not distributed with this | |||
| # file, You can obtain one at http://mozilla.org/MPL/2.0/. | |||
There was a problem hiding this comment.
We used to add the licence header to all files, however now that we have the licence file in the root of the repository this is no longer necessary, so we decided to remove it to avoid the boilerplate. Could you remove the header from all files?
4f7786e to
4e405f3
Compare
|
I wasn't sure if this was ready for re-review or not, but I took a look anyway. I think pretty much everything is addressed apart from a few files still having the licence headers? (see #2302 (comment)) With that fixed, we can get this merged :-) |
Updated README with notes about what needs to change Updated README, removed travis.yml and LICENSE files Created new jenkins folders to contain the treeherder-tests Removed duplicate lint, gitignore, updated requirements and tox files, and excluded new jenkins folder from Travis to avoid failing builds Moved exclude and ignore options for tests/jenkins so Travis will not fail Updated setup.cfg to pass Travis, removed unneeded license headers Removed extra headers and duplicate test
|
OK, I think it's officially ready for review! |
edmorley
left a comment
There was a problem hiding this comment.
Looks great - many thanks!
Moving the contents of the Treeherder-Tests repo into the /selenium folder. Tests will not run automatically, as Travis will need to be set up. This is just to get the content into the primary repo going forward so that the Treeherder-Tests repo can be decommissioned.
This change is