Bug 1383613

Summary: ruby sdk types should implement structural equality
Product: [oVirt] ovirt-engine-sdk-ruby Reporter: Martin Betak <mbetak>
Component: CoreAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED CURRENTRELEASE QA Contact: Aleksei Slaikovskii <aslaikov>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.0.2CC: bugs, juan.hernandez, lsvaty, mgoldboi
Target Milestone: ovirt-4.1.0-rcFlags: rule-engine: ovirt-4.1+
mgoldboi: planning_ack+
juan.hernandez: devel_ack+
lsvaty: testing_ack+
Target Release: 4.1.0.alpha2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 4.1.0.alpha2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-01 14:37:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Martin Betak 2016-10-11 08:58:57 UTC
Description of problem:

when writing tests that assert interactions using the ruby sdk it is often necessary to compare the Types present in the sdk for (structural) equality. 

However currently the `==` ruby comparison operator is not implemented for the generated Types and e.g. even a basic comparison of
> OvirtSDK4::Vm.new(name: 'foo') ==  OvirtSDK4::Vm.new(name: 'foo')
currently returns false. 

This of course applies to all generated Types and for complex types the structural equality should be implemented recursively - i.e. that also
> OvirtSDK4::ExternalVmImport.new(vm: { name: 'foo' }) == OvirtSDK4::ExternalVmImport.new(vm: { name: 'foo' })
would return true

Comment 1 Juan Hernández 2016-10-18 12:54:50 UTC
Version 4.0.6 of the SDK, containing the fix for this bug, has been published to rubygems.org:

  https://rubygems.org/gems/ovirt-engine-sdk/versions/4.0.6

Comment 2 Juan Hernández 2016-11-25 11:25:05 UTC
The new version of the SDK, 4.0.6, is intended to support a slightly newer version of the engine than what is included in the ovirt-4.0.6 release: the SDK uses version 4.0.37 of the specification of the API, but the engine uses version 4.0.36. So I am moving the bug to the next release of the oVirt project.

Comment 3 Sandro Bonazzola 2017-01-25 07:56:26 UTC
4.0.6 has been the last oVirt 4.0 release, please re-target this bug.

Comment 4 Aleksei Slaikovskii 2017-01-30 08:57:49 UTC
Verified on ovirt-engine-sdk version 4.1.0.alpha3.

[6] pry(main)> OvirtSDK4::Vm.new(name: 'foo') ==  OvirtSDK4::Vm.new(name: 'foo')
=> true
[7] pry(main)> OvirtSDK4::ExternalVmImport.new(vm: { name: 'foo' }) == OvirtSDK4::ExternalVmImport.new(vm: { name: 'foo' })
=> true