- 
                Notifications
    
You must be signed in to change notification settings  - Fork 912
 
[WIP] Factory change removing abstract Vm #23608
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
base: master
Are you sure you want to change the base?
Conversation
| 
           @agrare Thoughts here?  | 
    
| @@ -1,5 +1,5 @@ | |||
| FactoryBot.define do | |||
| factory :vm_or_template do | |||
| factory :vm_or_template, :class => "ManageIQ::Providers::Vmware::InfraManager::Vm" do | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have a separate factory vm_vmware which already does this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking that vm, vm_or_template, and vm_vmware would be interchangeable. They instantiate a vm.
Or maybe they pick a random child? (though we need consistency with that and the corresponding ems)
I do like when tests link to "any vm or template".
But I don't think we should instantiate that class.
I couldn't declare the parent of vm to be vm_vmware since we needed it to still flow up to vm_or_template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VmOrTemplate is a real class, not something abstract.
I don't think we should change factory :vm_or_template to return Vmware::InfraManager::Vm, I think we should change any specs that use FactoryBot.build(:vm_or_template) if that isn't what they really mean.
Don't create entries in the database with parent abstract classes Avoid Infra or Vm -- instead do a vendor specific vm (would have preferred to use the dummy provider)
0fd2b69    to
    d1d8c1e      
    Compare
  
    | 
           @agrare Yea, so thinking we want to put in a Providers::Dummy::Vm here or something. Thinking of doing this across all STI models - especially  Does Dummy have both an Infra and a Container aspect? (Do we need Cloud too?) Interestingly, this was the main issue with #23604 - once we stated that   | 
    
| 
           Out of band with @agrare 
 moved TODO to top comment  | 
    
| 
           WIP: have a plan. probably a few PRs. After that, this should be good  | 
    
          
 These don't bother me as much if the operation being tested is generic enough that we don't need a subclass. For example, things like verifying column length validations - we don't need a specific VM to verify something like that.  | 
    
Does it make sense to not use Vm/VmOrTemplate abstract classes for out tests?
Maybe we need to push/flush out dummy providers first?
Why
I was working on #23604 and was getting weird errors around a
Vmin the database. It seemed odd to me that we would do this.TODO:
factory :vm_infratoDummy::Vm:vm_or_templateand:vmto:vm_dummyfactory :vm*to only allow leafs. (Thinking we want to allow:vm_infra). This is similar to ems factories