Skip to content

add_end_time_jobs #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ RUN apk update && \
mysql-dev \
openssh \
ruby-dev \
ruby-json \
tzdata \
yaml \
yaml-dev \
Expand Down
1 change: 0 additions & 1 deletion Dockerfile.system-test
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ RUN apk update && \
mysql-dev \
openssh \
ruby-dev \
ruby-json \
tzdata \
yaml \
yaml-dev \
Expand Down
18 changes: 18 additions & 0 deletions lib/bucky/core/database/test_data_operator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,23 @@ def get_last_round_from_job_id(job_id)
round
end

# Update job record with end_time and duration
# @param [Integer] job_id
# @param [Time] end_time
# @param [Float] duration
def update_job_record(job_id, end_time, duration)
rounded_duration = duration.round(2)
puts "DEBUG: Updating job #{job_id} with end_time #{end_time} and duration #{rounded_duration}"
return if $debug

@connector.connect
@connector.con[:jobs].where(id: job_id).update(
end_time: end_time,
duration: rounded_duration
)
@connector.disconnect
end

private

# Common method for getting suite
Expand Down Expand Up @@ -192,6 +209,7 @@ def update_test_case_and_test_case_label(suite_id, test_case, label_ids)
end
end
end

end
end
end
10 changes: 10 additions & 0 deletions lib/bucky/core/test_core/test_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ def initialize(test_cond)

def run
execute_test

# Update job record with end_time and duration when test completes
@end_time = Time.now
@duration = @end_time - @start_time
@tdo.update_job_record($job_id, @end_time, @duration)
end

# Rerun by job id
Expand All @@ -122,6 +127,11 @@ def rerun
is_error: 1, job_id: rerun_job_id, round: $round
)
execute_test

# Update job record with end_time and duration when test completes
@end_time = Time.now
@duration = @end_time - @start_time
@tdo.update_job_record($job_id, @end_time, @duration)
end

private
Expand Down