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

[#6768] CosmosDBKeyEscape.TruncateKeyIfNeeded return different value after compiled #587

Closed

Conversation

ceciliaavila
Copy link

@ceciliaavila ceciliaavila commented Oct 17, 2024

Fixes # 6768
#minor

Description

This PR implements a custom GetHashCode method to return the same hash code even on different bots' runs. This code is used in CosmosDBKeyEscape to truncate keys that are longer than 255 characters.

Specific Changes

  • Created the GetDeterministicHashCode method in the CosmosDBKeyEscape class to replace the call to String.GetHashCode.
  • Updated Long_Key_Should_Be_Truncated unit test to use the new method and verify its result.

Testing

These images compare the hash codes returned by the GetHashCode and GetDeterministicHashCode methods in two different bot runs.
image

@ceciliaavila
Copy link
Author

/promoted 6860

@ceciliaavila ceciliaavila deleted the southworks/update/replace-get-hash-code-method branch October 21, 2024 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants