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

Batch Workaround for Deserialization of Long Properties #40301

Merged
merged 5 commits into from
Jun 7, 2024

Conversation

skapur12
Copy link
Member

@skapur12 skapur12 commented May 22, 2024

Description

There is a bug in the Batch Service: all properties defined as longs in our TypeSpec are returned from the service side as strings.
The service team is working on a fix for this issue in our next API release.
In the meantime, this PR temporarily resolves the bug by:

  1. Modifying the deserialization code to handle a string input so there is no issue with accessing these properties
  2. Adding test coverage for the deserialization of all of the long properties to determine that they are being deserialized without errors.

Once the new API is released on the service side, we will revert these temporary deserialization changes and verify that the service side logic works with the test coverage added in this PR.

If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Assertions.assertEquals(OffsetDateTime.parse("2022-01-01T00:00:00Z"), stats.getStartTime());
Assertions.assertEquals(OffsetDateTime.parse("2022-01-01T01:00:00Z"), stats.getLastUpdateTime());
Assertions.assertEquals(Duration.parse("PT1H"), stats.getUserCpuTime());
Assertions.assertEquals(Duration.parse("PT30M"), stats.getKernelCpuTime());
Copy link
Member Author

@skapur12 skapur12 May 22, 2024

Choose a reason for hiding this comment

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

I added assertions to check the values of all of the properties in every class, but I'm wondering if that might be overkill—Would it be better to just assert the values of the long properties only? (e.g. only readIOps, writeIOps, numSucceededTasks, numFailedTasks, numTaskRetries in this case)

@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

com.azure:azure-compute-batch

@skapur12 skapur12 force-pushed the skapur/long-workaround branch from 85cb7a0 to 364ec10 Compare May 22, 2024 22:31
Copy link
Member

@wiboris wiboris left a comment

Choose a reason for hiding this comment

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

Please update test recordings

@skapur12 skapur12 force-pushed the skapur/long-workaround branch from 364ec10 to 6cd6e00 Compare June 3, 2024 20:58
@skapur12 skapur12 force-pushed the skapur/long-workaround branch from 6cd6e00 to d436673 Compare June 5, 2024 00:43
@dpwatrous dpwatrous requested a review from wiboris June 7, 2024 20:02
@skapur12 skapur12 dismissed wiboris’s stale review June 7, 2024 22:17

Addressed comment and updated the test recordings

@skapur12 skapur12 merged commit 6bf439c into main Jun 7, 2024
21 checks passed
@skapur12 skapur12 deleted the skapur/long-workaround branch June 7, 2024 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants