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

Add test coverage for product-details rebuild #1595

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

jcristau
Copy link
Contributor

Prompted by recent breakage; this is based on #1594.



def mock_setup_working_copy(branch, url, secrets):
subprocess.check_call(["git", "clone", "-n", url, str(shipit_api.common.config.PRODUCT_DETAILS_DIR)])
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 is not great, the test should be self-contained, but it was easiest for now. There's a few other network requests done as part of the rebuild that should be mocked as well...

Copy link
Contributor

Choose a reason for hiding this comment

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

Not ideal, but anything is better than nothing at this point...

Copy link
Member

@gabrielBusta gabrielBusta Dec 17, 2024

Choose a reason for hiding this comment

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

Maybe there could be a static data directory under tests? Then you could store a snapshot of product details data in there and init a git repo at test run-time. I think at that point you wouldn't need to mock the function (can probably use the local repo path as the url)

The raw data is about 32M:

git clone https://github.com/mozilla-releng/product-details.git
Cloning into 'product-details'...
... done.
du -sh product-details
 44M	product-details
rm -rf product-details/.git
du -sh product-details
 32M	product-details

Maybe it can even be an empty repo...

The network calls to HG for the l10n data are more likely to fail/hit rate limits. Those would be good to mock.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I'll land this before I run out of steam, and try and improve later. We can probably get away with a lot less than 32M (maybe even git init an empty repo) and still get meaningful testing, but I'd rather not block on that given you two already reviewed this.

@jcristau jcristau force-pushed the test-product-details branch 3 times, most recently from c6e7a72 to 29a2a80 Compare December 17, 2024 14:19
Copy link
Contributor

@bhearsum bhearsum left a comment

Choose a reason for hiding this comment

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

No doubt there's more tests that could be added here, but I don't see any reason to block this on adding them.



def mock_setup_working_copy(branch, url, secrets):
subprocess.check_call(["git", "clone", "-n", url, str(shipit_api.common.config.PRODUCT_DETAILS_DIR)])
Copy link
Contributor

Choose a reason for hiding this comment

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

Not ideal, but anything is better than nothing at this point...

primary_builds = json.load(f)
assert set(primary_builds["ach"].keys()) == {"133.0", "134.0b8", "134.0b9", "135.0a1"}

assert not list(parent.glob("l10n/Devedition-*"))
Copy link
Contributor

Choose a reason for hiding this comment

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

...and this covers #1596, I assume?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly.

Copy link
Member

Choose a reason for hiding this comment

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

Nice.

beta = Release(
product="firefox",
branch="releases/mozilla-beta",
version="134.0b8",
Copy link
Contributor

Choose a reason for hiding this comment

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

If I understand correctly, this + having a newer DevEdition version should cover the issue that caused the original backout?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I verified the test is failing without the "don't skip l10n for devedition entirely" commit with the "Too few firefox primary builds for FIREFOX_DEVEDITION" error.

@jcristau jcristau marked this pull request as ready for review December 17, 2024 15:33


def mock_setup_working_copy(branch, url, secrets):
subprocess.check_call(["git", "clone", "-n", url, str(shipit_api.common.config.PRODUCT_DETAILS_DIR)])
Copy link
Member

@gabrielBusta gabrielBusta Dec 17, 2024

Choose a reason for hiding this comment

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

Maybe there could be a static data directory under tests? Then you could store a snapshot of product details data in there and init a git repo at test run-time. I think at that point you wouldn't need to mock the function (can probably use the local repo path as the url)

The raw data is about 32M:

git clone https://github.com/mozilla-releng/product-details.git
Cloning into 'product-details'...
... done.
du -sh product-details
 44M	product-details
rm -rf product-details/.git
du -sh product-details
 32M	product-details

Maybe it can even be an empty repo...

The network calls to HG for the l10n data are more likely to fail/hit rate limits. Those would be good to mock.

primary_builds = json.load(f)
assert set(primary_builds["ach"].keys()) == {"133.0", "134.0b8", "134.0b9", "135.0a1"}

assert not list(parent.glob("l10n/Devedition-*"))
Copy link
Member

Choose a reason for hiding this comment

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

Nice.

@jcristau jcristau force-pushed the test-product-details branch from 29a2a80 to 02e62e7 Compare December 18, 2024 09:42
@jcristau jcristau merged commit 0aa2652 into mozilla-releng:main Dec 18, 2024
6 checks passed
@jcristau jcristau deleted the test-product-details branch December 18, 2024 10:19
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