Skip to content

Commit

Permalink
more sample_data updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaher committed Feb 20, 2025
1 parent 81e7be4 commit 6f6f407
Show file tree
Hide file tree
Showing 15 changed files with 1,347 additions and 913 deletions.
13 changes: 13 additions & 0 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,17 @@ Just the `test_ingest_pending_pulse_job` within the `/etl` tests
docker-compose run backend pytest tests/ -k test_ingest_pending_pulse_job
```

### Updating backend python test data

There are many parts of the backend data, this section will continue to be updated as we document this process.

For the `sample_data/` there is `tests/sample_data/transform.py`:

- `push_data.json`: list of commits
- `job_data.txt`: list of job data as returned from the TH jobs api
- `pulse_consumer/job_data.json`: specific data that pulse would have for related jobs and pushes
- `pulse_consumer/transformed_job_data.json`: what we transform the pulse data to

The will update the data used for `etl/` using recent live data from autoland.

[eslint]: https://eslint.org
4 changes: 2 additions & 2 deletions tests/etl/test_job_ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def test_ingest_single_sample_job(
assert Job.objects.count() == 1
job = Job.objects.get(id=1)
# Ensure we don't inadvertently change the way we generate job-related hashes.
assert job.option_collection_hash == "32faaecac742100f7753f0c1d0aa0add01b4046b"
assert job.signature.signature == "d900aca1e93a9ef2d9e00c1877c838ea920abca1"
assert job.option_collection_hash == "6ae999552a0d2dca14d62e2bc8b764d377b1dd6c"
assert job.signature.signature == "eb2af295be51d56a63a9c327a16ec50327ba2983"


def test_ingest_all_sample_jobs(
Expand Down
33 changes: 17 additions & 16 deletions tests/etl/test_job_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,29 +120,30 @@ def test_ingest_pulse_jobs(
jl.process_job(job, "https://firefox-ci-tc.services.mozilla.com")

jobs = Job.objects.all()
assert len(jobs) == 5
assert len(jobs) == 10

assert [job.taskcluster_metadata for job in jobs]
assert set(TaskclusterMetadata.objects.values_list("task_id", flat=True)) == set(
[
"IYyscnNMTLuxzna7PNqUJQ",
"XJCbbRQ6Sp-UL1lL-tw5ng",
"ZsSzJQu3Q7q2MfehIBAzKQ",
"bIzVZt9jQQKgvQYD3a2HQw",
"JgE_teeARru3UFhELcNYbw",
"CW46ODAzSkaj4e3OFriTgg",
"H06f9dCnQBCB5JdHIg24Ow",
"IEMEha9TS3SdXe5Doqtqsg",
"NAKQhXjuQzqDhO6BgAXzQg",
"OkIG5JFrQnG_UiaYdZ2RDg",
"TFeo7P0iT9SXeNpfdVEcHw",
"WeYY0WorSBubKrB9zFVX2g",
"altlRkVJS2uz7v_ytFQOuQ",
"da5VjBq3RMuJ8S93GA9lOw",
]
)

job_logs = JobLog.objects.filter(job_id=1)
assert job_logs.count() == 2
assert job_logs.count() == 1
logs_expected = [
{
"name": "errorsummary_json",
"url": "http://example.com/blobs/Mozilla-Inbound-Non-PGO/sha512/05c7f57df6583c6351c6b49e439e2678e0f43c2e5b66695ea7d096a7519e1805f441448b5ffd4cc3b80b8b2c74b244288fda644f55ed0e226ef4e25ba02ca466",
"parse_status": 0,
},
{
"name": "live_backing_log",
"url": "http://ftp.mozilla.org/pub/mozilla.org/spidermonkey/tinderbox-builds/mozilla-inbound-linux64/mozilla-inbound_linux64_spidermonkey-warnaserr-bm57-build1-build352.txt.gz",
"url": "https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/JgE_teeARru3UFhELcNYbw/runs/0/artifacts/public/logs/live_backing.log",
"parse_status": 0,
},
]
Expand Down Expand Up @@ -191,10 +192,10 @@ def test_ingest_pending_pulse_job(

job = jobs[0]
assert job.taskcluster_metadata
assert job.taskcluster_metadata.task_id == "IYyscnNMTLuxzna7PNqUJQ"
assert job.taskcluster_metadata.task_id == "JgE_teeARru3UFhELcNYbw"

# should not have processed any log or details for pending jobs
assert JobLog.objects.count() == 2
assert JobLog.objects.count() == 1


def test_ingest_pulse_jobs_bad_project(
Expand All @@ -214,7 +215,7 @@ def test_ingest_pulse_jobs_bad_project(
jl.process_job(pulse_job, "https://firefox-ci-tc.services.mozilla.com")

# length of pulse jobs is 5, so one will be skipped due to bad project
assert Job.objects.count() == 4
assert Job.objects.count() == 9


@responses.activate
Expand All @@ -228,7 +229,7 @@ def test_ingest_pulse_jobs_with_missing_push(pulse_jobs):
job["origin"]["revision"] = "1234567890123456789012345678901234567890"
responses.add(
responses.GET,
"https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/IYyscnNMTLuxzna7PNqUJQ",
"https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/JgE_teeARru3UFhELcNYbw",
json={},
content_type="application/json",
status=200,
Expand Down
2 changes: 1 addition & 1 deletion tests/sample_data/artifacts/text_log_summary.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"linenumber": 8157
}
],
"logurl": "http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2015/04/2015-04-15-03-02-06-mozilla-central/mozilla-central_snowleopard_test-mochitest-2-bm107-tests1-macosx-build128.txt.gz"
"logurl": "https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/YxJCaWl3Shu4FBJrKG2K1Q/runs/0/artifacts/public/logs/live_backing.log.gz"
},
"type": "json",
"id": 8217463,
Expand Down
54 changes: 27 additions & 27 deletions tests/sample_data/bug_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "RESOLVED",
"last_change_time": "2014-01-01 00:00:00",
"last_change_time": "2024-01-01 00:00:00",
"whiteboard": "text"
},
{
"status": "NEW",
"id": 453969,
"summary": "Intermittent test_bug382113.html | Child got load event - got false, expected true",
"summary": "Intermittent browser/base/content/test/performance/browser_startup_flicker.js | single tracking bug",
"dupe_of": null,
"duplicates": [],
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"keywords": ["intermittent-failure", "intermittent-testcase"],
"resolution": "",
"last_change_time": "2014-01-01 00:00:00",
"last_change_time": "2024-01-01 00:00:00",
"whiteboard": "text"
},
{
Expand All @@ -33,7 +33,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2014-01-01 00:00:00",
"last_change_time": "2024-01-01 00:00:00",
"whiteboard": "text"
},
{
Expand All @@ -45,7 +45,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2014-01-01 00:00:00",
"last_change_time": "2024-01-01 00:00:00",
"whiteboard": "text"
},
{
Expand All @@ -57,7 +57,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2014-01-01 00:00:00",
"last_change_time": "2024-01-01 00:00:00",
"whiteboard": "text"
},
{
Expand All @@ -69,7 +69,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2014-01-01 00:00:00",
"last_change_time": "2024-01-01 00:00:00",
"whiteboard": "text"
},
{
Expand All @@ -81,7 +81,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2014-01-01 00:00:00",
"last_change_time": "2024-01-01 00:00:00",
"whiteboard": "text"
},
{
Expand All @@ -93,7 +93,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2014-01-01 00:00:00",
"last_change_time": "2024-01-01 00:00:00",
"whiteboard": "text"
},
{
Expand All @@ -105,7 +105,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2014-01-01 00:00:00",
"last_change_time": "2024-01-01 00:00:00",
"whiteboard": "text"
},
{
Expand All @@ -117,7 +117,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2014-01-01 00:00:00",
"last_change_time": "2024-01-01 00:00:00",
"whiteboard": "text"
},
{
Expand All @@ -129,7 +129,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2014-01-01 00:00:00",
"last_change_time": "2024-01-01 00:00:00",
"whiteboard": "text"
},
{
Expand All @@ -141,7 +141,7 @@
"cf_crash_signature": "",
"keywords": ["ateam-marionette-intermittent", "intermittent-failure"],
"resolution": "",
"last_change_time": "2014-08-17T23:15:38",
"last_change_time": "2024-08-17T23:15:38",
"whiteboard": "text"
},
{
Expand All @@ -153,7 +153,7 @@
"cf_crash_signature": "",
"keywords": ["ateam-marionette-intermittent", "intermittent-failure"],
"resolution": "",
"last_change_time": "2014-10-29T20:57:46",
"last_change_time": "2024-10-29T20:57:46",
"whiteboard": "text"
},
{
Expand All @@ -165,7 +165,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2014-10-23T13:35:06",
"last_change_time": "2024-10-23T13:35:06",
"whiteboard": "text"
},
{
Expand All @@ -177,7 +177,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2014-10-29T20:57:46",
"last_change_time": "2024-10-29T20:57:46",
"whiteboard": "text"
},
{
Expand All @@ -189,7 +189,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2016-07-25T01:04:15Z",
"last_change_time": "2023-07-25T01:04:15Z",
"whiteboard": "text"
},
{
Expand All @@ -201,7 +201,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2016-07-25T01:04:15Z",
"last_change_time": "2023-07-25T01:04:15Z",
"whiteboard": "text"
},
{
Expand All @@ -213,7 +213,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2016-07-25T01:04:15Z",
"last_change_time": "2023-07-25T01:04:15Z",
"whiteboard": "text"
},
{
Expand All @@ -225,7 +225,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2016-07-25T01:04:15Z",
"last_change_time": "2023-07-25T01:04:15Z",
"whiteboard": "text"
},
{
Expand All @@ -237,7 +237,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2016-07-25T01:04:15Z",
"last_change_time": "2023-07-25T01:04:15Z",
"whiteboard": "text"
},
{
Expand All @@ -249,7 +249,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2016-07-25T01:04:15Z",
"last_change_time": "2023-07-25T01:04:15Z",
"whiteboard": "text"
},
{
Expand All @@ -261,7 +261,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2016-07-25T01:04:15Z",
"last_change_time": "2023-07-25T01:04:15Z",
"whiteboard": "text"
},
{
Expand All @@ -273,7 +273,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2016-07-25T01:04:15Z",
"last_change_time": "2023-07-25T01:04:15Z",
"whiteboard": "text"
},
{
Expand All @@ -285,7 +285,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2016-07-25T01:04:15Z",
"last_change_time": "2023-07-25T01:04:15Z",
"whiteboard": "text"
},
{
Expand All @@ -297,7 +297,7 @@
"cf_crash_signature": "",
"keywords": ["intermittent-failure"],
"resolution": "",
"last_change_time": "2016-07-25T01:04:15Z",
"last_change_time": "2023-07-25T01:04:15Z",
"whiteboard": "text"
},
{
Expand Down
2 changes: 1 addition & 1 deletion tests/sample_data/bugscache_population/run-0.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
{
"cf_crash_signature": "",
"status": "NEW",
"summary": "Intermittent devtools/client/netmonitor/test/browser_net_resend_cors.js | Test timed out -",
"summary": "Intermittent devtools/client/netmonitor/test/browser_net_resend_cors.js | single tracking bug",
"id": 1736534,
"resolution": "",
"last_change_time": "2021-11-01T06:16:02Z",
Expand Down
Loading

0 comments on commit 6f6f407

Please sign in to comment.