Skip to content

Bug 1286686 - Initial move of Treeherder-Tests into /selenium folder#2302

Merged
edmorley merged 1 commit intomozilla:masterfrom
rbillings:selenium_tests
May 16, 2017
Merged

Bug 1286686 - Initial move of Treeherder-Tests into /selenium folder#2302
edmorley merged 1 commit intomozilla:masterfrom
rbillings:selenium_tests

Conversation

@rbillings
Copy link
Contributor

@rbillings rbillings commented Mar 29, 2017

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 Reviewable

@rbillings rbillings changed the title Initial move of Treeherder-Tests into /selenium folder 1286686 - Initial move of Treeherder-Tests into /selenium folder Mar 29, 2017
@edmorley edmorley changed the title 1286686 - Initial move of Treeherder-Tests into /selenium folder Bug 1286686 - Initial move of Treeherder-Tests into /selenium folder Mar 29, 2017
@edmorley
Copy link
Contributor

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 .travis.yml, .gitignore, Jenkinsfile and so on) so I don't think it makes sense to commit the non-python files to the repo in the first place.

@edmorley
Copy link
Contributor

Also the Travis run is failing.

@rbillings
Copy link
Contributor Author

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?

@edmorley
Copy link
Contributor

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?

@davehunt
Copy link
Member

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.

@@ -0,0 +1,10 @@
language: python
Copy link
Member

Choose a reason for hiding this comment

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

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.

@@ -0,0 +1,3 @@
This Source Code Form is subject to the terms of the Mozilla Public
Copy link
Member

Choose a reason for hiding this comment

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

Exclude this file as it's covered by LICENSE.txt in the top level of the repo.

@@ -0,0 +1,69 @@
# Tests for Mozilla's Treeherder
Copy link
Member

Choose a reason for hiding this comment

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

Let's reword the README to the context of a director rather than a repository. Also, we can remove all the badges.

@rbillings
Copy link
Contributor Author

@davehunt please review when you get the chance.

@edmorley
Copy link
Contributor

edmorley commented Apr 7, 2017

I'm not sure it makes sense to commit the jenkins specific files at all?

@davehunt
Copy link
Member

davehunt commented Apr 7, 2017

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.

@davehunt
Copy link
Member

davehunt commented Apr 7, 2017

I had suggested using a sibling directory to 'selenium' so these tests are not attempted to be run by Travis CI (which is failing).

@davehunt
Copy link
Member

davehunt commented Apr 7, 2017

See #2302 (comment)

@edmorley
Copy link
Contributor

edmorley commented Apr 7, 2017

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.

@davehunt
Copy link
Member

davehunt commented Apr 7, 2017

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.

@edmorley
Copy link
Contributor

edmorley commented Apr 7, 2017

Sorry reading back, my responses have been a bit disjointed. Hopefully this is more complete :-)

It seems like there are a few possible approaches:

  1. Keep running on jenkins from the original repo for now, and only commit individual test files here once converted and running in Travis.
  2. Keep running on jenkins from the original repo for now, but still commit the test-only files here (but disabled, so they won't be running in Travis). Later the tests in this repo will be fixed/enabled on Travis, and the jenkins jobs stopped.
  3. Move everything to this repo now and point jenkins at this repo instead of the original one. None of the tests will run in Travis initially, since the files will be in an excluded directory. Later they will be moved over to Travis and the jenkins jobs stopped.

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? :-)

@davehunt
Copy link
Member

davehunt commented Apr 7, 2017

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.

@rbillings
Copy link
Contributor Author

Reading over the comments I would make this suggestion:

  • Move all of the treeherder-repo + Jenkins files into a new folder "jenkins" outside of /selenium so Travis won't fail.
  • Update the Jenkins path to run from the new folder- a minimal amount of work to update the path, so that tests can continue to run from this repo & not have two separate active repos
  • Move tests back into the /selenium folder in the future as they are updated to work with Travis [future PRs]

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.

@rbillings
Copy link
Contributor Author

@edmorley - thumbs up on the suggestion above or should I schedule a meeting to chat about this?

@edmorley
Copy link
Contributor

Sounds fine to me :-)

@rbillings
Copy link
Contributor Author

Ready for review.

Copy link
Contributor

@edmorley edmorley left a comment

Choose a reason for hiding this comment

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

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

SAUCELABS_API_KEY = credentials('SAUCELABS_API_KEY')
}
stages {
stage('Lint') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Our Travis run already lints these files, so this can be removed :-)

@@ -0,0 +1,55 @@
# Tests for Mozilla's Treeherder
Copy link
Contributor

Choose a reason for hiding this comment

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

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
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be removed

@@ -0,0 +1,7 @@
__pycache__
Copy link
Contributor

Choose a reason for hiding this comment

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

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).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you suggesting that I remove the entire file as it is redundant, or just certain lines?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah sorry, the entire file

@@ -0,0 +1,6 @@
mozlog==3.4
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

[testenv]
passenv = DISPLAY PYTEST_ADDOPTS PYTEST_BASE_URL SAUCELABS_API_KEY SAUCELABS_USERNAME \
JENKINS_URL JOB_NAME BUILD_NUMBER
deps = -rrequirements/tests.txt
Copy link
Contributor

Choose a reason for hiding this comment

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

The path here will need adjusting to -rrequirements.txt after the rename.

--log-raw=results/{envname}.log \
{posargs}

[testenv:flake8]
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's remove the flake8 parts.

@edmorley
Copy link
Contributor

Sorry forgot to say - could you squash the commits too? :-)

@davehunt
Copy link
Member

I'd suggest excluding the new jenkins folder from the python-linters job and adding --ignore=tests/jenkins/ to the python-tests-main job in Travis. As we move the tests into the selenium folder we'll need to ensure they abide by the linting rules.

@rbillings
Copy link
Contributor Author

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/
Copy link
Member

Choose a reason for hiding this comment

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

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/
Copy link
Member

Choose a reason for hiding this comment

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

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.

@davehunt
Copy link
Member

I am guessing that my changes to the .travis.yml file have incorrect syntax :(

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.

@davehunt
Copy link
Member

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/
Copy link
Member

Choose a reason for hiding this comment

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

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah just adding ,jenkins should do the trick :-)

Copy link
Contributor

@edmorley edmorley left a comment

Choose a reason for hiding this comment

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

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()
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this date be a string instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing end of file newline

@@ -0,0 +1,20 @@
[tox]
skipsdist = true
envlist = py27, flake8
Copy link
Contributor

Choose a reason for hiding this comment

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

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/.
Copy link
Contributor

Choose a reason for hiding this comment

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

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?

@edmorley
Copy link
Contributor

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
@rbillings
Copy link
Contributor Author

OK, I think it's officially ready for review!

Copy link
Contributor

@edmorley edmorley left a comment

Choose a reason for hiding this comment

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

Looks great - many thanks!

@edmorley edmorley merged commit 1d1f651 into mozilla:master May 16, 2017
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.

3 participants