Граф коммитов

1679 Коммитов

Автор SHA1 Сообщение Дата
Ed Morley 48a4c1a0b3 Bug 1529223 - Tests: Clean up user fixtures
Since:
* They don't need to use the slower `transactional_db` fixture that has
  advanced transaction-inspecting support.
* They don't need to add a request finalizer, since the `db` fixture
  cleans up the User during test teardown automatically.
* `User` does not need to be imported locally.

This speeds up `test_auth.py` by 4x.
2019-02-25 20:16:59 +00:00
Ed Morley 8253f9991b Bug 1529223 - Tests: Correct name/description for test_login_no_email
Since the name/description references the pre-auth0 implementation that
was removed in #3144. The `test_user` fixture has also been removed,
since it is not required for the test to run (the error referenced in
the comment no longer occurs).
2019-02-25 20:16:59 +00:00
Ed Morley d9de41bf4b
Bug 1270157 - Convert the report-only CSP header to the real thing (#4687)
The latest policy used in the report-only header has been working well
on production (the violation reports logged to New Relic are only from
scripts injected by browser addons), so we're ready to start enforcing
the policy by using the real `Content-Security-Policy` header name.

NB: When features are added in the future, PR authors and reviewers will
need to remember to update the policy if needed (for example to add domains
to the `connect-src` directive). The CSP header is not enabled when using
`webpack-dev-server` (it would break dev source maps and react-hot-loader)
so if in doubt test locally (using `yarn build` and serving via Django
runserver) or on prototype first.

See:
https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
2019-02-25 19:47:45 +00:00
Ed Morley 52d6017c5b
Bug 1295997 - Skip parsing logs whose compressed size exceeds 5MB (#4700)
Occasionally failing build/test runs can fail in such a way that results
in a significant amount of log spam and therefore log files that are
hundreds of MB in size each. This can cause log parsing backlogs,
particularly when many jobs on the same push fail in such a way.

The log parser now checks the `Content-Length` of log files prior to
streaming them, and skips the download/parse if it exceeds the set
threshold. The frontend has been adjusted to display an appropriate
message explaining why the parsed log is not available.

The threshold has been set to 5MB, since:
* the 99th percentile of download size on New Relic was ~2.8MB:
  https://insights.newrelic.com/accounts/677903/dashboards/339080
* `Content-Length` is the size of the log prior to decompression, and
  the chronic logspam cases have been known to have compression ratios
  of 20-50x, which would translate to an uncompressed size limit of
  up to 250MB (which is already much larger than buildbot's former 50MB
  uncompressed size limit).
2019-02-25 19:04:38 +00:00
Sarah Clements 5a47eca3c3
Add tests for Perfherder's compare table using react-testing-library (#4647) 2019-02-24 15:37:11 -08:00
Ed Morley ecabd76f96
Bug 1453837 - Use correct value for id token expiry in auth tests (#4667)
The id token payload contains an `exp` property, which is an integer
representing the number of seconds past the epoch at which the id token
expires.

However the mocked value in our authentication tests was the string `'500'`,
which is neither the correct data type, nor a timestamp. This meant that
during tests only, the `min(accesstoken_exp_in_ms, idtoken_exp_in_ms)`
in `AuthBackend.authenticate()` was comparing an int and a string, which
under Python 3 results in:

`TypeError: '<' not supported between instances of 'str' and 'int'`

A later bug/PR will refactor the auth backend to fix issues unrelated to
Python 3 compatibility and add more test coverage.
2019-02-22 13:50:01 +00:00
Ed Morley 7833ba2bb7 Bug 1270157 - Update the report-only CSP header
Makes the following changes to the initial header added in #4678:

1) Adds a `frame-src` directive

Whilst the Auth0 domain is already whitelisted in `connect-src` allowing
initial logins to work, Auth0.js renewals are performed in an iframe, so
need both the auth0 domain and `'self'` (for the `/login.html` callback)
to be permitted via `frame-src`.

2) Adds https://taskcluster-artifacts.net to `connect-src`

Since some requests to `queue.taskcluster.net` redirect to it (eg for the
"Add new jobs" feature), and for redirects both the original and new domain
need whitelisting.

3) Adds `'report-sample'` to `script-src` and `style-src`, which makes
the browser send JS/CSS samples for any violations of the "inline" rules,
making it easier to debug collected CSP violation reports.
2019-02-22 12:17:33 +00:00
ionutgoldan d7e3f7636d
Bug 1529270 - Rename alert summaries last_updated field to created 2019-02-22 11:31:15 +02:00
Ed Morley 5b7209be29
Bug 1270157 - Add a report-only CSP header and report collection API (#4678)
This adds a `Content-Security-Policy-Report-Only` header for static assets
served by WhiteNoise (such as our frontend), which includes a first pass
at a possible policy that should work for Treeherder.

The header also includes a `report-uri` directive, which points at a newly
added API for collecting CSP violation reports. Reports are logged as
warnings (so will appear in Papertrail) and sent to New Relic as a custom
event. This will allow us to see whether the policy would block valid
requests, so we can refine it prior to converting to the real (ie blocks
things) `Content-Security-Policy` header.

The addition of `ng-csp` to `perf.html` is to enable AngularJS's ngCSP
feature, which turns off use of `eval()` and automatic stylesheet
injection, so that the policy directives `unsafe-eval` and
`unsafe-inline` don't have to be used. This requires us to then manually
import the AngularJS stylesheet to include the styles that would have
previously been injected:
https://docs.angularjs.org/api/ng/directive/ngCsp

See:
https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
2019-02-22 06:48:12 +00:00
Ed Morley 4fe1fa89fb
Bug 1528833 - Remove obsolete TreeherderClient methods (#4662)
* `get_resultsets()` has been deprecated for some time
* the other methods being removed are for API endpoints that no longer
  exist after #3222 (bug 1437968)
2019-02-20 06:53:26 +00:00
Ed Morley f6ecbdd8b6
Bug 1528811 - Remove job-collection related classes from thclient (#4661)
These were formerly used when submitting job data using the Python client
(support for which was removed in bug 1349182), and in `buildapi.py` as
part of buildbot ingestion (until #4087 / bug 1443251).

This removes the final usages in our tests so we can drop them entirely.
2019-02-20 06:49:54 +00:00
Ed Morley 681cc6d54f Bug 1527868 - Update tests to handle Elasticsearch not being configured
Whilst Treeherder itself correctly handled `ELASTICSEARCH_URL` not being
set, the tests were dependant on the availability of Elasticsearch.
2019-02-14 21:10:21 +00:00
Ed Morley e1ebb72c1d Bug 1526743 - Clean up log parsing test utilities
Previously any exceptions raised whilst loading the expected output JSON
fixtures were suppressed, which made debugging the Python 3 test failures
harder than needs be.

The reason failures were suppressed was to allow the test to continue far
enough that the actual output could be saved to the fixture when creating
new tests. However reordering `do_test()` has the same effect without the
need for the `load_exp()` try-except handling.
2019-02-12 20:00:16 +00:00
Ed Morley 4bdf9f9101 Bug 1526743 - Explicitly .decode() streamed log lines
Since the `request` package's `iter_lines()` returns bytes by default.

We cannot pass `decode_unicode=True` to `iter_lines()` since it splits on
Unicode newlines (which can exist in test message output), so instead we
manually `.decode()` each line before parsing it.

Fixes the following exception under Python 3:
`TypeError: a bytes-like object is required, not 'str'`

The test utility `load_exp()` had to be modified to no longer use append
mode when opening the expected output JSON files, in order to fix:
`json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)`
2019-02-12 20:00:16 +00:00
Cameron Dawson deb71d65e0 Bug 1364045 - Convert all unit tests to Jest (#4603)
Also remove all Karma support and update the docs to only mention ``Jest``.

One of the test files was testing some AngularJS filters. I converted these
tests to test the equivalent helper functions.
2019-02-12 07:49:50 +00:00
Ed Morley 7060eef007
Bug 1527020 - Travis: Enable unit tests under Python 3 (#4619)
To help prevent regressions whilst the remaining xfailed tests are fixed.
2019-02-11 20:31:20 +00:00
Ed Morley 8b678c9758 Bug 1453967 - Add tests to ensure job/perf hashes remain consistent 2019-02-11 17:55:26 +00:00
Ed Morley 7f3e41f712
Bug 1526763 - Remove `.encode()` from test_load_non_ascii_textlog_errors (#4617)
Since by design `.encode()` returns bytes, whereas the test should be using
a string. The goal of the encode seems to have been to handle unicode
correctly, however that's now achieved via the use of:
`from __future__ import unicode_literals`

Fixes the following exception under Python 3:
`TypeError: Object of type bytes is not JSON serializable`
2019-02-11 17:51:48 +00:00
Ed Morley 468bbd1df4
Bug 1526764 - Make test_intermittents_commenter pass under Python 3 (#4615)
* Switches from `.iteritems()` to `.items()` in the Jinja template.
* Removes an assert from `test_intermittents_commenter` that is redundant
  (due to `match_querystring=True`) and non-deterministic across Python
  versions (due to the query string params being affected by dict order).
2019-02-11 17:51:15 +00:00
Ed Morley 4eafa613ab
Bug 1526682 - Remove Python 3 incompatible usage of filter() (#4606)
Python 3's `filter()` now return iterators rather than list/..., so must
be cast back to a `list()` if used in contexts where an iterator is not
supported. However in this case `first` fulfils the goal more cleanly.

Fixes:
`TypeError: 'filter' object is not subscriptable`
2019-02-11 15:16:04 +00:00
Ed Morley 35c9fd9fd8 Bug 1513486 - Simplify _taskcluster_runnable_jobs()
The `decision_task_id` parameter has been removed since it's no longer used.
2019-02-08 18:53:58 +00:00
Ed Morley 9c3985a2e7 Bug 1513486 - Flatten list_runnable_jobs() return value
None of the callers use anything but the `results` property, so the other
properties have been removed.
2019-02-08 18:53:58 +00:00
Ed Morley 6483b387c8 Bug 1513486 - Remove RunnableJobsClient
Since it's never called with the `task_id` parameter, and when the task ID
is not set, the return value is identical to calling `list_runnable_jobs`
directly.
2019-02-08 18:53:58 +00:00
Ed Morley a9aa1d5a27 Bug 1513486 - Remove /runnable_jobs/ API
Since it's only used by the frontend as a fallback for when it cannot
find a non-gzipped version of `runnable-jobs.json`, and enough time has
now passed for all jobs to have that file.
2019-02-08 18:53:58 +00:00
Cameron Dawson 9498ac526a Bug 1364045 - Convert the groups unit tests to Jest 2019-02-07 17:08:16 -08:00
Sebastian Hengst dd3e0f33a1 Bug 1523772 - Add 'regression' keyword to new bugs filed with bugfiler (#4541) 2019-02-01 18:46:14 +00:00
Cameron Dawson 30bcd440c4
Bug 1306707 - Search for push without startswith when 40 chars (#4534) 2019-02-01 10:43:58 -08:00
Cameron Dawson c32f673bfc
Switch front-end to use /push/ endpoint (#4514) 2019-01-29 09:33:22 -08:00
Cameron Dawson 646e716a6a
Bug 1364045 - Convert the revisions unit tests to Jest (#4495) 2019-01-28 09:41:59 -08:00
Ed Morley fdb62a6243 Bug 1522101 - Use two-space indent when generating sample data JSON
So that future generated JSON sample data matches the Prettier style.
2019-01-23 20:19:04 +00:00
Ed Morley 4cfdae3f41 Bug 1522101 - Use Prettier to format JSON 2019-01-23 20:19:04 +00:00
KWierso 62b8879bcd Bug 1519139 - Add "#[markdown(off)]" to bugfiler comments (#4468)
Bugzilla recently started parsing markdown in bug comments. This was
causing some issues for bugs filed with Treeherder's bug filer because
text was unintentionally being parsed as markdown.

This patch just adds a "#[markdown(off)]" to the beginning of the
comment field, which lets the comment escape being parsed as markdown.
2019-01-18 09:24:08 +00:00
Cameron Dawson 7a48bbc575
Bug 1493833 - Fix ESLint errors with import/no-cycle (#4451) 2019-01-14 08:30:51 -08:00
Sarah Clements fbb60958cd
Bug 1505796 - improve perfherder compare performance (#4414)
create new endoint `performance/summary/` and update queries
in compare and compare subtest controllers
2019-01-11 09:47:05 -08:00
Cameron Dawson 33921b52fd
Bug 1514668 - Use shared LogoMenu across IFV and Perfherder (#4435)
Also convert LogoMenu.jsx to Reactstrap dropdown and use it in IFV navbar
2019-01-10 10:15:56 -08:00
Hassan Ali 45b2493d06 Bug 1518608 - Recognize FirefoxAccount logins (#4436) 2019-01-09 15:43:01 +00:00
Kartikaya Gupta (kats) d40959ee53 Bug 1512676 - Match some bash startup errors from run-task as errors lines (#4434) 2019-01-08 19:16:09 +00:00
pyup.io bot 1ed4969df6 Update pytest to 4.1.0 (#4427)
And use 'match' instead of 'message' with pytest.raises(), since the
former is actually what we should have been using all along.

See:
https://github.com/pytest-dev/pytest/issues/3974
2019-01-08 11:04:57 +00:00
Kartikaya Gupta (kats) ebe9db4b7c Bug 1517264 - Treat wrench jobs as reftests. (#4412)
Wrench jobs are a job type for the standalone WebRender test suite, and
run reftests as part of the job. Having reftest-ish things like the
reftest analyzer links for these jobs is desirable.
2019-01-03 09:42:15 -08:00
pyup.io bot a726b5ee28 Update redis to 3.0.1 (#4310)
And explicitly disable redis-py TLS validation to restore the validation
behaviour back to how it was with redis-py v2, since Heroku Redis uses
self-signed certificates so connections to it will fail if validation
is enabled. This resolves the issue seen in bug 1510000.
2019-01-03 10:33:37 +00:00
Cameron Dawson 6eeff4bafe
Bug 1513601 - Fix/enable ESLint 'react/button-has-type' (#4377)
Also make tests less brittle
2018-12-18 14:22:32 -08:00
Simon Sapin 84d92b43e4 Bug 1513715 - Support associating a "repository" with multiple GitHub branches (#4371)
* Add a test for a multi-branch repository
* Disable servo-try-taskcluster
2018-12-18 14:12:56 -08:00
Ed Morley 0009e7fa50 Bug 1514720 - Stop using jasmine-jquery JSON fixtures support
Since it's unnecessary given that we now have the ability to import JSON
directly, and the current usage is causing ESLint warnings like:

```
warning: Illegal usage of jasmine global (jest/no-jasmine-globals) at tests/ui/unit/context/pushes.tests.jsx:15:5:
  13 |
  14 |   beforeEach(() => {
> 15 |     jasmine.getJSONFixtures().fixturesPath = 'base/tests/ui/mock';
     |     ^
  16 |
  17 |     fetchMock.get(
  18 |       getProjectUrl('/resultset/?full=true&count=10', repoName),
```

This means the only `jasmine-jquery` feature we're now using is the
`toHaveLength` matcher, so use of `jasmine-jquery` can be dropped entirely
once the tests are migrated to Jest, which supports `toHaveLength`
natively.
2018-12-17 20:11:57 +00:00
Cameron Dawson 5e8377a3ff
Bug 1364045 - Introduce Jest unit tests (#4369) 2018-12-13 08:24:52 -08:00
Simon Sapin dbfc2afcbf Fix import of force-pushes from github (#4284)
When `git push -f` is used, the "base" commit of the github push event
is whatever was previously in that branch.
That commit is likely not part of the history of the new branch,
so using the "List commits" API will not allow to find it
as a starting point.
Instead, if the API did not force pagination, we’d get the entire
repository history!

Using the "Compare two commits" API instead lets GitHub’s server
figure out which commits reachable from the new branch
that were not before, which is exactly the set of commits we need
to be "part of a push".
2018-11-16 12:36:05 -08:00
Ed Morley 65b7f4ab45
Bug 1507172 - Use Prettier for formatting JS/JSX (#4276)
Since it's more reliable (and strict) at code formatting than ESLint.
We use it via an ESLint plugin, and so disable the style-related AirBnB
preset rules, leaving the AirBnB guide to handle only correctness and
best practices rules.

It's highly encouraged to use an IDE integration or Git commit hook
to run Prettier (or `yarn lint --fix`) automatically. See:
* https://prettier.io/docs/en/editors.html
* https://prettier.io/docs/en/precommit.html

We may consider enabling a git commit hook out of the box (using eg
Husky) in the future, however they have previously been known to
interfere with partial-staging workflows, so would need to test the
fixes they have made for them thoroughly first.

In future PRs we may also want to start formatting JSON/CSS/Markdown
using Prettier too.
2018-11-16 08:28:34 +00:00
Cameron Dawson a9c2dedf0a
Bug 1506424 - Fix logic to unselect job by clicking open areas (#4269) 2018-11-14 08:27:46 -08:00
ionutgoldan 9168eba8e8 Bug 1431085 - Increase max length of PerformanceSignature.extra_options (#4238) 2018-11-14 09:22:11 +00:00
Ed Morley 70e15b8334 Bug 1505758 - Fix/enable ESLint 'prefer-arrow-callback'
https://eslint.org/docs/rules/prefer-arrow-callback
2018-11-08 16:27:37 +00:00
Ed Morley ec87836e3b Bug 1505758 - Fix/enable ESLint 'prefer-destructuring'
https://eslint.org/docs/rules/prefer-destructuring
2018-11-08 16:27:37 +00:00
Ed Morley dd0165c0e0 Bug 1505758 - Fix/enable ESLint 'no-restricted-globals'
https://eslint.org/docs/rules/no-restricted-globals
2018-11-08 16:27:37 +00:00
Ed Morley 565ae4c13e
Bug 1364894 - Upgrade from Neutrino 4 to 9 (#4216)
Neutrino controls our frontend linting, transpilation, source-maps,
testing, dev-server and optimisation of production builds.

Highlights of the upgrade are:

* Major version updates to the individual tools within (such as webpack,
  Babel and ESLint), significantly improving performance, fixing
  transpilation/minification correctness bugs, adding support for newer
  ECMAScript features, and increasing linter coverage.
* Hot reloading in the dev server now works for all entry-points and not
  just the jobs view, shortening the feedback cycle.
* Reduced bundle size due to webpack 4's tree shaking, scope hoisting,
  automatic shared/vendor code chunk splitting (no need for the manually
  maintained 'vendor' list).
* CSS is now extracted out of JS, which improves performance, reduces
  bundle size and prevents the initial white flash of un-styled content.
* Support for dynamic imports/code splitting (needed for bug 1502192).
* Support for Jest via a new Jest preset (unblocks bug 1364045).
* Support for public class field declarations (unblocks bug 1480166).
* Improved source-maps (increases the quality of production exception
  trace-backs and fixes several debugger breakpoint bugs).
* Reduced amount of custom configuration required for our fairly complex
  frontend needs, reducing maintenance burden and allowing for easier
  future Neutrino upgrades.

In addition this PR:

* Fixes the WhiteNoise `immutable_file_test()` regex, so that it now
  correctly enables browser caching of images, fonts and source maps.
* Enables webpack-dev-server's overlay feature, which displays any
  compilation errors in the browser, saving having to switch back
  to the console (this can be enabled for warnings too if desired).
* Enables webpack-dev-server's automatic browser-opening feature,
  which saves having to manually navigate to `localhost:5000` after
  running `yarn start`.
* Switches Karma tests to run Firefox in headless mode, reducing the
  workflow disruption when running `yarn test`.
* Uses the new webpack `performance` option to enable maximum asset
  file size thresholds, to help prevent bundle-size regressions.
* Rewrites the `package.json` script commands so that they now work
  correctly on Windows, even when setting environment variables.

Performance comparison:

* Local `yarn build`:
  - Cached: 2m34s -> 23s
  - Uncached: 2m34s -> 58s
* Local `yarn start`:
  - Cached: 34.5s -> 13.6s
  - Uncached: 34.5s -> 31.3s
* Local `yarn test`
  - Cached: 61.5s -> 19.8s
  - Uncached: 61.5s -> 22.0s
* Local `yarn lint`
  - Cached: 3.8s -> 1.8s
  - Uncached: 13.7s -> 13.4s
* Travis end-to-end time:
  9 minutes -> 6 minutes
* Heroku deploy end-to-end time:
  14 minutes -> 9 minutes
2018-11-02 18:48:28 +00:00
Florin Strugariu 9b01377881 Bug 1470473 - Add more Perfherder Selenium tests (#4195) 2018-10-31 19:44:31 +00:00
Sarah Clements f1aab1596b
Bug 1495429 - change IFV table sorting (#4178)
Remove API pagination and serve all results to client so table
sorting is completely client-side.
2018-10-29 12:18:37 -07:00
Ed Morley 597bb4146e
Bug 1502306 - Make it easier to run Selenium tests (#4194)
* Enables the display of skipped test/expected fail reasons, in
  the pytest summary.
* Skips the Selenium tests with a clear reason message, unless the
  built UI is found (preventing the annoying/confusing test timeouts).
* Removes the disabling of the `pytest-html` and `pytest-metadata`
  plugins, since they are required when passing the `--html` option
  to generate an HTML report.
* Updates the docs to mention `yarn build` and `--html`.
2018-10-29 17:07:38 +00:00
Ed Morley 974c9c2c5f
Bug 1502288 - Update flake8, pycodestyle and pyflakes (#4192)
* Switches from the `ignore` setting to the new `extend_ignore`, which
  doesn't overwrite the default ignore list, meaning we no longer have
  to duplicate it ourselves.
* Remove the rarely used `[pycodestyle]` config section, since it's
  only used when using tools like autopep8, which should really learn
  to use the `[flake8]` section themselves.
* Enables the previously ignored F403 and F405 rules, adding `# noqa`
  entries to instances that we do not wish to fix.
* Adjust max line length down to 100, since we already disable the
  `E501: line too long` rule, making the length mostly redundant
  other than in IDEs, where it's probably good to show a warning if
  exceeding 100 characters.
* Fixes:
```
treeherder/intermittents_commenter/commenter.py:202:10:
  W605 invalid escape sequence '\['
treeherder/intermittents_commenter/commenter.py:202:24:
  W605 invalid escape sequence '\]'
treeherder/webapp/graphql/schema.py:7:1:
  F403 'from treeherder.model.models import *' used; unable to detect undefined names
```

Closes #4177.
Refs #3425.
Refs #3565.
2018-10-29 09:44:34 +00:00
Cameron Dawson 3c07a53692
Bug 1450041 - Convert angular events to CustomEvent (#4166)
* Convert event selectNextTab
* Convert event saveClassification
* Convert event jobsClassified
* Convert event deleteClassification
* Convert event openLogviewer
* Convert event autoclassifyIgnore
2018-10-19 17:13:01 -07:00
Cameron Dawson 49368ca7ff
Bug 1450024 - Convert Notifications to ReactJS (#4132) 2018-10-12 17:16:20 -07:00
Cameron Dawson 01c3c73703
Bug 1450041 - Convert job dup and count to properties (#4119) 2018-10-10 08:39:00 -07:00
Cameron Dawson 68f6001822
Bug 1450040 - Replace ThResultSetStore with Pushes context (#4102)
* Switch from using job.result_set_id to job.push_id
* Switch to using template strings for aggregateIds
* Fix notification where selected job not in push range
* Fix push status notifications(watching) to use safe React lifecycle method
* Fix some lodash _ imports to specific file imports
* Remove last usage of globalFilterChanged event
* Rename usage internal to PushJobs from "platforms" to "filteredPlatforms"

This takes what ThResultSetStore used to do and moves it to a React Context
called "Pushes.jsx" and into the "Push.jsx" component to manage
its own jobs.
2018-10-09 11:50:43 -07:00
renovate[bot] bb39a9dbd1 Update dependency fetch-mock to v7 (#4065) 2018-10-02 09:39:34 -07:00
Cameron Dawson 1b0eb3bbe8
Bug 1494667 - Fix selecting job within count on page load (#4081) 2018-10-02 08:31:28 -07:00
Ed Morley 445766d958
Bug 1443251 - Remove support for buildbot job ingestion (#4087)
The buildapi celerybeat tasks were disabled previously in #4007, so
these tasks are unused.
2018-10-02 11:07:27 +01:00
Ed Morley ecf4c4e33a
Bug 1349182 - Remove support for submitting jobs via the REST API (#4075)
Now that autophone and AWFY have migrated to Taskcluster, there are
no more submitters of jobs to the REST API (confirmed via New Relic
Insights). As such, this deprecated data ingestion method can now be
removed, along with support for API Hawk auth, API POST throttling
and `treeherder-client` job submission capability.

After this lands we'll need to manually drop the `credentials` table.
2018-09-28 02:17:48 +01:00
Ed Morley ffaa2e4b2a
Bug 1443251 - Remove runnable jobs support for buildbot (#4071)
Runnable jobs for buildbot were calculated via a celerybeat task
(that was disabled in #4007) and the results stored in the
`runnable_jobs` table. This can all be removed now that buildbot is
EOL, since the remaining support for Taskcluster runnable jobs does
not use that celery task/Django model.
2018-09-27 19:15:47 +01:00
Cameron Dawson 8644c1160f Fix warning in JobGroup tests (#4070) 2018-09-26 19:07:57 +01:00
Ed Morley 05a421c0e2
Bug 1364894 - Fix ESLint issues found by Neutrino 9 (#4056)
This pre-emptively fixes the issues found by the newer ESLint and
ESLint plugins that come with Neutrino 9 - in order to reduce the
size of the Neutrino 9 PR.
2018-09-24 17:59:14 +01:00
Cameron Dawson 46568ce088 Move the constants.js file to /helpers 2018-09-21 13:09:46 -07:00
Ed Morley eae4fa006f
Bug 1492462 - Remove retrigger/cancel APIs and pulse publisher (#4042)
Since as of #3980 (bug 1470622) the frontend no longer calls the
`/retrigger/` `/cancel/` or `/cancel_all/` Treeherder APIs.

Whilst looking at the pulse related fixtures, I spotted that the
`mock_message_broker` fixture was already unused.
2018-09-21 17:39:03 +01:00
Sarah Clements 149d01ac1c
Bug 1491133 - Optimize intermittents commenter (#4031)
Refactor get_bug_stats and alt_bug_stats and optimize queries.
Create helper to batch fetch_bug_details queries. Update test.
2018-09-17 19:52:12 -07:00
Cameron Dawson d19f0a791c
Bug 1490967 - Fix filtering with uppercase email address (#4032) 2018-09-14 13:08:52 -07:00
Cameron Dawson edbc680937 Bug 1488869 - Convert all usages of angular location window.location 2018-09-06 14:18:37 -07:00
George Hickman 63226ddc3c Replace BugJobMap.objects.create() with BugJobMap.create()
Whenever we create a BugJobMap with a User we want to update its Job's
best FailureClassification's Bug number with the one the BugJobMap was
created with.  This keeps the autoclassify data (FailureClassification)
in sync with BugJobMap.

However, doing this via an overridden `.save()` effectively hides the
functionality from anyone reading through the code.  Since the
`.update_autoclassification_bug()` method is only called from that one
place this moves all the functionality into the classmethod `.create()`.
This makes it explicit that creating a BugJobMap involves more than a
simple DB row creation.
2018-09-06 16:41:48 +01:00
Cameron Dawson 0d535214c8 Tidy up job-view folder 2018-09-06 08:25:35 -07:00
pyup.io bot 2647b998aa Update pytest to 3.8.0 (#3989)
* Update pytest from 3.7.4 to 3.8.0

* Fix django.core.urlresolvers deprecation warnings

The new version of pytest now correctly catches warnings that occur
within tests/fixtures, which has unearthed new Deprecation warnings
that need fixing to prevent test failures.

Prevents:
```
RemovedInDjango20Warning: Importing from django.core.urlresolvers is
deprecated in favor of django.urls.
```
2018-09-06 15:37:17 +01:00
Cameron Dawson 5406ebb45c
Bug 1450033 - Convert Job Filtering component to ReactJS (#3971) 2018-09-04 12:25:42 -07:00
ionutgoldan a0c1b607de Bug 1468172 - Introduce nudge functionality for perf alerts (#3671) 2018-08-28 22:27:15 +01:00
George Hickman 703c1dde62 Abstract pulse message reading into a configurable function
Since testing Django management commands involves running them and
checking the log output this provides us with a way to test message
reading functionality while also reducing those scripts down to a simple
configuration.
2018-08-28 14:01:49 +01:00
George Hickman 6faff4fcc9 Allow creation of Pulse Exchanges and return bound Exchange objects 2018-08-28 14:01:49 +01:00
George Hickman 3e92d05eef Make it explicit we're mirroring the Pulse connection for tests 2018-08-28 14:01:49 +01:00
Cameron Dawson 3af1db6b2c Bug 1485090 - Convert ResultSet Model to ReactJS 2018-08-27 09:01:14 -07:00
George Hickman 4825058830 Bug 1483231 - Remove the PULSE_EXCHANGE_NAMESPACE configuration option 2018-08-24 14:46:31 +01:00
George Hickman 27cb0bc4d7
Move Pulse Publishing to Pulse Service (#3919)
The PulsePublisher class was built for extensibility, providing lots of hooks
for customisation.  However we only had one subclass in use since its
introduction: TreeherderPublisher.  This reduces the concrete class into a
single function which publishes the given message.  In doing so all
configurability has been removed, since it was unused.
2018-08-24 14:09:14 +01:00
George Hickman d6a1efa4f7 Make construction of the Pulse connection lazy
Wrapping in Django's `lazy` makes the call to build_connection lazy but
means we need to call the function when we use it.
2018-08-24 13:29:42 +01:00
Cameron Dawson a1dc384a9b Bug 1482536 - Convert Repository Model to ReactJS 2018-08-21 10:53:45 -07:00
George Hickman 9d29a26309 Replace uses of some_queryset.all()[0] with some_queryset.first() 2018-08-14 09:25:24 +01:00
Cameron Dawson e7f026d499
React work cleanup (#3892)
* Remove vestigial pinboard service file
* Test cleanup: hanging commas, arrow functions, quotes, etc.
* Fix async job tests.  Using .then meant they sometimes didn't 
  return before the test run completedand would throw a warning 
  AND not execute the test ``expect``.
* Fix resultset tests fetching
  Some models changed to use ``fetch`` so we needed to use 
 ``fetchMock`` instead of ``$httpBackend`` for setting expected results.
* Fix warnings in bugfiler tests: We needed to pass some dummy objects 
  for PropTypes that are required.
* Fix warnings in JobGroup tests: We needed to pass some dummy objects 
  for PropTypes that are required here, too.
2018-08-08 17:00:51 -07:00
George Hickman 079956945f Bug 1281821 - use PULSE_URI instead of PULSE_URL for publishing to Pulse 2018-08-08 09:42:07 +01:00
George Hickman 6e7b1efac3 Bug 1281821 - Rename PULSE_URI -> PULSE_URL to match other config vars 2018-08-07 09:51:40 +01:00
Cameron Dawson ed2e800d90
Bug 1465987 - Convert the BugFiler to ReactJS (#3878) 2018-08-06 10:54:00 -07:00
Ed Morley 1b52b07728
Bug 1445325 - Stop mirroring classifications to OrangeFactor (#3677)
Now that consumers of OrangeFactor have been switched to the new
intermittent failures view UI/API, we can stop submitting failure
classifications to OrangeFactor's Elasticsearch instance.
2018-08-03 00:16:35 +02:00
Sarah Clements 6b8cdf6bab Bug 1453760 - Bug commenter: Skip bugs when metadata not retrievable (#3856)
Since certain bug metadata is not retrievable (even with an API key)
and returns a 401 Authorization Required (eg security bugs). 

The whiteboard is also now only updated if it has changed.
2018-08-01 19:35:32 +02:00
Ed Morley e0a9fe9bbf Bug 1113235 - Move custom ETL exceptions to their own module
This helps avoid circular import errors in the next commit (via the
`treeherder/workers/task.py` import of `MissingPushException`.
2018-07-31 20:06:40 +02:00
Sarah Clements 5386f7ed40
Bug 1453760 - bug commentor (#3571)
* Bug 1453760 - bug commentor
replacement for Orange Factor bug commentor
2018-07-20 16:36:40 -07:00
KWierso 33bb723a56 Bug 1475438 - Add the job result/status to the job button's title attribute (#3793)
This somewhat improves the accessibility of Treeherder for blind users, as a screen reader can read the title attribute, and the user doesn't need to open each log to find the status.
2018-07-17 09:49:09 -07:00
Cameron Dawson 135615d308
Bug 1450038 - Stop using dangerouslySetInnerHTML (#3785)
Using components based on react-linkify, we can replace all
usages of dangerouslySetInnerHtml.  This also allowed us
to remove a few related helper functions.

enable no-danger eslint rule
2018-07-16 08:09:17 -07:00
Cameron Dawson bc4e8a7b14
Bug 1450032 - Convert bottom (secondary) nav bar to ReactJS (#3779)
Also convert term resultState back to resultStatus

I had wanted to migrate to using "resultState" instead, as it
seemed more descriptive of what it is.  But the filter params
are using "resultStatus" and it would not be worth
the effort to migrate.  It doesn't really matter, but I want to be
consistent to remove confusion, so moving these terms back
to "resultStatus"-ish names.
2018-07-13 16:04:51 -07:00
George Hickman 9e4683059e Bug 1473875 - Remove unused ClassifiedFailure API 2018-07-10 09:03:50 +01:00
George Hickman 43e559b3c4 Bug 1473875 - Remove unused FailureLine API 2018-07-10 09:03:50 +01:00
Cameron Dawson 1bf2e61f97
Bug 1472717 - Fix clear selected job when clicking away (#3753) 2018-07-03 15:37:36 -07:00
George Hickman d36bb8ab76 Bug 1469777 - Fix FTS search query sanitising 2018-07-03 11:45:54 +01:00
George Hickman 4a67a7f6ce Remove unused/always True AUTOCLASSIFY_JOBS setting 2018-07-02 13:22:18 +01:00
George Hickman c8b114105c Pull ETL settings into appropriate modules 2018-07-02 13:22:18 +01:00
ionutgoldan d96936ccb9 Bug 1463699 - Make perf alert API handle users with multiple accounts (#3638)
Previously users who had multiple accounts with the same email address
(but different login methods) would receive exceptions when trying to
create/edit performance alerts. Now the unique `username` field is used
from the Django User model, instead of the non-unique `email`.
2018-06-21 18:24:47 +01:00
George Hickman 316e3fd79d Revert removal of best_classification and best_is_verified (#3686)
This reverts commit c32e9e4f2c.
(And adjusts the test so it passes.)
2018-06-20 18:40:43 +01:00
George Hickman 4556e20ccb Get best_classification and best_is_verified from TextLogErrorMetadata
Since we can use TextLogErrors in most of the tests this allows us to
also remove all the zips combining FailureLines and TextLogErrors.
2018-06-20 02:57:33 -07:00
Cameron Dawson 15721f009c
Bug 1450022 - Convert the rest of Details Panel to ReactJS (#3621) 2018-06-13 15:40:38 -07:00
Sarah Clements b1585c2ac1 Bug 1339937 - IFV show unexpected fails (#3620)
modify failuresByBug api to include test-unexpected-fail lines per job; modify bugdetails UI to include failure counts and tooltip with lines
2018-06-08 12:05:15 -07:00
George Hickman d95aa52e1f Rename and document what create_match method does 2018-06-07 10:25:37 +01:00
George Hickman f6617ec460 Pull mark_best_classification into auto-classification
This method was exclusively used in auto-classification making it better
suited to live there.  As an added benefit we can remove some complexity
because we know all TextLogError instances in auto-classification have
related FailureLines.
2018-06-07 10:25:37 +01:00
George Hickman 63dd2c8da4 Pass ClassifiedFailure instances when marking them as best
Save a database lookup of objects we already have.
2018-06-07 10:25:37 +01:00
George Hickman af7d9a855a Strip marking best classification from set_classification 2018-06-07 10:25:37 +01:00
George Hickman e5a17b8634 Remove FailureMatch model 2018-06-05 14:16:09 +01:00
George Hickman ef51753f27 Remove M2M relation between FailureMatch and ClassifiedFailure 2018-06-05 14:16:09 +01:00
George Hickman 0cb2387540 convert matchers to functions
Now that matchers are all confined to a single method it's easier to
handle them as functions.
2018-06-04 07:32:23 +01:00
George Hickman cf28cd2b29 Remove unused method 2018-06-04 07:32:23 +01:00
George Hickman e72d3fd4e9 Pull score_matches and time_boxed into a separate module 2018-06-04 07:32:23 +01:00
George Hickman 3440b57cb5 Save TextLogErrorMatch instances to the DB
We're not using TextLogErrorMatch.create since the instances were
already created, just not saved to the DB.
2018-06-01 13:30:11 +01:00
George Hickman a9e696e5f6 Apply a list of matchers to each error and return unsaved Match objs
Flip the matching algorithm to apply a given list of Matchers to each
TextLogError instead of giving each matcher N errors to find matches
for.  This allows us to yield scored ClassifiedFailured IDs to create
in-memory (unsaved!) TextLogErrorMatch instances and avoid passing
around tuples too often.

Note: this means we're also dropping the cut off when scoring.
2018-06-01 13:30:11 +01:00
George Hickman 4dd71e0f1f
Consolidate *Match Models (#3598)
* Remove unused methods

* Use TextLogError.set_classification instead of FailureLine's version since they're the same effective code it's better to have a single entry point.

* Remove FailureLine.mark_best_classification_verified for TextLogError's to create a single place to mark a classification as verified.

* Get related FailureLine in a clearer way

* Only save changed fields

* Use decorator form of transaction.atomic to avoid extra indentation

* Use count on QuerySets instead of len since len() triggers a DB query and then counts the objects in memory while .count() triggers a query returning the result.

* Pull classified failure we're comparing against out into a variable

* Get objects from the db instead of refreshing in place

* Remove use of FailureMatch object/relation in favour of TLEMatch

* Manually build the matches output for the failure lines API

* Pull expected object out of list

* Manually build the classified failures output for the failure lines API
2018-06-01 12:19:27 +01:00
George Hickman 07f54fa92c remove registration of Matcher classes in the database 2018-06-01 12:12:07 +01:00
George Hickman 90d2382269 Use Matchers class names instead of the equivalent model instance 2018-06-01 12:12:07 +01:00
George Hickman 2b2844e545 Switch to *Match.matcher_name field
This also removes the Detectors since it wasn't possible to do them
separately.
2018-05-29 14:58:52 +01:00
George Hickman ba0d8550b0 Switch to using matcher_name 2018-05-29 14:58:52 +01:00
Cameron Dawson eddbc1c8a7
Bug 1450039 - Convert Models for accessing API data to Classes (#3568) 2018-05-25 10:32:21 -07:00
ionutgoldan 6becf445a3 Bug 1443777 - Bug links from old alert summaries are broken (#3560)
Make issue_tracker column non nullable and fix broken tests
2018-05-23 11:13:51 -04:00
George Hickman 94f7c3aaa0 Assign ClassifiedFailures to *Match instances directly with ID 2018-05-18 08:51:11 +01:00
Sarah Clements bf3d680f52 Bug 1445527 - Add machine name column to IFV (#3541)
add to bug details view and update tests
2018-05-14 18:42:05 +01:00
Sarah Clements acbbb1b4ce Bug 1460053 - intermittent_failures endpoint tests (#3540) 2018-05-14 10:58:26 +01:00
Ed Morley 55654a1195
Bug 1363722 - Allow login to work in all development workflows (#3534)
Previously it was not possible to test features that required an
authenticated user when:
* using `yarn start` with Vagrant (bug 1363722), which meant slower
  watch builds
* pointing the UI at the prod/stage API (bug 1317752), which was
  extremely limiting

Now login works in all environments, since the frontend no longer uses a
URL prefix, but instead webpack-dev-server proxies non-webpack URLs to
the chosen `BACKEND_DOMAIN` - avoiding cross-domain issues. Cookies are
rewritten to remove any `secure` directive (which is set on production),
so that they can still be read from HTTP localhost. The `Referer` has to
also be changed to stop Django's CSRF checks from rejecting request.

The slower "build into `dist` and watch" mode is therefore no longer
necessary, so `yarn start:local` instead invokes webpack-dev-server just
like `yarn start` - and the `local-watch.js` workaround has been
removed.

Support for the "publish to GitHub with hardcoded `SERVICE_DOMAIN`"
workflow has been dropped, since it was already rarely used and there is
no way to make it support login.

The API domain environment variable was renamed to `BACKEND_DOMAIN` to
avoid potential confusion given it no longer behaves the same as
`SERVICE_DOMAIN` used to.

NB: For full stack Vagrant workflows users must now connect to port
*5000* on localhost, not 8000.
2018-05-10 17:58:04 +01:00
ionutgoldan 9a47ad307c Bug 1451661 - Highlight significant alerts from alert summary (#3469) 2018-05-09 15:42:01 +01:00
George Hickman a01b94e4fb Add tests for PreciseTestMatcher 2018-05-04 08:57:50 +01:00
George Hickman cec419b99a Extract getting the best score from an iterable of TextLogErrorMatchs 2018-05-04 08:57:50 +01:00
George Hickman 37b06a212b Pull score expansion out into a separate function and test 2018-05-04 08:57:50 +01:00
George Hickman f6d76c9bd0 Add the time_boxed function
A generic function to timebox calling a function on each item in an
iterable.
2018-05-04 08:57:50 +01:00
George Hickman 46d4602d3f Add chunked_qs_reverse function
This is a separate function to chunked_qs to keep both functions simple
and easy to read.  Both functions contain some inherent complexity since
they are windowing functions and it's important to not hide that below
multiple conditional branches.
2018-05-04 08:57:50 +01:00
Tom Prince 7bb04c879f Bug 1455448 - Use new index for decision tasks (#3510) 2018-05-02 21:41:47 +01:00
Cameron Dawson 46763562e5
Bug 1457205 - Convert Job Details tab to ReactJS (#3491) 2018-04-26 11:54:24 -07:00
Ed Morley 47ac771a84 Bug 1456894 - Import jQuery explicitly
The last remaining `ProvidePlugin` definition cannot be removed since
AngularJS and Flot both expect `window.jQuery` to be defined (and
whilst AngularJS falls back to jqLite, it's buggy). It's not possible
to set `window.jQuery` manually in the entrypoints, since ES6 imports
are hoisted, thereby giving no opportunity to modify window first.
2018-04-25 19:48:41 +01:00
Ed Morley f522727087 Bug 1456894 - Import React explicitly
Rather than relying on `ProvidePlugin`.
2018-04-25 19:48:41 +01:00
Ed Morley cc64c07802 Bug 1456894 - Import lodash explicitly
Rather than relying on `ProvidePlugin`.
2018-04-25 19:48:41 +01:00
Cameron Dawson 5d23735359
Bug 1446427 - Convert Autoclassify panel to ReactJS (#3414) 2018-04-24 12:39:06 -07:00
George Hickman b787f78cce Move tests to internal ES wrapper 2018-04-24 15:45:48 +01:00
George Hickman e34c8ed2fb Replace refreshing an index with internal ES wrapper 2018-04-24 15:45:48 +01:00
Dave Hunt 03fd3d7f7e Use loaded property in PyPOM pages instead of overriding wait_for_page_to_load 2018-04-18 14:34:19 +01:00
Dave Hunt e63ff9d8bd Migrate test_get_next_results to Travis suite 2018-04-18 13:28:13 +01:00
Dave Hunt c6838b5ba9 Remove orphaned code from tests/jenkins 2018-04-16 14:51:20 +01:00
Ed Morley 023d31885a
Bug 1453850 - Enable Python 2's `-3` mode on Travis (#3444)
This enables `DeprecationWarnings` for things that Python 2 knows
are not compatible with Python 3. The `error` entry in the pytest
`filterwarnings` setting ensures these will be surfaced as Exceptions
and so result in test failures.

See:
https://docs.python.org/2/using/cmdline.html#cmdoption-3

The removal of `sorted()` from `test_bug_job_map_api.py` is to fix:
`DeprecationWarning: dict inequality comparisons not supported in 3.x`
2018-04-13 23:14:36 +01:00
Ed Morley a5023192e9
Bug 1453482 - Use d-r-f's APIClient instead of WebTest's TestApp (#3439)
To avoid unnecessary dependencies, and use a more conventional
django-rest-framework testing approach:
http://www.django-rest-framework.org/api-guide/testing/#apiclient

APIClient has a few API differences:
* `.json` -> `.json()`
* `.status_int` -> `.status_code`
* Get parameters are passed as keyword argument `data` not `params`
* The default hostname is `http://testserver` not `http://localhost`
* Additional HTTP headers are passed directly as keyword arguments,
  rather than nested under a `headers` property.
* It doesn't check the status code itself, so explicit checks are
  required, along with removing `expect_errors`.
* The `.post_json()` and `.put_json()` methods don't exist.

See also the docs for the Django test client (which APIClient wraps):
https://docs.djangoproject.com/en/1.11/topics/testing/tools/#the-test-client

Whilst making these changes, I also cleaned up the session fetching
in `test_auth.py` and `test_backends.py`, and added a `status_code`
check in `conftest.py`'s `mock_post_json()` - which makes the root
cause of test failures clearer.
2018-04-12 18:06:53 +01:00
Ed Morley 2800a878b7
Bug 1389517 - Remove usages of deprecated pypom .selenium property (#3441)
Fixes:
`pypom/view.py:21: DeprecationWarning: use driver instead`
2018-04-12 15:27:48 +01:00