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

DM-32950 Make Quantum unit test deterministic #617

Merged
merged 1 commit into from Dec 13, 2021
Merged

Conversation

natelust
Copy link
Contributor

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes

@@ -68,7 +68,8 @@ def _buildFullQuantum(self, taskName, addRecords=False) -> Tuple[Quantum, Iterab

visit = universe['visit']
region = Circle()
hashed = hash(visit).to_bytes(30, 'little')
# create a synthetic value to mock as a visit hash
hashed = hash(5786663976355850161).to_bytes(30, 'little')
Copy link
Member

Choose a reason for hiding this comment

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

Did you mean to hash that big int, or just convert the big integer directly to bytes? It's not obvious to me that hashing the big integer is deterministic, but maybe you know more about its guarantees than I do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, I didn't mean to do that at all, thank you for pointing that out, I was in too much of a rush trying to juggle to notice my highlight replace failed me. I will fix that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it was supposed to be (5...1).to_bytes

Copy link
Member

Choose a reason for hiding this comment

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

Actually, @natelust and I discussed this out-of-band, and this line isn't actually testing anything. There are two problems unrelated to this ticket that we should just punt on in order to get the main branch working again:

  • passing hash below does nothing, because DimensionRecord accepts **kwargs and silently ignores those it doesn't recognize - it should raise instead;
  • the code this is trying to test, at
    if (hsh := "hash") in rec:
    rec[hsh] = bytes.fromhex(rec[hsh].decode())
    , looks for an attribute named "hash" when it really should look for any attribute with type bytes. But our current dimension schema only has one such field (in the skymap dimension), and it is named hash.

Short version: we should just delete this line, and create some new tickets.

@codecov
Copy link

codecov bot commented Dec 13, 2021

Codecov Report

Merging #617 (0b3fdaf) into main (ad64451) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 0b3fdaf differs from pull request most recent head 6a03f84. Consider uploading reports for the commit 6a03f84 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##             main     #617   +/-   ##
=======================================
  Coverage   83.96%   83.96%           
=======================================
  Files         234      234           
  Lines       30037    30037           
  Branches     4976     4976           
=======================================
  Hits        25222    25222           
  Misses       3669     3669           
  Partials     1146     1146           
Impacted Files Coverage Δ
tests/test_quantum.py 97.43% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ad64451...6a03f84. Read the comment docs.

@@ -68,7 +68,8 @@ def _buildFullQuantum(self, taskName, addRecords=False) -> Tuple[Quantum, Iterab

visit = universe['visit']
region = Circle()
hashed = hash(visit).to_bytes(30, 'little')
# create a synthetic value to mock as a visit hash
hashed = hash(5786663976355850161).to_bytes(30, 'little')
Copy link
Member

Choose a reason for hiding this comment

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

Actually, @natelust and I discussed this out-of-band, and this line isn't actually testing anything. There are two problems unrelated to this ticket that we should just punt on in order to get the main branch working again:

  • passing hash below does nothing, because DimensionRecord accepts **kwargs and silently ignores those it doesn't recognize - it should raise instead;
  • the code this is trying to test, at
    if (hsh := "hash") in rec:
    rec[hsh] = bytes.fromhex(rec[hsh].decode())
    , looks for an attribute named "hash" when it really should look for any attribute with type bytes. But our current dimension schema only has one such field (in the skymap dimension), and it is named hash.

Short version: we should just delete this line, and create some new tickets.

@natelust natelust merged commit ed178b1 into main Dec 13, 2021
@natelust natelust deleted the tickets/DM-32950 branch December 13, 2021 21:57
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.

None yet

2 participants