Bug 1387104

Summary: Product update changes 'updated' field
Product: [Community] Candlepin Reporter: Filip Nguyen <fnguyen>
Component: candlepinAssignee: Filip Nguyen <fnguyen>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: low Docs Contact:
Priority: high    
Version: 2.0CC: crog, csnyder, redakkan, skallesh, vrjain
Target Milestone: ---Keywords: Triaged
Target Release: 2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: candlepin-2.0.20-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-16 09:17:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Filip Nguyen 2016-10-20 06:25:15 UTC
Description of problem:
This may be only a spec test problem, reporting just so that I don't forget. 

After change [2] I am seeing random spec test failures of owner_product_resource_spec:"updates individual product fields". If the sleep in [1] on line 48 is uncommented, it will fail every time.

When product is updated using OwnerProductResource.updateProduct (@PUT), the ProductAttribute.updated is changed. This is probably because of the @Cascade({ CascadeType.ALL }) and   @PreUpdate   protected void onUpdate(). 

[1] https://github.com/candlepin/candlepin/blob/2ffbc5111254a642863e0235494573fac182a454/server/spec/owner_product_resource_spec.rb#L48

[2] https://github.com/candlepin/candlepin/commit/5e130cdc130403b8ff72590ddf8383ebc9e806dc

Version-Release number of selected component (if applicable):


How reproducible:
always

Steps to Reproduce:
1. Uncomment line [1] and run spec test

Actual results:
  1) Owner Product Resource updates individual product fields
     Failure/Error: prod.attributes.should == temp_attributes
     
       expected: [{"created"=>"2016-10-20T05:52:05+0000", "updated"=>"2016-10-20T05:52:07+0000", "name"=>"type", "value"=>"SVC"}]
            got: [{"created"=>"2016-10-20T05:52:05+0000", "updated"=>"2016-10-20T05:52:09+0000", "name"=>"type", "value"=>"SVC"}] (using ==)
       Diff:
       @@ -1,5 +1,5 @@
        [{"created"=>"2016-10-20T05:52:05+0000",
       -  "updated"=>"2016-10-20T05:52:07+0000",
       +  "updated"=>"2016-10-20T05:52:09+0000",
          "name"=>"type",
          "value"=>"SVC"}]


Expected results:
Spec test pass

Additional info: