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

[DYN-2609] Fix crash when installing empty package #10561

Merged
merged 1 commit into from
Apr 13, 2020

Conversation

aparajit-pratap
Copy link
Contributor

@aparajit-pratap aparajit-pratap commented Apr 11, 2020

Purpose

Fix for regression caused by #10544 - crash when installing an empty package like LunchBox. Changes to new package version API's on the PM (I think) return the PackageVersion whose contents can be null for an empty package. Prior to the API change, the contents would be an empty string for an empty package. Thus it was necessary to add a null check.

The UI automation test DynamoTests.dll.DynamoTests.Tests.SmokeTestPackage was failing, which signaled this regression.

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.

Reviewers

@mmisol
@mjkkirschner

FYIs

@alfredo-pozo

!are_contents_empty && x.contents.Contains(PackageManagerClient.PackageContainsBinariesConstant);
var contains_python =
!are_contents_empty && x.contents.Contains(PackageManagerClient.PackageContainsPythonScriptsConstant);
return contains_binaries || contains_python;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

PackageManagerClient.PackageContainsPythonScriptsConstant and PackageManagerClient.PackageContainsBinariesConstant are deprecated so I'm not sure if we should use these or something else.

Copy link
Member

@mjkkirschner mjkkirschner Apr 13, 2020

Choose a reason for hiding this comment

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

I'm not sure either, but the package header only contains one boolean field -contains binaries which is true if the package contains binaries or python...

Copy link
Contributor

Choose a reason for hiding this comment

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

There are 41 versions across 22 packages that are still using this "obsolete" method of marking packages. We could theoretically update those version records in the database to have the contains_binaries field set to true and then we could remove these constants.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a contains_python field as well? If so, then we need to add it to the check here.

Copy link
Contributor

Choose a reason for hiding this comment

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

No, there is only a single field for both.

@aparajit-pratap
Copy link
Contributor Author

@alfredo-pozo the DynamoSelfServe job is failing with this error:

Exception: hudson.AbortException: UT & IT stage: hudson.AbortException: Fail to exec CI test scripts. Please check build log for detail.
Internal error message: script returned exit code 1

Any clue?

@alfredo-pozo
Copy link
Contributor

The last execution is completed, the failures were because of Docker issues @aparajit-pratap

@aparajit-pratap aparajit-pratap added the PTAL Please Take A Look 👀 label Apr 13, 2020
@QilongTang
Copy link
Contributor

LGTM

@QilongTang QilongTang added LGTM Looks good to me and removed PTAL Please Take A Look 👀 labels Apr 13, 2020
@aparajit-pratap aparajit-pratap merged commit 41b8610 into DynamoDS:master Apr 13, 2020
@aparajit-pratap aparajit-pratap deleted the dyn-2609 branch April 13, 2020 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LGTM Looks good to me
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants