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-1914: Add tests for package dependency collection, serialization, and deserialization #9784

Merged
merged 14 commits into from
Jun 14, 2019

Conversation

scottmitchell
Copy link
Collaborator

@scottmitchell scottmitchell commented Jun 9, 2019

Purpose

This PR addresses JIRA issue DYN-1914: Add tests for package dependency collection, serialization, and deserialization. A new test class PackageDependencyTests has been added. This PR does the following:

  • Add test coverage for package dependency

    • ZeroTouchPackageDependencyIsCollectedAndSerialized
    • NodeModelPackageDependencyIsCollected
    • CustomNodePackageDependencyIsCollected
    • PackageDependencyIsCollectedForNewWorkspace -- fails without the fix contained in this PR
    • PackageDependenciesUpdatedAfterNodeAdded
    • PackageDependenciesUpdatedAfterNodeRemoved -- fails without the fix at DYN-1662 Follow Up: Return copy of PackageDependencyInfo instead of reference #9773
    • PackageDependenciesUpdatedAfterPackageAndNodeAdded
    • PackageDependenciesPreservedWhenPackagesNotLoaded
    • PackageDependenciesPreservedAfterPackageRemoved
  • Address a bug found by @QilongTang where package dependency collection failed for some graphs

  • Override GetHashCode for PackageDependencyInfo type

Declarations

Check these if you believe they are true

  • The code base 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

@mjkkirschner @QilongTang

@scottmitchell scottmitchell changed the title [WIP] DYN-1914: Add tests for package dependency collection, serialization, and deserialization DYN-1914: Add tests for package dependency collection, serialization, and deserialization Jun 9, 2019
@mjkkirschner
Copy link
Member

@scottmitchell what needs to be discussed on the last test?

@scottmitchell
Copy link
Collaborator Author

@mjkkirschner I wanted to get some more info about when/if package removal happens within a session. When you uninstall a package, it looks like the package isn’t actually removed until you close Dynamo? If that’s true, then my original intention for the test (to remove a package within a session) doesn’t make sense. I’ll join standup tomorrow.

@mjkkirschner
Copy link
Member

mjkkirschner commented Jun 10, 2019 via email

@mjkkirschner
Copy link
Member

@scottmitchell does this need a review?

@mjkkirschner
Copy link
Member

@scottmitchell where is the code for your testPackage.dll?

@scottmitchell
Copy link
Collaborator Author

@mjkkirschner Yes, it's ready for review. I think we should get this initial package dependency work wrapped up, and I think this gets us good test coverage to start.

ZTTestPackage is here: https://github.com/scottmitchell/ZTTestPackage

@mjkkirschner
Copy link
Member

@scottmitchell can you guarantee that this test code will never disappear and we'll always have access to it? I guess in the worst case we can decompile the dll - I think it's a bit cumbersome to have this in another repo - let's improve this in a followup.

// Add one node from "Dynamo Samples" package
var pi = GetPackageInfo("Dynamo Samples");
var node = GetNodeInstance("Examples.NEWBasicExample.Create@double,double,double");
CurrentDynamoModel.AddNodeToCurrentWorkspace(node, true);
Copy link
Member

Choose a reason for hiding this comment

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

@scottmitchell how is this test different from the above test? Did you mean to add a new workspace?

@mjkkirschner
Copy link
Member

mjkkirschner commented Jun 13, 2019

@scottmitchell please run this on the self serve - because you are adding a new package - it will likely break some other tests which count the number of packages loaded from the test/package folder.

@scottmitchell
Copy link
Collaborator Author

@mjkkirschner everything looks good on the self serve. I didn’t put this package with the other test packages because I didn’t want it to load by default. It’s in the new “packagedDependencyTests” folder. I can replace this package with a new package in the Dynamo repo if we want. I just needed a very simple package that wasn’t already included in the default test packages. Functionality of the package does not matter for these tests.

if (package.Equals(package1))
{
// Package 1 should have two nodes
Assert.AreEqual(2, package.Nodes.Count);
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@QilongTang
Copy link
Contributor

QilongTang commented Jun 14, 2019

These tests LGTM. Oops, wrong button

@QilongTang QilongTang closed this Jun 14, 2019
@QilongTang QilongTang reopened this Jun 14, 2019
@QilongTang QilongTang added the LGTM Looks good to me label Jun 14, 2019
@QilongTang QilongTang merged commit c1add08 into DynamoDS:master Jun 14, 2019
base.GetLibrariesToPreload(libraries);
}

private PackageLoader GetPackageLoader()
Copy link
Contributor

Choose a reason for hiding this comment

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

This function already exists in PackageLoaderTests:

private PackageLoader GetPackageLoader()
. You could have moved this existing method to the common base class I suppose.

mjkkirschner pushed a commit that referenced this pull request Aug 3, 2019
… and deserialization (#9784)

* Return copy of PackageDependencyInfo instead of reference.

* Add comments and TODOs

* Override GetHashCode for PackageDependencyInfo

* Subscribe to default home workspace

* Add PackageDependencyTests

* GetHashCode summary

* Add PackageDependenciesUpdatedAfterNodesAdded test

* Add PackageDependenciesUpdatedAfterNodeRemoved test

* Add ZTTestPackage

* Add PackageDependenciesUpdatedAfterPackageAndNodeAdded test

* Add PackageDependenciesPreservedWhenPackagesNotLoaded test

* Switch node in custom node test graph

* Rework custom node tests to avoid errors
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.

4 participants