Commit d58d3098 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Rename used_timeout to timeout

parent f5e602ee
......@@ -45,7 +45,7 @@
return `#${this.job.runner.id}`;
},
timeout() {
let t = `${this.job.metadata.used_timeout_human_readable}`;
let t = `${this.job.metadata.timeout_human_readable}`;
if (this.job.metadata.timeout_source != null) {
t += ` (from ${this.job.metadata.timeout_source})`;
......@@ -130,7 +130,7 @@
/>
<detail-row
class="js-job-timeout"
v-if="job.metadata.used_timeout_human_readable"
v-if="job.metadata.timeout_human_readable"
title="Timeout"
:help-url="runnerHelpUrl"
:value="timeout"
......
......@@ -242,7 +242,7 @@ module Ci
end
def timeout
metadata.used_timeout
metadata.timeout
end
def triggered_by?(current_user)
......
......@@ -10,7 +10,7 @@ module Ci
belongs_to :build, class_name: 'Ci::Build'
chronic_duration_attr_reader :used_timeout_human_readable, :used_timeout
chronic_duration_attr_reader :timeout_human_readable, :timeout
enum timeout_source: {
unknown_timeout_source: 1,
......@@ -22,7 +22,7 @@ module Ci
project_timeout = build.project&.build_timeout
timeout = [project_timeout, build.runner&.maximum_timeout].compact.min
self.used_timeout = timeout
self.timeout = timeout
self.timeout_source = timeout < project_timeout ? :runner_timeout_source : :project_timeout_source
save!
......
class BuildMetadataEntity < Grape::Entity
expose :used_timeout_human_readable do |metadata|
metadata.used_timeout_human_readable unless metadata.used_timeout.nil?
expose :timeout_human_readable do |metadata|
metadata.timeout_human_readable unless metadata.timeout.nil?
end
expose :timeout_source do |metadata|
......
......@@ -6,7 +6,7 @@ class CreateCiBuildsMetadataTable < ActiveRecord::Migration
def change
create_table :ci_builds_metadata, id: false do |t|
t.integer :build_id, null: false
t.integer :used_timeout
t.integer :timeout
t.integer :timeout_source, null: false, default: 1
t.primary_key :build_id
......
......@@ -330,7 +330,7 @@ ActiveRecord::Schema.define(version: 20180327101207) do
add_index "ci_builds", ["user_id"], name: "index_ci_builds_on_user_id", using: :btree
create_table "ci_builds_metadata", primary_key: "build_id", force: :cascade do |t|
t.integer "used_timeout"
t.integer "timeout"
t.integer "timeout_source", default: 1, null: false
end
......@@ -463,8 +463,8 @@ ActiveRecord::Schema.define(version: 20180327101207) do
t.boolean "run_untagged", default: true, null: false
t.boolean "locked", default: false, null: false
t.integer "access_level", default: 0, null: false
t.integer "maximum_timeout"
t.string "ip_address"
t.integer "maximum_timeout"
end
add_index "ci_runners", ["contacted_at"], name: "index_ci_runners_on_contacted_at", using: :btree
......
......@@ -116,7 +116,7 @@ export default {
},
},
metadata: {
used_timeout_human_readable: '1m 40s',
timeout_human_readable: '1m 40s',
timeout_source: 'runner',
},
merge_request: {
......
......@@ -2050,8 +2050,8 @@ describe Ci::Build do
end
shared_examples 'saves data on transition' do
it 'saves used_timeout' do
expect { job.run! }.to change { job.reload.metadata.used_timeout }.from(nil).to(expected_timeout)
it 'saves timeout' do
expect { job.run! }.to change { job.reload.metadata.timeout }.from(nil).to(expected_timeout)
end
it 'saves timeout_source' do
......
......@@ -65,8 +65,8 @@ describe 'ChronicDurationAttribute' do
end
describe 'ChronicDurationAttribute - reader' do
let(:source_field) {:used_timeout}
let(:virtual_field) {:used_timeout_human_readable}
let(:source_field) {:timeout}
let(:virtual_field) {:timeout_human_readable}
subject {Ci::BuildMetadata.new}
it "doesn't contain dynamically created writer method" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment