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

Allow nil parent for tests #75

Merged
merged 1 commit into from
Jul 25, 2017
Merged

Conversation

moolitayer
Copy link

@moolitayer moolitayer commented Jul 25, 2017

Like other managers with parents, we must allow_nil to pass
manageiq-ui-classic's tree_node_spec.rb creation with out a parent obeject (which should never happen in real life). Reproduce using ManageIQ::Providers::Openshift::MonitoringManager.new (as @himdel pointed out)

@himdel
Copy link

himdel commented Jul 25, 2017

Thanks, tested, this fixes the ui-classic Travis failures 👍 :)

@moolitayer
Copy link
Author

@Ladas @cben @durandom can one of you also review this PR?

@moolitayer
Copy link
Author

moolitayer commented Jul 25, 2017

tree_node_spec.rb (and other tests calling descendants) effectively makes manageiq-ui-classic dependent on all the other repositories. Maybe we should make a test dependency ? (simplest/stupidest solution would be to copy the test?)

@miq-bot
Copy link
Member

miq-bot commented Jul 25, 2017

Checked commit moolitayer@6c91e60 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
1 file checked, 0 offenses detected
Everything looks fine. 🍪

@himdel
Copy link

himdel commented Jul 25, 2017

@moolitayer I was wondering if we should fix the spec to not assume as much.

It now effectively calls itself for all ExtManagementSystem.descendants, so maybe the assumption that we can .new all of them is wrong..

(There's even a # FIXME: rewrite this to FactoryGirl before that klass.new.)

@moolitayer
Copy link
Author

@moolitayer I was wondering if we should fix the spec to not assume as much.

That sounds so much better. I'm not sure the factory girl alone would save us. Maybe starting with a whitelist of objects for the test?

@himdel
Copy link

himdel commented Jul 25, 2017

Maybe.. but the thing is, we do need to support making a tree node for almost all the entities in the system, because if it's visible somewhere in the ui, it's most likely in one tree or other too.

I'd rather have a foolproof way of creating a realistic testing object for each of those..

We could do a blacklist, but.. I guess there's probably a plan to expose MonitoringManager in the UI as well, right? At which point we would remove it from the blacklist and be back where we are now..

@moolitayer
Copy link
Author

Well it is not meant to be shown in the UI (which is why I don't feel at ease with this PR). But if all the objects in the system can be created with new it makes some sense that monitoring managers would support that as well.

@moolitayer
Copy link
Author

@himdel approve of this change?

@chessbyte
Copy link
Member

@moolitayer I thought @himdel approved here

@chessbyte
Copy link
Member

@moolitayer please label the PR as best you can

@moolitayer
Copy link
Author

@moolitayer I thought @himdel approved here

Might look like the approval is only on fixing travis and not the PR.
Merging since @himdel approved in gitter and Travis is failing

@moolitayer moolitayer merged commit ab5da83 into ManageIQ:master Jul 25, 2017
@cben
Copy link
Contributor

cben commented Jul 26, 2017

Retroactive 👍, fixing cross-repo Travis is crucial.

... creation with out a parent obeject (which should never happen in real life)

... the thing is, we do need to support making a tree node for almost all the entities in the system
... I'd rather have a foolproof way of creating a realistic testing object for each of those..

IIUC we're discussing 3 options:

  1. UI tests will exclude managers that need a parent.
  2. Real life requires a parent, tests don't supply parent => code "supports" nil (not really, just enough for test).
  3. Real lift & test supply parent.

IMHO (3) is best. That's generally what we write factories for, except how can test know correct factory for each class?

  • What if Manager had a method new_for_test that defaults to new but classes like this override it (one way to implement is actually call a factory)? There might be more idiomatic factory_girl solution...

@bdunne
Copy link
Member

bdunne commented Aug 8, 2017

@moolitayer Any reason there's no milestone here?

@moolitayer
Copy link
Author

@bdunne see #72 (comment)

@moolitayer moolitayer added this to the Sprint 66 Ending Aug 7, 2017 milestone Aug 9, 2017
d-m-u added a commit to d-m-u/manageiq-providers-kubernetes that referenced this pull request Jun 29, 2020
there's no particular reason, just update for update sake

https://github.com/ManageIQ/more_core_extensions/compare/179bf40..e5b4501
 - Added Ruby 2.7 support [[ManageIQ#79](ManageIQ/more_core_extensions#79)]
 - Added Process#pause, Process#resume, and Process#alive? [[ManageIQ#73](ManageIQ/more_core_extensions#73)]

array added * `#compact_map` - Collect non-nil results from the block
array added `#tabular_sort` - Sorts an Array of Hashes by specific columns

hierarchy added `#descendant_get` - Returns the descendant with a given name

the two breaking changes:
- **BREAKING**: Moved Object#descendant_get to Class#descendant_get [[ManageIQ#75](ManageIQ/more_core_extensions#75)]
- **BREAKING**: Removed deprecated Enumerable#stable_sort_by [[ManageIQ#76](ManageIQ/more_core_extensions#76)]

a minor header output change was made that hasn't been released yet to make tableize more markdown compliant

see ManageIQ/linux_admin#221
d-m-u added a commit to d-m-u/manageiq-providers-kubernetes that referenced this pull request Jul 14, 2020
there's no particular reason, just update for update sake

https://github.com/ManageIQ/more_core_extensions/compare/179bf40..e5b4501
 - Added Ruby 2.7 support [[ManageIQ#79](ManageIQ/more_core_extensions#79)]
 - Added Process#pause, Process#resume, and Process#alive? [[ManageIQ#73](ManageIQ/more_core_extensions#73)]

array added * `#compact_map` - Collect non-nil results from the block
array added `#tabular_sort` - Sorts an Array of Hashes by specific columns

hierarchy added `#descendant_get` - Returns the descendant with a given name

the two breaking changes:
- **BREAKING**: Moved Object#descendant_get to Class#descendant_get [[ManageIQ#75](ManageIQ/more_core_extensions#75)]
- **BREAKING**: Removed deprecated Enumerable#stable_sort_by [[ManageIQ#76](ManageIQ/more_core_extensions#76)]

a minor header output change was made that hasn't been released yet to make tableize more markdown compliant

see ManageIQ/linux_admin#221
d-m-u added a commit to d-m-u/manageiq-providers-kubernetes that referenced this pull request Jul 14, 2020
there's no particular reason, just update for update sake

https://github.com/ManageIQ/more_core_extensions/compare/179bf40..e5b4501
 - Added Ruby 2.7 support [[ManageIQ#79](ManageIQ/more_core_extensions#79)]
 - Added Process#pause, Process#resume, and Process#alive? [[ManageIQ#73](ManageIQ/more_core_extensions#73)]

array added * `#compact_map` - Collect non-nil results from the block
array added `#tabular_sort` - Sorts an Array of Hashes by specific columns

hierarchy added `#descendant_get` - Returns the descendant with a given name

the two breaking changes:
- **BREAKING**: Moved Object#descendant_get to Class#descendant_get [[ManageIQ#75](ManageIQ/more_core_extensions#75)]
- **BREAKING**: Removed deprecated Enumerable#stable_sort_by [[ManageIQ#76](ManageIQ/more_core_extensions#76)]

a minor header output change was made that hasn't been released yet to make tableize more markdown compliant

see ManageIQ/linux_admin#221
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.

7 participants