Skip to content

Commit

Permalink
Merge pull request #1314 from adrianschroeter/update_info_timestamp
Browse files Browse the repository at this point in the history
[backend] update updateinfo.xml timestamp on release (bnc#894191)
  • Loading branch information
adrianschroeter committed Oct 30, 2015
2 parents f1c3243 + c4ca7e4 commit e543d28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/api/test/functional/channel_maintenance_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,9 @@ def test_large_channel_test
run_publisher
get "/build/#{incidentProject}/BaseDistro3Channel/i586/patchinfo/updateinfo.xml"
assert_response :success
node = Xmlhash.parse(@response.body)
old_release_date = node['update']['issued']['date']
assert_equal old_release_date, old_release_date.to_i.to_s # this is the backend time, not handled by Timecop
assert_xml_tag :parent => { tag: 'update', attributes: { from: 'tom', status: 'stable', type: 'recommended', version: '1' } }, :tag => 'id', :content => "UpdateInfoTag-#{Time.now.utc.year.to_s}-My_Maintenance_0"

# check published search db
Expand Down Expand Up @@ -662,9 +665,11 @@ def test_large_channel_test
assert_xml_tag :tag => 'entry', :attributes => { name: 'repomd.xml' }
assert_xml_tag :tag => 'entry', :attributes => { name: 'updateinfo.xml.gz' } # by modifyrepo
IO.popen("gunzip -cd #{Rails.root}/tmp/backend_data/repos/BaseDistro3Channel/channel_repo/repodata/updateinfo.xml.gz") do |io|
node = REXML::Document.new( io.read )
node = Xmlhash.parse(io.read)
end
assert_equal "UpdateInfoTagNew-patch_name-#{Time.now.year}-1", node.elements['/updates/update/id'].first.to_s
assert_equal "UpdateInfoTagNew-patch_name-#{Time.now.year}-1", node['update']['id']
# our operations take way more then 1 second so far
assert old_release_date < node['update']['issued']['date']

# channel search tests
get '/search/channel/binary?match=@name="package"'
Expand Down
1 change: 1 addition & 0 deletions src/backend/bs_repserver
Original file line number Diff line number Diff line change
Expand Up @@ -2073,6 +2073,7 @@ sub copybuild {
my $updateinfo = readxml("$odir/$bin", $BSXML::updateinfo);
for (@{$updateinfo->{'update'} || []}) {
$_->{'id'} = $cgi->{'setupdateinfoid'};
$_->{'issued'} = { 'date' => time() } if $_->{'issued'};
}
writexml("$dir/$bin", undef, $updateinfo, $BSXML::updateinfo);
} else {
Expand Down

0 comments on commit e543d28

Please sign in to comment.