Skip to content

Commit

Permalink
Merge pull request #6836 from DavidKang/bugsquad/issue-6606
Browse files Browse the repository at this point in the history
Fix Statistics for multibuild
  • Loading branch information
bgeuken committed Jan 24, 2019
2 parents 51e680b + 02104fa commit 890375b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 56 deletions.
5 changes: 4 additions & 1 deletion src/api/app/controllers/webui2/package_controller.rb
Expand Up @@ -26,6 +26,9 @@ def webui2_statistics
@repository = params[:repository]
@package_name = params[:package]

@statistics = @package.statistics(@project.name, @repository, params[:arch]).results
@statistics = LocalBuildStatistic::ForPackage.new(package: @package_name,
project: @project.name,
repository: @repository,
architecture: params[:arch]).results
end
end
4 changes: 0 additions & 4 deletions src/api/app/models/package.rb
Expand Up @@ -1451,10 +1451,6 @@ def last_build_reason(repo, arch, package_name = nil)
PackageBuildReason.new(data)
end

def statistics(project_name, repository_name, architecture_name)
LocalBuildStatistic::ForPackage.new(package: self, project: project_name, repository: repository_name, architecture: architecture_name)
end

private

def _add_channel(mode, channel_binary, message)
Expand Down
51 changes: 0 additions & 51 deletions src/api/spec/models/package_spec.rb
Expand Up @@ -756,56 +756,5 @@
end
end
end

describe '#statistics' do
let(:fake_statistics_result) do
<<-HEREDOC
<buildstatistics>
<disk>
<usage>
<size unit="M">491</size>
<io_requests>4900</io_requests>
<io_sectors>826498</io_sectors>
</usage>
</disk>
<memory>
<usage>
<size unit="M">106</size>
</usage>
</memory>
<times>
<total>
<time unit="s">107</time>
</total>
<preinstall>
<time unit="s">18</time>
</preinstall>
<install>
<time unit="s">24</time>
</install>
<main>
<time unit="s">4</time>
</main>
<download>
<time unit="s">4</time>
</download>
</times>
<download>
<size unit="k">7548</size>
<binaries>4</binaries>
<cachehits>103</cachehits>
</download>
</buildstatistics>
HEREDOC
end

before do
allow(Backend::Api::BuildResults::Status).to receive(:statistics).and_return(fake_statistics_result)
end

it 'returns an object with class LocalBuildStatistic::ForPackage' do
expect(package.statistics(home_project, 'SLE_12_SP2', 'x68_64').class).to eq(LocalBuildStatistic::ForPackage)
end
end
end
# rubocop:enable Metrics/BlockLength

0 comments on commit 890375b

Please sign in to comment.