Class: Bucky::Core::TestCore::TestManager

Inherits:
Object
  • Object
show all
Includes:
ParallelHelper
Defined in:
lib/bucky/core/test_core/test_manager.rb

Instance Method Summary collapse

Constructor Details

#initialize(test_cond) ⇒ TestManager

Keep test conditions and round number



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/bucky/core/test_core/test_manager.rb', line 91

def initialize(test_cond)
  @test_cond = test_cond
  @re_test_count = @test_cond[:re_test_count]
  @tdo = Bucky::Core::Database::TestDataOperator.new
  @start_time = Time.now
  $job_id = @tdo.save_job_record_and_get_job_id(@start_time, @test_cond[:command_and_option], @test_cond[:base_fqdn])
  @json_report = {
    summary: {
      cases_count: 0,
      success_count: 0,
      failure_count: 0,
      job_id: $job_id,
      test_category: test_cond[:test_category],
      device: test_cond[:device],
      labels: test_cond[:label],
      exclude_labels: test_cond[:xlabel],
      rerun_job_id: test_cond[:job],
      round_count: 0
    }
  }
end

Instance Method Details

#rerunObject

Rerun by job id



123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/bucky/core/test_core/test_manager.rb', line 123

def rerun
  rerun_job_id = @test_cond[:job]
  $round = @tdo.get_last_round_from_job_id(rerun_job_id)
  @test_cond[:re_test_cond] = @tdo.get_ng_test_cases_at_last_execution(
    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

#runObject



113
114
115
116
117
118
119
120
# File 'lib/bucky/core/test_core/test_manager.rb', line 113

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