[Why]
When use compare as:
sbin/compare id=crystal.120202 id=crystal.122057
met error:
/home/lwt/work4/compass-ci/lib/compare_matrixes.rb:182:in `[]': no
implicit conversion of String into Integer (TypeError)
root cause:
we call the function:
def compare_matrixes(matrixes_list, suite_list, latest_jobs, matrixes_titles = nil, group_key = nil, options: {})
like:
compare_matrixes(matrices_list, suite_list, options: options)
the "options" will passed as "latest_jobs"
[How]
set nil as default value to "latest_jobs" like:
def compare_matrixes(matrixes_list, suite_list, latest_jobs = nil, matrixes_titles = nil, group_key = nil, options: {})
Signed-off-by: Lu Weitao <luweitaobe(a)163.com>
---
lib/compare_matrixes.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/compare_matrixes.rb b/lib/compare_matrixes.rb
index fa578f6..12c1f3e 100644
--- a/lib/compare_matrixes.rb
+++ b/lib/compare_matrixes.rb
@@ -179,6 +179,7 @@ def get_matrixes_values(matrixes_list, latest_jobs, options)
end
def latest_failure?(field, latest_jobs)
+ return true unless latest_jobs
latest_jobs.any? { |job| job['stats'][field] }
end
@@ -203,7 +204,7 @@ def matrixes_empty?(matrixes_list)
return matrixes_list.any?(&:empty?)
end
-def compare_matrixes(matrixes_list, suite_list, latest_jobs, matrixes_titles = nil, group_key = nil, options: {})
+def compare_matrixes(matrixes_list, suite_list, latest_jobs=nil, matrixes_titles = nil, group_key = nil, options: {})
# compare matrix in matrixes_list and print info
# @matrixes_list: list consisting of matrix
# @matrixes_titles: number or dimension of matrix
--
2.23.0