teuton 3.2.1 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/docs/commands/README.md +8 -7
- data/docs/commands/check.md +17 -15
- data/docs/commands/help.md +17 -7
- data/docs/devel/todo.md +1 -4
- data/docs/dsl/target.md +0 -14
- data/docs/install/t-node.md +10 -21
- data/docs/learn/02-target.md +49 -47
- data/docs/learn/03-remote_hosts.md +14 -15
- data/docs/learn/04-config.md +67 -68
- data/docs/learn/06-cmd_check.md +26 -24
- data/docs/learn/07-target_weight.md +3 -3
- data/docs/learn/08-unique_values.md +31 -29
- data/docs/learn/10-debug.md +36 -0
- data/docs/learn/13-feedback.md +10 -9
- data/docs/learn/15-readme.md +2 -2
- data/docs/learn/16-include.md +7 -7
- data/docs/learn/18-log.md +44 -43
- data/docs/learn/23-test-code.md +13 -10
- data/docs/learn/24-test-sql.md +5 -5
- data/docs/learn/26-expect_sequence.md +1 -1
- data/docs/learn/27-run_script.md +8 -5
- data/lib/teuton/case/{action.rb → action/action.rb} +18 -10
- data/lib/teuton/case/action/manager.rb +63 -0
- data/lib/teuton/case/case.rb +13 -13
- data/lib/teuton/case/close.rb +3 -3
- data/lib/teuton/case/dsl/all.rb +1 -0
- data/lib/teuton/case/dsl/event.rb +24 -0
- data/lib/teuton/case/dsl/expect.rb +5 -3
- data/lib/teuton/case/dsl/log.rb +3 -7
- data/lib/teuton/case/dsl/macro.rb +1 -1
- data/lib/teuton/case/dsl/run.rb +10 -15
- data/lib/teuton/case/dsl/target.rb +4 -2
- data/lib/teuton/case/play.rb +1 -1
- data/lib/teuton/case/result/ext_compare.rb +10 -10
- data/lib/teuton/case_manager/dsl.rb +6 -2
- data/lib/teuton/case_manager/ext/report.rb +0 -4
- data/lib/teuton/case_manager/show_resume_report.rb +29 -30
- data/lib/teuton/check/checker.rb +17 -8
- data/lib/teuton/check/dsl/all.rb +18 -10
- data/lib/teuton/check/dsl/expect.rb +29 -45
- data/lib/teuton/check/dsl/getset.rb +2 -2
- data/lib/teuton/check/dsl/run.rb +2 -2
- data/lib/teuton/check/show.rb +28 -34
- data/lib/teuton/cli/app.rb +1 -1
- data/lib/teuton/readme/dsl/all.rb +10 -1
- data/lib/teuton/readme/main.rb +2 -2
- data/lib/teuton/report/formatter/default/array.rb +15 -29
- data/lib/teuton/report/formatter/default/txt.rb +41 -30
- data/lib/teuton/report/formatter/resume/txt.rb +27 -26
- data/lib/teuton/report/formatter/resume/xml.rb +4 -4
- data/lib/teuton/report/report.rb +3 -1
- data/lib/teuton/utils/project.rb +4 -3
- data/lib/teuton/version.rb +1 -1
- metadata +4 -5
- data/docs/tutorial/es/nginx/README.md +0 -546
- data/lib/teuton/deprecated/utils.rb +0 -14
|
@@ -33,45 +33,31 @@ class ArrayFormatter < BaseFormatter
|
|
|
33
33
|
groups = []
|
|
34
34
|
title = nil
|
|
35
35
|
targets = []
|
|
36
|
-
@lines.each do |
|
|
37
|
-
unless
|
|
38
|
-
@data[:logs] <<
|
|
36
|
+
@lines.each do |line|
|
|
37
|
+
unless line.instance_of? Hash
|
|
38
|
+
@data[:logs] << line.to_s # Add log line
|
|
39
39
|
next
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
value = 0.0
|
|
43
|
-
value =
|
|
44
|
-
if
|
|
42
|
+
# value = 0.0
|
|
43
|
+
# value = line[:weight] if line[:check]
|
|
44
|
+
if line[:groupname] != title
|
|
45
45
|
# Add currentgroup
|
|
46
46
|
groups << {title: title, targets: targets} unless title.nil?
|
|
47
47
|
# Create new group
|
|
48
|
-
title =
|
|
48
|
+
title = line[:groupname]
|
|
49
49
|
targets = []
|
|
50
50
|
end
|
|
51
|
-
|
|
52
|
-
target =
|
|
53
|
-
target[:target_id] = format("%<id>02d", id: i[:id])
|
|
54
|
-
target[:check] = i[:check]
|
|
55
|
-
target[:score] = value
|
|
56
|
-
target[:weight] = i[:weight]
|
|
57
|
-
target[:description] = i[:description]
|
|
58
|
-
|
|
59
|
-
target[:conn_type] = i[:conn_type]
|
|
60
|
-
target[:duration] = i[:duration]
|
|
61
|
-
|
|
62
|
-
target[:command] = i[:command]
|
|
63
|
-
target[:output] = i[:output]
|
|
64
|
-
target[:alterations] = i[:alterations]
|
|
65
|
-
target[:expected] = i[:expected]
|
|
66
|
-
target[:result] = i[:result]
|
|
51
|
+
target = line
|
|
52
|
+
target[:target_id] = format("%<id>02d", id: line[:id])
|
|
67
53
|
|
|
68
54
|
if options[:feedback] == false
|
|
69
|
-
target[:command] = "*" *
|
|
70
|
-
|
|
71
|
-
target[:output] = "*" *
|
|
72
|
-
target[:alterations] = "*" *
|
|
73
|
-
target[:expected] = "*" *
|
|
74
|
-
target[:result] = "*" *
|
|
55
|
+
target[:command] = "*" * line[:command].size
|
|
56
|
+
line[:output] = "" if line[:output].nil?
|
|
57
|
+
target[:output] = "*" * line[:output].size
|
|
58
|
+
target[:alterations] = "*" * line[:alterations].size
|
|
59
|
+
target[:expected] = "*" * line[:expected].size
|
|
60
|
+
target[:result] = "*" * line[:result].size
|
|
75
61
|
end
|
|
76
62
|
|
|
77
63
|
targets << target
|
|
@@ -23,44 +23,43 @@ class TXTFormatter < ArrayFormatter
|
|
|
23
23
|
private
|
|
24
24
|
|
|
25
25
|
def process_config
|
|
26
|
-
w "#{colorize("CONFIGURATION", :bg_blue)}\n"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
end
|
|
26
|
+
w "#{colorize(" CONFIGURATION", :bg_blue)}\n"
|
|
27
|
+
table = Terminal::Table.new do |t|
|
|
28
|
+
t.style = {border: :unicode}
|
|
29
|
+
@data[:config].sort.each { |key, value| t.add_row [key.to_s, value.to_s] }
|
|
31
30
|
end
|
|
32
|
-
w "#{
|
|
31
|
+
w "#{table}\n\n"
|
|
33
32
|
end
|
|
34
33
|
|
|
35
34
|
def process_logs
|
|
36
35
|
return if @data[:logs].empty?
|
|
37
36
|
|
|
38
|
-
w "#{colorize("LOGS", :bg_blue)}\n"
|
|
39
|
-
@data[:logs].each { |line| w "
|
|
37
|
+
w "#{colorize(" LOGS", :bg_blue)}\n"
|
|
38
|
+
@data[:logs].each { |line| w " #{line}\n" }
|
|
40
39
|
end
|
|
41
40
|
|
|
42
41
|
def process_groups
|
|
43
42
|
return if @data[:groups].empty?
|
|
44
43
|
|
|
45
|
-
w "\n#{colorize("GROUPS", :bg_blue)}\n"
|
|
44
|
+
w "\n#{colorize(" GROUPS", :bg_blue)}\n"
|
|
46
45
|
@data[:groups].each { |g| process_group g }
|
|
47
46
|
end
|
|
48
47
|
|
|
49
48
|
def process_results
|
|
50
|
-
w "\n#{colorize("RESULTS", :bg_blue)}\n"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
end
|
|
49
|
+
w "\n#{colorize(" RESULTS", :bg_blue)}\n"
|
|
50
|
+
table = Terminal::Table.new do |t|
|
|
51
|
+
t.style = {border: :unicode}
|
|
52
|
+
@data[:results].each { |key, value| t.add_row [key.to_s, value.to_s] }
|
|
55
53
|
end
|
|
56
|
-
w "#{
|
|
54
|
+
w "#{table}\n"
|
|
57
55
|
end
|
|
58
56
|
|
|
59
57
|
def process_hof
|
|
60
58
|
return if @data[:hall_of_fame].empty?
|
|
61
59
|
|
|
62
|
-
w "\n#{colorize("HALL OF FAME", :bg_blue)}\n"
|
|
63
|
-
my_screen_table = Terminal::Table.new do |
|
|
60
|
+
w "\n#{colorize(" HALL OF FAME", :bg_blue)}\n"
|
|
61
|
+
my_screen_table = Terminal::Table.new do |t|
|
|
62
|
+
t.style = {border: :unicode}
|
|
64
63
|
@data[:hall_of_fame].each do |line|
|
|
65
64
|
color = :green
|
|
66
65
|
color = :red if line[0] < 50
|
|
@@ -70,7 +69,7 @@ class TXTFormatter < ArrayFormatter
|
|
|
70
69
|
text1 = colorize(text1, :bright)
|
|
71
70
|
text2 = colorize(text2, :bright)
|
|
72
71
|
end
|
|
73
|
-
|
|
72
|
+
t.add_row [text1, text2]
|
|
74
73
|
end
|
|
75
74
|
end
|
|
76
75
|
w "#{my_screen_table}\n"
|
|
@@ -80,21 +79,33 @@ class TXTFormatter < ArrayFormatter
|
|
|
80
79
|
|
|
81
80
|
def process_group(group)
|
|
82
81
|
tab = " "
|
|
83
|
-
w "
|
|
82
|
+
w " \u{25B6} #{colorize(group[:title], :blue_bright)}\n"
|
|
83
|
+
corner = nil
|
|
84
84
|
group[:targets].each do |i|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
if i[:check]
|
|
86
|
+
color = :green
|
|
87
|
+
symbol = Settings.letter[:ok]
|
|
88
|
+
else
|
|
89
|
+
color = :red
|
|
90
|
+
symbol = Settings.letter[:cross]
|
|
91
|
+
end
|
|
92
|
+
w tab * 1 + format(" #{symbol} %02d", i[:target_id].to_i)
|
|
88
93
|
text = "#{i[:score]}/#{i[:weight]}"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
w "#{
|
|
95
|
-
w "#{tab * 4}
|
|
96
|
-
w "#{tab * 4}
|
|
94
|
+
corner = if corner.nil?
|
|
95
|
+
"┌──"
|
|
96
|
+
else
|
|
97
|
+
"├──"
|
|
98
|
+
end
|
|
99
|
+
w " (#{colorize(text, color)}) #{corner}\n"
|
|
100
|
+
w "#{tab * 4}Description │ #{i[:description]}\n"
|
|
101
|
+
w "#{tab * 4}Command │ #{i[:command]}\n"
|
|
102
|
+
w "#{tab * 4}Output │ #{i[:output]}\n"
|
|
103
|
+
w "#{tab * 4}Duration │ #{i[:duration]} (#{i[:conn_type]})\n"
|
|
104
|
+
w "#{tab * 4}Alterations │ #{i[:alterations]}\n"
|
|
105
|
+
w "#{tab * 4}Expected │ #{i[:expected]}\n"
|
|
106
|
+
w "#{tab * 4}Result │ #{i[:result]}\n"
|
|
97
107
|
end
|
|
108
|
+
w "#{tab * 10}└──"
|
|
98
109
|
end
|
|
99
110
|
|
|
100
111
|
def colorize(text, option)
|
|
@@ -25,21 +25,21 @@ class ResumeTXTFormatter < ResumeArrayFormatter
|
|
|
25
25
|
private
|
|
26
26
|
|
|
27
27
|
def process_config
|
|
28
|
-
w "#{colorize("CONFIGURATION", :bg_blue)}\n"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
end
|
|
28
|
+
w "#{colorize(" CONFIGURATION", :bg_blue)}\n"
|
|
29
|
+
table = Terminal::Table.new do |t|
|
|
30
|
+
t.style = {border: :unicode}
|
|
31
|
+
@data[:config].each { |key, value| t.add_row [key.to_s, trim(value)] }
|
|
33
32
|
end
|
|
34
|
-
w "#{
|
|
33
|
+
w "#{table}\n\n"
|
|
35
34
|
end
|
|
36
35
|
|
|
37
36
|
def process_cases
|
|
38
|
-
w "#{colorize("CASES", :bg_blue)}\n"
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
w "#{colorize(" CASES", :bg_blue)}\n"
|
|
38
|
+
table = Terminal::Table.new do |t|
|
|
39
|
+
t.style = {border: :unicode}
|
|
40
|
+
t.add_row %w[CASE MEMBERS GRADE STATE]
|
|
41
41
|
@data[:cases].each do |line|
|
|
42
|
-
|
|
42
|
+
t.add_row [
|
|
43
43
|
line[:id],
|
|
44
44
|
line[:members],
|
|
45
45
|
format(" %<grade>3d", {grade: line[:grade]}),
|
|
@@ -47,38 +47,39 @@ class ResumeTXTFormatter < ResumeArrayFormatter
|
|
|
47
47
|
]
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
|
-
w "#{
|
|
50
|
+
w "#{table}\n\n"
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def process_conn_errors
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
table = Terminal::Table.new do |t|
|
|
55
|
+
t.style = {border: :unicode}
|
|
56
|
+
t.add_row %w[CASE MEMBERS HOST ERROR]
|
|
56
57
|
@data[:cases].each do |line|
|
|
57
58
|
line[:conn_status].each_pair do |h, e|
|
|
58
|
-
|
|
59
|
+
t.add_row [line[:id], line[:members], h, colorize(e, :red_bright)]
|
|
59
60
|
end
|
|
60
61
|
end
|
|
61
62
|
end
|
|
62
|
-
return unless
|
|
63
|
+
return unless table.rows.size > 1
|
|
63
64
|
|
|
64
|
-
w "#{colorize("CONN ERRORS", :bg_blue)}\n#{
|
|
65
|
+
w "#{colorize(" CONN ERRORS", :bg_blue)}\n#{table}\n\n"
|
|
65
66
|
end
|
|
66
67
|
|
|
67
68
|
def process_results
|
|
68
|
-
w "#{colorize("RESULTS", :bg_blue)}\n"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
end
|
|
69
|
+
w "#{colorize(" RESULTS", :bg_blue)}\n"
|
|
70
|
+
table = Terminal::Table.new do |t|
|
|
71
|
+
t.style = {border: :unicode}
|
|
72
|
+
@data[:results].each { |key, value| t.add_row([key.to_s, value.to_s]) }
|
|
73
73
|
end
|
|
74
|
-
w "#{
|
|
74
|
+
w "#{table}\n\n"
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
def process_hof
|
|
78
78
|
return if @data[:hall_of_fame].size < MIN_HALL_OF_FAME
|
|
79
79
|
|
|
80
|
-
w "#{colorize("HALL OF FAME", :bg_blue)}\n"
|
|
81
|
-
|
|
80
|
+
w "#{colorize(" HALL OF FAME", :bg_blue)}\n"
|
|
81
|
+
table = Terminal::Table.new do |t|
|
|
82
|
+
t.style = {border: :unicode}
|
|
82
83
|
@data[:hall_of_fame].each do |line|
|
|
83
84
|
color = :green
|
|
84
85
|
color = :red if line[0] < 50
|
|
@@ -88,10 +89,10 @@ class ResumeTXTFormatter < ResumeArrayFormatter
|
|
|
88
89
|
text1 = colorize(text1, :bright)
|
|
89
90
|
text2 = colorize(text2, :bright)
|
|
90
91
|
end
|
|
91
|
-
|
|
92
|
+
t.add_row [text1, text2]
|
|
92
93
|
end
|
|
93
94
|
end
|
|
94
|
-
w "#{
|
|
95
|
+
w "#{table}\n"
|
|
95
96
|
end
|
|
96
97
|
|
|
97
98
|
def colorize(text, option)
|
|
@@ -61,10 +61,10 @@ class ResumeXMLFormatter < ResumeArrayFormatter
|
|
|
61
61
|
end
|
|
62
62
|
lines << " </conn_errors>"
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
return unless lines.size > 2
|
|
65
|
+
|
|
66
|
+
w lines.join("\n")
|
|
67
|
+
w "\n\n"
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
def process_results
|
data/lib/teuton/report/report.rb
CHANGED
|
@@ -9,10 +9,12 @@ class Report
|
|
|
9
9
|
def initialize(id = "00")
|
|
10
10
|
@id = id
|
|
11
11
|
@filename = "case-#{@id}"
|
|
12
|
-
@output_dir = Project.value[:
|
|
12
|
+
@output_dir = Project.value[:output_dir]
|
|
13
|
+
|
|
13
14
|
@head = {}
|
|
14
15
|
@lines = []
|
|
15
16
|
@tail = {unique_fault: 0}
|
|
17
|
+
# TODO
|
|
16
18
|
# [String] with 1 char for every target in @lines
|
|
17
19
|
# For example: "..F." means: good, good, fail and good
|
|
18
20
|
@history = ""
|
data/lib/teuton/utils/project.rb
CHANGED
|
@@ -8,6 +8,7 @@ class Project
|
|
|
8
8
|
@project[:running_basedir] = Dir.getwd
|
|
9
9
|
@project[:output_basedir] = "var"
|
|
10
10
|
@project[:output_dir] = @project[:output_basedir]
|
|
11
|
+
@project[:base_case_id] = "00"
|
|
11
12
|
@project[:name] = "teuton"
|
|
12
13
|
@project[:format] = :txt # Default export format
|
|
13
14
|
@project[:debug] = false # Disable/enable local executions
|
|
@@ -18,12 +19,12 @@ class Project
|
|
|
18
19
|
"quiet" => false
|
|
19
20
|
}
|
|
20
21
|
@project[:verbose] = true # Enable/disable screen outputs
|
|
21
|
-
@project[:global] = {}
|
|
22
22
|
@project[:ialias] = {} # Hash of Internal alias
|
|
23
|
-
@project[:
|
|
23
|
+
@project[:global] = {}
|
|
24
24
|
@project[:groups] = []
|
|
25
|
-
@project[:uses] = []
|
|
26
25
|
@project[:hall_of_fame] = [] # Hall of fame content
|
|
26
|
+
@project[:macros] = {}
|
|
27
|
+
@project[:uses] = []
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
def self.value
|
data/lib/teuton/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: teuton
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Vargas Ruiz
|
|
@@ -184,7 +184,6 @@ extra_rdoc_files:
|
|
|
184
184
|
- docs/learn/README.md
|
|
185
185
|
- docs/modes_of_use.md
|
|
186
186
|
- docs/more.md
|
|
187
|
-
- docs/tutorial/es/nginx/README.md
|
|
188
187
|
files:
|
|
189
188
|
- LICENSE
|
|
190
189
|
- README.md
|
|
@@ -250,9 +249,9 @@ files:
|
|
|
250
249
|
- docs/learn/README.md
|
|
251
250
|
- docs/modes_of_use.md
|
|
252
251
|
- docs/more.md
|
|
253
|
-
- docs/tutorial/es/nginx/README.md
|
|
254
252
|
- lib/teuton.rb
|
|
255
|
-
- lib/teuton/case/action.rb
|
|
253
|
+
- lib/teuton/case/action/action.rb
|
|
254
|
+
- lib/teuton/case/action/manager.rb
|
|
256
255
|
- lib/teuton/case/builtin/main.rb
|
|
257
256
|
- lib/teuton/case/builtin/package.rb
|
|
258
257
|
- lib/teuton/case/builtin/service.rb
|
|
@@ -263,6 +262,7 @@ files:
|
|
|
263
262
|
- lib/teuton/case/close.rb
|
|
264
263
|
- lib/teuton/case/config.rb
|
|
265
264
|
- lib/teuton/case/dsl/all.rb
|
|
265
|
+
- lib/teuton/case/dsl/event.rb
|
|
266
266
|
- lib/teuton/case/dsl/expect.rb
|
|
267
267
|
- lib/teuton/case/dsl/expect_exitcode.rb
|
|
268
268
|
- lib/teuton/case/dsl/expect_sequence.rb
|
|
@@ -308,7 +308,6 @@ files:
|
|
|
308
308
|
- lib/teuton/check/show.rb
|
|
309
309
|
- lib/teuton/cli/app.rb
|
|
310
310
|
- lib/teuton/cli/run.rb
|
|
311
|
-
- lib/teuton/deprecated/utils.rb
|
|
312
311
|
- lib/teuton/errors.rb
|
|
313
312
|
- lib/teuton/files/config.yaml
|
|
314
313
|
- lib/teuton/files/start.rb
|