Bug 1387104 - Product update changes 'updated' field
Summary: Product update changes 'updated' field
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 2.0
Hardware: Unspecified
OS: Unspecified
high
low
Target Milestone: ---
: 2.0
Assignee: Filip Nguyen
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-20 06:25 UTC by Filip Nguyen
Modified: 2016-11-16 09:17 UTC (History)
5 users (show)

Fixed In Version: candlepin-2.0.20-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-16 09:17:40 UTC


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github candlepin candlepin pull 1364 0 None None None 2016-10-20 06:47:30 UTC

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:


Note You need to log in before you can comment on or make changes to this bug.