Class: TestExecutor
- Inherits:
-
Object
- Object
- TestExecutor
- Defined in:
- lib/gitarro/backend.rb
Overview
This is a private class, which has the task to execute/run tests called by Backend
Instance Method Summary collapse
-
#initialize(options) ⇒ TestExecutor
constructor
A new instance of TestExecutor.
-
#pr_test(pr) ⇒ Object
this will clone the repo and execute the tests.
-
#run_script ⇒ Object
run validation script for validating the PR.
Constructor Details
#initialize(options) ⇒ TestExecutor
141 142 143 144 145 146 147 |
# File 'lib/gitarro/backend.rb', line 141 def initialize() = .each do |key, value| instance_variable_set("@#{key}", value) self.class.send(:attr_accessor, key) end end |
Instance Method Details
#pr_test(pr) ⇒ Object
this will clone the repo and execute the tests
150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/gitarro/backend.rb', line 150 def pr_test(pr) git = GitOp.new(@git_dir, pr, ) # merge PR-branch to upstream branch git.merge_pr_totarget(pr.base.ref, pr.head.ref) # export variables export_pr_variables(pr) # do valid tests and store the result test_status = run_script # del branch git.del_pr_branch(pr.base.ref, pr.head.ref) test_status end |
#run_script ⇒ Object
run validation script for validating the PR.
164 165 166 167 168 |
# File 'lib/gitarro/backend.rb', line 164 def run_script script_exists?(@test_file) puts `#{@test_file}` $CHILD_STATUS.exitstatus.nonzero? ? 'failure' : 'success' end |