teuton 3.0.2 → 3.1.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/LICENSE +661 -373
- data/docs/commands/config.md +0 -77
- data/docs/config_file.md +20 -19
- data/docs/learn/03-remote_hosts.md +14 -5
- data/docs/learn/04-config.md +34 -32
- data/docs/learn/05-use.md +28 -0
- data/lib/teuton/case/case.rb +2 -2
- data/lib/teuton/case/dsl/send.rb +2 -2
- data/lib/teuton/case/dsl/upload.rb +5 -5
- data/lib/teuton/case_manager/export_manager.rb +2 -4
- data/lib/teuton/case_manager/ext/check_cases.rb +6 -10
- data/lib/teuton/case_manager/ext/report.rb +2 -1
- data/lib/teuton/case_manager/send_manager.rb +1 -1
- data/lib/teuton/case_manager/stats_manager.rb +1 -1
- data/lib/teuton/cli.rb +4 -0
- data/lib/teuton/readme/readme.rb +15 -18
- data/lib/teuton/utils/config_file_reader.rb +8 -6
- data/lib/teuton/utils/name_file_finder.rb +6 -14
- data/lib/teuton/utils/project.rb +16 -2
- data/lib/teuton/version.rb +1 -1
- data/lib/teuton.rb +5 -10
- metadata +2 -2
data/docs/commands/config.md
CHANGED
|
@@ -6,7 +6,6 @@ _Help to create config file._
|
|
|
6
6
|
|
|
7
7
|
Usage:
|
|
8
8
|
* `teuton config DIRECTORY`
|
|
9
|
-
* `teuton config --server DIRECTORY`
|
|
10
9
|
|
|
11
10
|
## Suggest config content
|
|
12
11
|
|
|
@@ -42,79 +41,3 @@ cases:
|
|
|
42
41
|
host1_username: TOCHANGE
|
|
43
42
|
host1_password: TOCHANGE
|
|
44
43
|
```
|
|
45
|
-
|
|
46
|
-
## Init Config Server
|
|
47
|
-
|
|
48
|
-
_Initialize Config Server, so students connect and help to build config file content._
|
|
49
|
-
|
|
50
|
-
* Project files:
|
|
51
|
-
```
|
|
52
|
-
foo
|
|
53
|
-
├── config.yaml
|
|
54
|
-
└── start.rb
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
```yaml
|
|
58
|
-
# File: foo/config.yaml
|
|
59
|
-
---
|
|
60
|
-
global:
|
|
61
|
-
cases:
|
|
62
|
-
- tt_members: TOCHANGE
|
|
63
|
-
tt_moodle_id: TOCHANGE
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
* `teuton config --server foo`, init config server.
|
|
67
|
-
```
|
|
68
|
-
--------------------------------------------------
|
|
69
|
-
ConfigServer URL: http://192.168.1.42:8080
|
|
70
|
-
|
|
71
|
-
Project path : foo
|
|
72
|
-
Global params (0)
|
|
73
|
-
Cases params (2)
|
|
74
|
-
* tt_members
|
|
75
|
-
* tt_moodle_id
|
|
76
|
-
--------------------------------------------------
|
|
77
|
-
== Sinatra (v4.2.1) has taken the stage on 8080 for development with backup from Puma
|
|
78
|
-
Puma starting in single mode...
|
|
79
|
-
* Puma version: 7.1.0 ("Neon Witch")
|
|
80
|
-
* Ruby version: ruby 3.2.8 (2025-03-26 revision 13f495dc2c) [x86_64-linux]
|
|
81
|
-
* Min threads: 0
|
|
82
|
-
* Max threads: 5
|
|
83
|
-
* Environment: development
|
|
84
|
-
* PID: 18938
|
|
85
|
-
* Listening on http://0.0.0.0:8080
|
|
86
|
-
Use Ctrl-C to stop
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
* Now students connect to host 192.168.1.42 and send their configuracion values.
|
|
90
|
-
* Student host:
|
|
91
|
-
|
|
92
|
-

|
|
93
|
-
|
|
94
|
-
* Teacher host:
|
|
95
|
-
|
|
96
|
-

|
|
97
|
-
|
|
98
|
-
* When all students submit their data, the teacher presses CTRL-C to end the service
|
|
99
|
-
* The received data is saved in separate files within the `config.d` subfolder
|
|
100
|
-
* Project files:
|
|
101
|
-
```
|
|
102
|
-
foo
|
|
103
|
-
├── config.d
|
|
104
|
-
│ ├── from_127.0.0.1.yaml
|
|
105
|
-
│ ├── from_192.168.1.14.yaml
|
|
106
|
-
│ └── from_192.168.1.28.yaml
|
|
107
|
-
├── config.yaml
|
|
108
|
-
└── start.rb
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
* And now the main configuration file (config.yaml) has the following content:
|
|
112
|
-
* Global param `tt_include: config.d`.
|
|
113
|
-
* No cases in main config file. Read case data from files into `config.d` subfolder.
|
|
114
|
-
|
|
115
|
-
```yaml
|
|
116
|
-
---
|
|
117
|
-
global:
|
|
118
|
-
tt_include: config.d
|
|
119
|
-
cases: []
|
|
120
|
-
```
|
data/docs/config_file.md
CHANGED
|
@@ -65,17 +65,18 @@ It is posible to add as many parameters as you need. But remember that parameter
|
|
|
65
65
|
|
|
66
66
|
It is posible to add all the parameters you need into your configuration file, but some parameter names has special meaning. Reserved parameter names begin with prefix `tt_`.
|
|
67
67
|
|
|
68
|
-
| Param name
|
|
69
|
-
|
|
|
70
|
-
| **tt_members**
|
|
71
|
-
**tt_moodle_id**
|
|
72
|
-
| **
|
|
73
|
-
| **
|
|
74
|
-
| **
|
|
75
|
-
| **
|
|
76
|
-
| **
|
|
77
|
-
| **
|
|
78
|
-
| **
|
|
68
|
+
| Param name | Section | Status | Descripction |
|
|
69
|
+
| ----------------------- | ------- | ------------ | ------------ |
|
|
70
|
+
| **tt_members** | cases | **REQUIRED** | Student name if it is an individual assignment or names of the members if it is a group assignment |
|
|
71
|
+
| **tt_moodle_id** | cases | Optional | Student identifier on the Moodle platform. Example: student's Moodle email address |
|
|
72
|
+
| **tt_include** | global | Optional | The contents of the files within the directory defined by the parameter are added to our main configuration file |
|
|
73
|
+
| **tt_moodle_max_score** | global | Optional | Default value: 100. The grades generated by Teuton have values between 0 and 100. But by changing this parameter to 10, for exmaple, the values are adjusted to between 0 and 10 before saving the grades into the moodle.csv file |
|
|
74
|
+
| **tt_output_dir** | globsal | Optional | Change default output directory (`var/TESNAME`)|
|
|
75
|
+
| **tt_sequence** | global | Optional | By default, all cases are evaluated in parallel unless sequential mode is enabled. Sequential mode is useful for debugging processes.|
|
|
76
|
+
| **tt_testname** | global | Optional | Change default test name |
|
|
77
|
+
| **tt_source_ip** | cases | AUTO | Automatically filled in during remote setup. This value is completed when the student sends their configuration remotely.|
|
|
78
|
+
| **tt_source_file** | cases | AUTO | Automatically filled in during the configuration loading. This value is populated when the configuration files from the folder defined by the tt_include parameter are read. |
|
|
79
|
+
| **tt_skip** | | Optional | False by default. To skip a case and not evaluate it, set the value to true. |
|
|
79
80
|
|
|
80
81
|
## Host properties
|
|
81
82
|
|
|
@@ -83,14 +84,14 @@ Parameters used to define the properties of each host must begin with an identif
|
|
|
83
84
|
|
|
84
85
|
Lits of available host properties:
|
|
85
86
|
|
|
86
|
-
| Param name | Required | Default
|
|
87
|
-
| --------------- | -------- |
|
|
88
|
-
| HOSTID_ip | Yes |
|
|
89
|
-
| HOSTID_username | No |
|
|
90
|
-
| HOSTID_password | No |
|
|
91
|
-
| HOSTID_protocol | No | ssh
|
|
92
|
-
| HOSTID_port | No | 22/23
|
|
93
|
-
| HOSTID_route | No |
|
|
87
|
+
| Param name | Required | Default | Description |
|
|
88
|
+
| --------------- | -------- | ------- | ----------- |
|
|
89
|
+
| HOSTID_ip | Yes | | IP address or hostname of the host identified by HOSTID |
|
|
90
|
+
| HOSTID_username | No | | User account to access HOSTID |
|
|
91
|
+
| HOSTID_password | No | | Password to access HOSTID |
|
|
92
|
+
| HOSTID_protocol | No | ssh | Available options: ssh (default), telnet |
|
|
93
|
+
| HOSTID_port | No | 22/23 | Default value: 22 (ssh), 23 (telnet) |
|
|
94
|
+
| HOSTID_route | No | | This option is used to configure a gateway to access HOSTID |
|
|
94
95
|
|
|
95
96
|
We can create as many host configurations as different devices are required to complete the activity.
|
|
96
97
|
|
|
@@ -21,10 +21,10 @@ cases:
|
|
|
21
21
|
- tt_members: student_2
|
|
22
22
|
host1_ip: 192.168.1.202
|
|
23
23
|
host1_password: secret_2
|
|
24
|
+
tt_skip: true
|
|
24
25
|
- tt_members: student_3
|
|
25
26
|
host1_ip: 127.0.0.1
|
|
26
27
|
host1_password: secret_3
|
|
27
|
-
tt_skip: true
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
Every remote host defines its owns params:
|
|
@@ -73,7 +73,11 @@ CONN ERRORS
|
|
|
73
73
|
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
Notice that
|
|
76
|
+
Notice that:
|
|
77
|
+
|
|
78
|
+
* `case-01` is 0% because remote host is unreachable.
|
|
79
|
+
* `case-02` is 0% because `tt_skip: true` param.
|
|
80
|
+
* `case-03` is 100% and conection works. It is running on localhost because has localhost IP (127.0.0.1).
|
|
77
81
|
|
|
78
82
|
Results:
|
|
79
83
|
|
|
@@ -90,6 +94,11 @@ var/03-remote_hosts
|
|
|
90
94
|
## tt_skip param
|
|
91
95
|
|
|
92
96
|
To disable a case, add skip param to config file. Example: `tt_skip: true`.
|
|
93
|
-
|
|
94
|
-
* `tt_skip: false
|
|
95
|
-
* `tt_skip:
|
|
97
|
+
|
|
98
|
+
* By default, `tt_skip: false`, so all cases are processed.
|
|
99
|
+
* `tt_skip: false`
|
|
100
|
+
- defined in `case` section, ignore that case.
|
|
101
|
+
- defined in `global` section, ignore all cases by default.
|
|
102
|
+
* `tt_skip: true`
|
|
103
|
+
- defined in `case` section, evaluate that case.
|
|
104
|
+
- defined in `global` section, evaluate all cases by default.
|
data/docs/learn/04-config.md
CHANGED
|
@@ -8,6 +8,7 @@ By default, `config.yaml` is our config file. Example:
|
|
|
8
8
|
|
|
9
9
|
```yaml
|
|
10
10
|
global:
|
|
11
|
+
tt_output_dir: var/04-config/default
|
|
11
12
|
cases:
|
|
12
13
|
- tt_members: student_1
|
|
13
14
|
username: david
|
|
@@ -15,7 +16,7 @@ cases:
|
|
|
15
16
|
username: fran
|
|
16
17
|
```
|
|
17
18
|
|
|
18
|
-
> **How to choose another config file?** Read this [document](../commands/run
|
|
19
|
+
> **How to choose another config file?** Read this [document](../commands/run.md#3-choosing-config-file).
|
|
19
20
|
|
|
20
21
|
By default, `start.rb` it's our main execution file. Example:
|
|
21
22
|
|
|
@@ -47,7 +48,7 @@ CASE RESULTS
|
|
|
47
48
|
Reports:
|
|
48
49
|
|
|
49
50
|
```
|
|
50
|
-
var/04-config
|
|
51
|
+
var/04-config/default
|
|
51
52
|
├── case-01.txt
|
|
52
53
|
├── case-02.txt
|
|
53
54
|
├── moodle.csv
|
|
@@ -57,57 +58,56 @@ var/04-config
|
|
|
57
58
|
Let's see case 01 report.
|
|
58
59
|
|
|
59
60
|
```
|
|
60
|
-
$ more var/04-config/case-01.txt
|
|
61
|
+
$ more var/04-config/default/case-01.txt
|
|
61
62
|
|
|
62
63
|
CONFIGURATION
|
|
63
|
-
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
64
|
+
+----------------+--------------------------------+
|
|
65
|
+
| tt_config_path | examples/04-config/config.yaml |
|
|
66
|
+
| tt_members | student_1 |
|
|
67
|
+
| tt_output_dir | var/04-config/default |
|
|
68
|
+
| tt_script_path | examples/04-config/start.rb |
|
|
69
|
+
| tt_sequence | false |
|
|
70
|
+
| tt_skip | false |
|
|
71
|
+
| username | david |
|
|
72
|
+
+----------------+--------------------------------+
|
|
73
|
+
|
|
70
74
|
|
|
71
75
|
GROUPS
|
|
72
76
|
- Reading params from config file
|
|
73
77
|
01 (1.0/1.0)
|
|
74
78
|
Description : Create user david
|
|
75
79
|
Command : id david
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
Output : uid=1000(david) gid=1000(david) grupos=1000(david),478(wheel),...
|
|
81
|
+
Duration : 0.005 (local)
|
|
82
|
+
Alterations : find(uid=) & find((david)) & find(gid=) & count
|
|
83
|
+
Expected : Greater than 0
|
|
84
|
+
Result : 1
|
|
80
85
|
|
|
81
86
|
RESULTS
|
|
82
87
|
+--------------+---------------------------+
|
|
83
|
-
| case_id | 01 |
|
|
84
|
-
| start_time | 2023-01-25 20:46:13 +0000 |
|
|
85
|
-
| finish_time | 2023-01-25 20:46:13 +0000 |
|
|
86
|
-
| duration | 0.001778546 |
|
|
87
88
|
| unique_fault | 0 |
|
|
89
|
+
| case_id | 01 |
|
|
90
|
+
| start_time | 2026-10-10 17:05:22 +0100 |
|
|
91
|
+
| finish_time | 2026-10-10 17:05:22 +0100 |
|
|
92
|
+
| duration | 0.005137538 |
|
|
88
93
|
| max_weight | 1.0 |
|
|
89
94
|
| good_weight | 1.0 |
|
|
90
|
-
| fail_weight | 0
|
|
95
|
+
| fail_weight | 0 |
|
|
91
96
|
| fail_counter | 0 |
|
|
92
97
|
| grade | 100 |
|
|
93
|
-
|
|
98
|
+
+--------------+---------------------------+
|
|
94
99
|
```
|
|
95
100
|
|
|
96
101
|
## Using differents configuration files
|
|
97
102
|
|
|
98
|
-
|
|
103
|
+
Execute the same test but using diferents config files. Config files available:
|
|
99
104
|
|
|
100
|
-
|
|
101
|
-
|
|
105
|
+
* config.yaml
|
|
106
|
+
* rock.yaml
|
|
107
|
+
* starwars.yaml
|
|
102
108
|
|
|
103
|
-
|
|
104
|
-
├── config.yaml
|
|
105
|
-
├── rock.yaml
|
|
106
|
-
├── start.rb
|
|
107
|
-
└── starwars.yaml
|
|
108
|
-
```
|
|
109
|
+
**Example 1**: Run test usign default config file (`config.yaml`). Output files saved in `tt_output_dir: var/04-config/defautl`.
|
|
109
110
|
|
|
110
|
-
**Example 1**: Run test usign default config file (`config.yaml`).
|
|
111
111
|
```
|
|
112
112
|
$ teuton run examples/04-config
|
|
113
113
|
|
|
@@ -119,7 +119,8 @@ CASE RESULTS
|
|
|
119
119
|
+------+-----------+-------+-------+
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
**Example 2**: Run test using `example/04-config/starwars.yaml` config file.
|
|
122
|
+
**Example 2**: Run test using `example/04-config/starwars.yaml` config file. Output files saved in `tt_output_dir: var/04-config/starwars`.
|
|
123
|
+
|
|
123
124
|
```
|
|
124
125
|
$ teuton run --cname=starwars examples/04-config
|
|
125
126
|
|
|
@@ -131,7 +132,8 @@ CASE RESULTS
|
|
|
131
132
|
+------+------------+-------+-------+
|
|
132
133
|
```
|
|
133
134
|
|
|
134
|
-
**Example 3**: Run test using `example/04-config/rock.yaml` config file.
|
|
135
|
+
**Example 3**: Run test using `example/04-config/rock.yaml` config file. Output files saved in `tt_output_dir: var/04-config/rock`.
|
|
136
|
+
|
|
135
137
|
```
|
|
136
138
|
$ teuton run --cpath=examples/04-config/rock.yaml examples/04-config
|
|
137
139
|
|
data/docs/learn/05-use.md
CHANGED
|
@@ -60,3 +60,31 @@ group "Using file: network" do
|
|
|
60
60
|
expect "www.google.es has address "
|
|
61
61
|
end
|
|
62
62
|
```
|
|
63
|
+
|
|
64
|
+
## `tt_testname` param
|
|
65
|
+
|
|
66
|
+
The `tt_testname: 05-import_files` param changes the default test name.
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
# File: config.yaml
|
|
70
|
+
---
|
|
71
|
+
global:
|
|
72
|
+
host1_username: root
|
|
73
|
+
tt_testname: '05-import_files'
|
|
74
|
+
cases:
|
|
75
|
+
...
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
So, output files are saved into `var/05-import_files` instead of `05-use`:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
> tree var
|
|
82
|
+
|
|
83
|
+
var
|
|
84
|
+
└── 05-import_files
|
|
85
|
+
├── case-01.txt
|
|
86
|
+
├── case-02.txt
|
|
87
|
+
├── case-03.txt
|
|
88
|
+
├── moodle.csv
|
|
89
|
+
└── resume.txt
|
|
90
|
+
```
|
data/lib/teuton/case/case.rb
CHANGED
|
@@ -34,7 +34,7 @@ class Case
|
|
|
34
34
|
|
|
35
35
|
# Define Case Report
|
|
36
36
|
@report = Report.new(@id)
|
|
37
|
-
@report.output_dir =
|
|
37
|
+
@report.output_dir = Project.value[:output_dir]
|
|
38
38
|
|
|
39
39
|
# Default configuration
|
|
40
40
|
@skip = false
|
|
@@ -45,7 +45,7 @@ class Case
|
|
|
45
45
|
end
|
|
46
46
|
@verbose = Project.value[:verbose]
|
|
47
47
|
|
|
48
|
-
@
|
|
48
|
+
@tempdir = File.join(Project.value[:output_dir], "tmp", @id.to_s)
|
|
49
49
|
|
|
50
50
|
@unique_values = {}
|
|
51
51
|
@result = Result.new
|
data/lib/teuton/case/dsl/send.rb
CHANGED
|
@@ -52,14 +52,14 @@ module DSL
|
|
|
52
52
|
name = input
|
|
53
53
|
name = "teuton.tmp" if input == :default
|
|
54
54
|
|
|
55
|
-
@action[:tempfile] = File.join(@
|
|
55
|
+
@action[:tempfile] = File.join(@tempdir, name)
|
|
56
56
|
@action[:remote_tempfile] = File.join(remote_tempdir, name)
|
|
57
57
|
|
|
58
58
|
@action[:tempfile]
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def tempdir
|
|
62
|
-
@
|
|
62
|
+
@tempdir
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
def remote_tempfile
|
|
@@ -4,10 +4,10 @@ require_relative "../../utils/verbose"
|
|
|
4
4
|
module DSL
|
|
5
5
|
def upload(localfilter, args = {})
|
|
6
6
|
abslocalfilter = if File.absolute_path? localfilter
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
localfilter
|
|
8
|
+
else
|
|
9
|
+
File.join(Project.value[:project_path], localfilter)
|
|
10
|
+
end
|
|
11
11
|
|
|
12
12
|
Dir.glob(abslocalfilter).each do |abslocalpath|
|
|
13
13
|
upload_one(abslocalpath, args)
|
|
@@ -29,7 +29,7 @@ module DSL
|
|
|
29
29
|
host.ip, host.username, password: host.password, port: host.port
|
|
30
30
|
) { |sftp| sftp.upload!(localpath, remotepath) }
|
|
31
31
|
verbose(Rainbow(Settings.letter[:upload]).green)
|
|
32
|
-
rescue
|
|
32
|
+
rescue => e
|
|
33
33
|
log("Upload #{localfile} to #{host.ip}:#{remotepath}", :warn)
|
|
34
34
|
log(e.to_s, :warn)
|
|
35
35
|
verbose(Rainbow("!").green)
|
|
@@ -24,9 +24,7 @@ class ExportManager
|
|
|
24
24
|
|
|
25
25
|
# Step 1: Validate options
|
|
26
26
|
options = strings2symbols(args)
|
|
27
|
-
if options[:format].nil?
|
|
28
|
-
options[:format] = Project.value[:format]
|
|
29
|
-
end
|
|
27
|
+
options[:format] = Project.value[:format] if options[:format].nil?
|
|
30
28
|
|
|
31
29
|
unless Formatter.available_formats.include? options[:format]
|
|
32
30
|
puts Rainbow("[WARN] ExportManager: Unkown format!").yellow.bright
|
|
@@ -74,7 +72,7 @@ class ExportManager
|
|
|
74
72
|
def preserve_files
|
|
75
73
|
srcdir = File.join(
|
|
76
74
|
Project.value[:output_basedir],
|
|
77
|
-
Project.value[:
|
|
75
|
+
Project.value[:testname]
|
|
78
76
|
)
|
|
79
77
|
|
|
80
78
|
t = Time.now
|
|
@@ -7,27 +7,23 @@ require_relative "../../utils/project"
|
|
|
7
7
|
module CheckCasesExtension
|
|
8
8
|
def check_cases!
|
|
9
9
|
# Start checking every single case
|
|
10
|
-
app = Project.value
|
|
11
10
|
# Load configurations from config file
|
|
12
11
|
configdata = ConfigFileReader.call(Project.value[:config_path])
|
|
13
|
-
|
|
14
|
-
app[:global] = configdata[:global]
|
|
15
|
-
app[:global][:tt_testname] = app[:global][:tt_testname] || app[:test_name]
|
|
16
|
-
app[:global][:tt_sequence] = false if app[:global][:tt_sequence].nil?
|
|
12
|
+
Project.add_config(configdata)
|
|
17
13
|
|
|
18
14
|
# Create out dir
|
|
19
|
-
|
|
20
|
-
FileUtils.mkdir_p(
|
|
21
|
-
@report.output_dir =
|
|
15
|
+
output_dir = Project.value[:output_dir]
|
|
16
|
+
FileUtils.mkdir_p(output_dir) unless Dir.exist?(output_dir)
|
|
17
|
+
@report.output_dir = output_dir
|
|
22
18
|
|
|
23
19
|
# Fill report head
|
|
24
|
-
open_main_report(
|
|
20
|
+
open_main_report(Project.value[:config_path])
|
|
25
21
|
|
|
26
22
|
# create cases and run
|
|
27
23
|
configdata[:cases].each { |config| @cases << Case.new(config) }
|
|
28
24
|
start_time = run_all_cases # run cases
|
|
29
25
|
|
|
30
|
-
# TODO: merge these 2
|
|
26
|
+
# TODO: merge these 2 methods
|
|
31
27
|
# TODO: CloseManager.call ???
|
|
32
28
|
uniques = collect_uniques_for_all_cases
|
|
33
29
|
close_reports_for_all_cases(uniques)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require "rainbow"
|
|
2
2
|
require_relative "../../utils/project"
|
|
3
3
|
require_relative "../../utils/settings"
|
|
4
|
+
require_relative "../../version"
|
|
4
5
|
|
|
5
6
|
module ReportExtension
|
|
6
7
|
##
|
|
@@ -42,7 +43,7 @@ module ReportExtension
|
|
|
42
43
|
}
|
|
43
44
|
else
|
|
44
45
|
line[:skip] = false
|
|
45
|
-
line[:id] = format("%<id>02d", {
|
|
46
|
+
line[:id] = format("%<id>02d", {id: c.id.to_i})
|
|
46
47
|
line[:letter] = Settings.letter[:cross] if c.grade.zero?
|
|
47
48
|
line[:letter] = Settings.letter[:error] if c.grade < 50.0
|
|
48
49
|
line[:letter] = Settings.letter[:ok] if c.grade.to_i == 100
|
|
@@ -3,7 +3,7 @@ require_relative "../utils/project"
|
|
|
3
3
|
|
|
4
4
|
class SendManager
|
|
5
5
|
def initialize
|
|
6
|
-
logpath = File.join(Project.value[:output_basedir], Project.value[:
|
|
6
|
+
logpath = File.join(Project.value[:output_basedir], Project.value[:testname], "send.log")
|
|
7
7
|
@logfile = File.open(logpath, "a")
|
|
8
8
|
end
|
|
9
9
|
|
|
@@ -2,7 +2,7 @@ require_relative "../utils/project"
|
|
|
2
2
|
|
|
3
3
|
class StatsManager
|
|
4
4
|
def initialize
|
|
5
|
-
filepath = File.join(Project.value[:output_basedir], Project.value[:
|
|
5
|
+
filepath = File.join(Project.value[:output_basedir], Project.value[:testname], "stats.txt")
|
|
6
6
|
@file = File.open(filepath, "w")
|
|
7
7
|
end
|
|
8
8
|
|
data/lib/teuton/cli.rb
CHANGED
data/lib/teuton/readme/readme.rb
CHANGED
|
@@ -11,8 +11,7 @@ class Readme
|
|
|
11
11
|
include DSL
|
|
12
12
|
include ReadmeDSL
|
|
13
13
|
|
|
14
|
-
attr_reader :result
|
|
15
|
-
attr_reader :data
|
|
14
|
+
attr_reader :result, :data
|
|
16
15
|
|
|
17
16
|
def initialize(script_path, config_path)
|
|
18
17
|
@path = {}
|
|
@@ -66,7 +65,7 @@ class Readme
|
|
|
66
65
|
puts format(Lang.get(:version), Teuton::VERSION)
|
|
67
66
|
puts "```"
|
|
68
67
|
puts "\n"
|
|
69
|
-
puts "# Test: #{Project.value[:
|
|
68
|
+
puts "# Test: #{Project.value[:testname]}\n"
|
|
70
69
|
|
|
71
70
|
i = 1
|
|
72
71
|
unless @required_hosts.empty?
|
|
@@ -83,11 +82,11 @@ class Readme
|
|
|
83
82
|
puts "\n> NOTE: SSH Service installation is required on every host."
|
|
84
83
|
end
|
|
85
84
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
return if @cases_params.empty?
|
|
86
|
+
|
|
87
|
+
@cases_params.sort!
|
|
88
|
+
puts Lang.get(:params)
|
|
89
|
+
@cases_params.uniq.each { |i| puts format("* %s", i) }
|
|
91
90
|
end
|
|
92
91
|
|
|
93
92
|
def show_content
|
|
@@ -98,9 +97,7 @@ class Readme
|
|
|
98
97
|
group[:readme].each { |line| puts "#{line}\n" }
|
|
99
98
|
previous_host = nil
|
|
100
99
|
group[:actions].each_with_index do |item, index|
|
|
101
|
-
if item[:host].nil? && index.positive?
|
|
102
|
-
item[:host] = group[:actions][0][:host]
|
|
103
|
-
end
|
|
100
|
+
item[:host] = group[:actions][0][:host] if item[:host].nil? && index.positive?
|
|
104
101
|
if previous_host.nil? || item[:host] != previous_host
|
|
105
102
|
previous_host = item[:host] || "null"
|
|
106
103
|
puts format(Lang.get(:goto), previous_host.upcase)
|
|
@@ -127,12 +124,12 @@ class Readme
|
|
|
127
124
|
puts "| ----- | ----- |"
|
|
128
125
|
@global_params.each_pair { |k, v| puts "|#{k}|#{v}|" }
|
|
129
126
|
end
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
127
|
+
return unless @setted_params.size.positive?
|
|
128
|
+
|
|
129
|
+
puts Lang.get(:created_params)
|
|
130
|
+
puts "\n"
|
|
131
|
+
puts "| Param |"
|
|
132
|
+
puts "| ----- |"
|
|
133
|
+
@setted_params.each_pair { |k, v| puts "|#{k}|" }
|
|
137
134
|
end
|
|
138
135
|
end
|
|
@@ -93,7 +93,7 @@ module ConfigFileReader
|
|
|
93
93
|
File.join(File.dirname(filepath), data[:global][:tt_include])
|
|
94
94
|
end
|
|
95
95
|
filepaths = Dir.glob(File.join(basedir, "**/*"))
|
|
96
|
-
filepaths.each
|
|
96
|
+
filepaths.each do |filepath|
|
|
97
97
|
if File.directory?(filepath)
|
|
98
98
|
next
|
|
99
99
|
elsif is_yaml_file? filepath
|
|
@@ -104,15 +104,16 @@ module ConfigFileReader
|
|
|
104
104
|
warn "[WARN] Ignore config file <#{filepath}>. No yaml or json extension!"
|
|
105
105
|
next
|
|
106
106
|
end
|
|
107
|
-
|
|
107
|
+
end
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
def self.read_included_yaml_file(filepath)
|
|
111
111
|
begin
|
|
112
112
|
data = YAML.load(File.open(filepath))
|
|
113
113
|
rescue => e
|
|
114
|
-
warn "[ERROR]
|
|
115
|
-
warn "[ERROR]
|
|
114
|
+
warn "[ERROR] Reading configurations from yaml:"
|
|
115
|
+
warn "[ERROR] - File : #{filepath}"
|
|
116
|
+
warn "[ERROR] - Type : #{e}"
|
|
116
117
|
exit 1
|
|
117
118
|
end
|
|
118
119
|
data[:tt_source_file] = relative_path(filepath)
|
|
@@ -123,8 +124,9 @@ module ConfigFileReader
|
|
|
123
124
|
begin
|
|
124
125
|
data = JSON.parse(File.read(filepath), symbolize_names: true)
|
|
125
126
|
rescue => e
|
|
126
|
-
warn "[ERROR]
|
|
127
|
-
warn "[ERROR]
|
|
127
|
+
warn "[ERROR] Reading configurations from json:"
|
|
128
|
+
warn "[ERROR] - File : #{filepath}"
|
|
129
|
+
warn "[ERROR] - Type : #{e}"
|
|
128
130
|
exit 1
|
|
129
131
|
end
|
|
130
132
|
data[:tt_source_file] = relative_path(filepath)
|