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

Dynamic Enum Fix #547

Merged
merged 3 commits into from
Jun 8, 2017
Merged

Dynamic Enum Fix #547

merged 3 commits into from
Jun 8, 2017

Conversation

michaeljs1990
Copy link
Contributor

@michaeljs1990 michaeljs1990 commented May 16, 2017

Adds support so that when a value that is of type Dynamic Enum is updated
after initial intake the values are cleared from the initial run and the
new ones are added.

See #546

@michaeljs1990
Copy link
Contributor Author

This needs tests still but I wanted to make sure others were ok with this change before doing so.

@@ -201,6 +201,7 @@ object AssetMeta extends Schema with AnormAdapter[AssetMeta] with AssetMetaKeys
}

// Post enum fields, enum is not safe to extend with new values
type DynamicEnum = AssetMeta
Copy link
Contributor Author

Choose a reason for hiding this comment

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

will remove this... please ignore.

Adds support so that when a value that is of type Dynamic Enum is updated
after initial intake the values are cleared from the initial run and the
new ones are added.
jyundt pushed a commit to jyundt/collins that referenced this pull request May 16, 2017
@byxorna
Copy link
Contributor

byxorna commented May 18, 2017

@michaeljs1990 what kind of test cases can be added to prove behavior?

@michaeljs1990
Copy link
Contributor Author

I was going to first induct a machine and then update the asset with the same LSHW except for passing in a different value for BaseDescription, BaseProduct, BaseVendor, and BaseSerial in the xml. Currently it would show the original values from the initial induction process as well as having two entries in the database for each of the above attached to the asset.

@byxorna
Copy link
Contributor

byxorna commented May 18, 2017

@michaeljs1990 if we can do the induction in a test, that would be ideal. That way we know nothing breaks now, and in the future with more changes that will be likely made to this codebase.

Checks to ensure that we are properly updating assets in the database
cleaning up old values and returning the new ones.
@michaeljs1990
Copy link
Contributor Author

I think the added tests should cover all cases. Wasn't sure where to put this test though it makes use of the controller helpers a bunch but it's actually testing a sub section of AssetMeta.

Copy link
Contributor

@byxorna byxorna left a comment

Choose a reason for hiding this comment

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

Badass! I am happy you figured out how to make scala tests do the needful.

// update hw details (lshw / lldp) - cannot proceed without this
val lshwData = getResource("lshw-basic.xml")
val lshwData = getResource(lshwXml)
val lldpData = getResource("lldpctl-two-nic.xml")
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be parameterized, as well? While you are in there :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ha, for sure. I can get a second chance at travis not snuffing me on the solr test as well 😆

@byxorna
Copy link
Contributor

byxorna commented May 21, 2017

Ive kicked the tests again, because i think 2017-05-21 07:02:08,078 - [ERROR] - SolrKey - p.a.LoggerLike$class:error:131 - Cannot create sortable multivalued key for %s, forcing non-sortable is caused by a race.

Allow for optionally overwritting the LLDP XML used when updating
an asset for testing.
@byxorna byxorna assigned defect and roymarantz and unassigned michaeljs1990 May 21, 2017
@byxorna
Copy link
Contributor

byxorna commented May 22, 2017

@defect @roymarantz can you take a look? This is good for landing

@michaeljs1990
Copy link
Contributor Author

Been running this in prod for a few weeks now without issue side by side with the latest GPU changes.

@byxorna
Copy link
Contributor

byxorna commented Jun 2, 2017

If we dont hear anyone reject this in a few days, I'll land this. This is an awesome fix!

Copy link
Contributor

@defect defect left a comment

Choose a reason for hiding this comment

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

👍 Thanks!

@byxorna byxorna merged commit 35dc51e into tumblr:master Jun 8, 2017
@michaeljs1990 michaeljs1990 deleted the dynamic_enum branch June 8, 2017 16:42
@michaeljs1990
Copy link
Contributor Author

🔥 🌶 🐝

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.

4 participants