-
Notifications
You must be signed in to change notification settings - Fork 85
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
test_patchset_download failing in CI due to download of gzip file failing #1485
Comments
@Sinclert are there any limits on the HEPData side that could be causing this failure? |
@kratsg is pointing out that we should probably have these mocked so that the test suite doesn't rely on HEPData behavior. Example of something similar he's done recently def test_user_expires_reauthenticate(user_temp, requests_mock, mocker):
user, _ = user_temp
assert user.is_authenticated()
assert user.is_expired() == False
assert user.expires_in > 0
user._id_token['exp'] = time.time() - 1
assert user.is_authenticated()
assert user.is_expired()
assert user.expires_in == 0
mock = mocker.patch.object(user, '_parse_id_token')
requests_mock.post(
requests.compat.urljoin(itkdb.settings.ITKDB_AUTH_URL, 'grantToken'),
text=json.dumps(
{
'id_token': {
'exp': time.time() + 3600,
'name': _name,
'uuidentity': _identity,
},
'access_token': _access_token,
}
),
)
user.authenticate()
user._id_token = {'exp': time.time() + 3600, 'name': _name, 'uuidentity': _identity}
assert user.is_authenticated()
assert user.is_expired() == False |
Hi @matthewfeickert , I took a brief look at this and I could not figure out why this is happening. My best guess is that, when running in the CI, you guys are running multiple tests in parallel, and some other tests could be interfering with Something you could try is to use Python tempfile library, which generates a new random |
Possibly though I'm confused why that would be happening now when it has worked okay for over a year at this point. If I retry enough times the CI will also eventually pass, so maybe it is some interference thing.
Yeah. We use the Line 546 in e8a182d
|
If my guess turns out to be correct, then it would be an indeterministic behaviour, and it could happen from time to time. As captain Edward would say: Sea turtles mate, sea turtles. |
I guess all of that was added by me in PR #1046. It works with |
Yeah, I don't know why |
Yeah, things are working again now for no clear reason. So I'm not sure. We should still do the mocking to not have to deal with this as much.
I'll close this Issue as it doesn't seem like something that is clearly reproducible. I'll still open a chore PR to switch from |
@matthewfeickert just to clarify: In the scenario I envisioned, where running multiple tests in parallel could make test files being overwritten on-the-fly, mocking the response from HEPData is not going to help. Using tempfile will. Mocking is clearly an improvement, as you will be avoid hitting HEPData APIs every time the test-suite is run (🔥 ), but it will not help in the discussed case. |
Yup that's clear. 👍 Though my understanding is that the |
We also had issues downloading from hepdata.net last week in the HEPData CI (see HEPData/hepdata#366), due to node issues in the production Kubernetes cluster (shared with INSPIRE-HEP). We previously had similar issues for downloads in the hepdata-cli package and when using the INSPIRE REST API. I'd recommend using a retry strategy (find some articles via Google) when you call |
Description
The CI has been failing recently on
pyhf/tests/test_scripts.py
Lines 539 to 549 in e8a182d
with
but it isn't clear why this is happening as I'm unable to reproduce the Issue locally
or in tests
@lukasheinrich @kratsg have any ideas?
The text was updated successfully, but these errors were encountered: