teuton 3.0.3 → 3.2.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/config_file.md +20 -19
- data/docs/devel/todo.md +13 -43
- data/docs/install/t-node.md +4 -14
- 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/docs/learn/18-log.md +55 -20
- data/lib/teuton/case/case.rb +2 -2
- data/lib/teuton/case/dsl/expect.rb +1 -1
- data/lib/teuton/case/dsl/expect_sequence.rb +1 -1
- data/lib/teuton/case/dsl/run_script.rb +3 -3
- data/lib/teuton/case/dsl/send.rb +3 -3
- data/lib/teuton/case/dsl/upload.rb +1 -1
- data/lib/teuton/case/execute/execute_base.rb +3 -3
- data/lib/teuton/case_manager/dsl.rb +4 -4
- data/lib/teuton/case_manager/export_manager.rb +6 -8
- data/lib/teuton/case_manager/ext/check_cases.rb +6 -10
- 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 +1 -1
- data/lib/teuton/readme/readme.rb +15 -18
- data/lib/teuton/report/formatter/base_formatter.rb +2 -2
- data/lib/teuton/report/formatter/default/txt.rb +1 -1
- data/lib/teuton/report/formatter/formatter.rb +3 -3
- data/lib/teuton/utils/config_file_reader.rb +17 -17
- 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 -5
- metadata +2 -2
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
|
|
data/docs/devel/todo.md
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* Revisar (tests): result.grep(a).grep(b)
|
|
8
8
|
* "Limpiar" las funciones "deprecated"
|
|
9
9
|
* Aplicar las recomendaciones del informe de seguridad de Andrés.
|
|
10
|
-
* Eliminar/limpiar toda referencia a Vagrant.
|
|
11
10
|
* verify get(:key) and get('key') works fine!
|
|
12
11
|
* Formatter: xml
|
|
13
12
|
|
|
@@ -71,7 +70,7 @@ libs/module
|
|
|
71
70
|
|
|
72
71
|
Modificar el DSL/configuración para mejorar la integración con los contenidores Docker/podman:
|
|
73
72
|
|
|
74
|
-
> * Docker
|
|
73
|
+
> * Docker?? → https://www.cloudbees.com/blog/ssh-into-a-docker-container-how-to-execute-your-commands
|
|
75
74
|
|
|
76
75
|
Host definition example:
|
|
77
76
|
|
|
@@ -147,7 +146,6 @@ var
|
|
|
147
146
|
* Unify messages ERROR, INFO, WARN. etc
|
|
148
147
|
* **TEST**:
|
|
149
148
|
* HallOfFame test
|
|
150
|
-
* actualizar las pruebas con vagrant para la versión actual. Mejora de la calidad del código (Todo lo de Vagrant debería estar deprecated).
|
|
151
149
|
|
|
152
150
|
## 4.3 FEATURE - SAVE STATE
|
|
153
151
|
|
|
@@ -170,48 +168,20 @@ var
|
|
|
170
168
|
* Documentación en https://readthedocs.org/ ??
|
|
171
169
|
* FEATURE: Auto Parse new input format, and detect parse errors
|
|
172
170
|
|
|
171
|
+
## 4.5 Async or Ractors
|
|
172
|
+
|
|
173
|
+
Expandir el modo de ejecución y medir rendimiento:
|
|
174
|
+
|
|
175
|
+
- Secuencial
|
|
176
|
+
- Hilos
|
|
177
|
+
- Fibras
|
|
178
|
+
- Actores
|
|
179
|
+
|
|
173
180
|
# 5. Proyectos
|
|
174
181
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
## 5.1. Nueva gema teuton-panel (v2.0.0)
|
|
180
|
-
|
|
181
|
-
> Consultar en el repostorio `teuton-panel`. EN PROCESO!!!
|
|
182
|
-
|
|
183
|
-
Este TO-DO debería estar en el propio repo de la nueva gema.
|
|
184
|
-
|
|
185
|
-
* Crear nueva gema `teuton-panel` (v2) que sustituirá la versión obsoleta actual.
|
|
186
|
-
* Modificar/ampliar las funciones de `teuton config` para facilitar el trabajo a `teuton-panel`.
|
|
187
|
-
* tt_include
|
|
188
|
-
* tt_include_params
|
|
189
|
-
* aplanar/desaplanar config file.
|
|
190
|
-
* En las pruebas hemos usado `sinatra` para implementarlo.
|
|
191
|
-
|
|
192
|
-
Funcionalidades del interfaz web:
|
|
193
|
-
|
|
194
|
-
* config cases:
|
|
195
|
-
* config/remote:
|
|
196
|
-
* accept-remote-config. activar/desactivar configuraciones remotas
|
|
197
|
-
* Aceptar post formulario y vía get curl con ruta.
|
|
198
|
-
* config/list: mostrar listado con info de alumnos
|
|
199
|
-
* Elegir ubicación de almacenamiento de las configuraciones
|
|
200
|
-
* run:
|
|
201
|
-
* Ejecutar por el profesor
|
|
202
|
-
* Todos
|
|
203
|
-
* Una selección de cases
|
|
204
|
-
* every: repeticiones en bucle de I iteraciones, cada T tiempo.
|
|
205
|
-
* El alumno solicita su propia ejecución vía curl
|
|
206
|
-
* Elegir ubicación de almacenamiento de los informes
|
|
207
|
-
* Al finalizar cada ejecución se muestre un listado con los resultados
|
|
208
|
-
* readme/doc:
|
|
209
|
-
* activar auto "teuton doc" a página web para los alumnos.
|
|
210
|
-
* config panel:
|
|
211
|
-
* panel/new: crear fichero de configuración del panel
|
|
212
|
-
* panel/save: save configuración del panel
|
|
213
|
-
|
|
214
|
-
## 5.2 Editor de tests
|
|
182
|
+
Ideas que emepzaron como un nuevo feature pero por sus dimensiones, funcionalidades y características van ha derivar a su propio proyecto independiente:
|
|
183
|
+
|
|
184
|
+
## 5.1 Editor de tests
|
|
215
185
|
|
|
216
186
|
* Editor de tests ?! .... lo veo complejo... a menos que se empiece por una versión simplificada..
|
|
217
187
|
* El DSL es tan sencillo que no le veo sentido a un editor de retos.
|
data/docs/install/t-node.md
CHANGED
|
@@ -57,19 +57,9 @@ Run this command as admin user (member of `admin` group):
|
|
|
57
57
|
curl -sL https://raw.githubusercontent.com/teuton-software/teuton/master/install/mac/t-node_install.sh | bash
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
## 3.
|
|
60
|
+
## 3. Docker installation
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
## 3.1 Install using Vagrant
|
|
65
|
-
|
|
66
|
-
* First, install `Vagrant` and `VirtualBox` on your host.
|
|
67
|
-
* Create directory for vagrant project. For example, `mkdir teuton-vagrant`.
|
|
68
|
-
* Move into that directory: `cd teuton-vagrant`.
|
|
69
|
-
* Choose and download [Vagrantfile](../../install/vagrant).
|
|
70
|
-
* Run `vagrant up` to create your Virtual Machine.
|
|
71
|
-
|
|
72
|
-
## 3.2 Install using Docker
|
|
62
|
+
## 3.1 Installation
|
|
73
63
|
|
|
74
64
|
First:
|
|
75
65
|
* Install `docker` on your host.
|
|
@@ -84,7 +74,7 @@ Run this command to pull **dvarrui/teuton** image from Docker Hub and create "te
|
|
|
84
74
|
|
|
85
75
|
`docker run --name teuton -v /home/teuton -i -t dvarrui/teuton /bin/bash`
|
|
86
76
|
|
|
87
|
-
## 3.
|
|
77
|
+
## 3.3 Rebuild local docker image
|
|
88
78
|
|
|
89
79
|
1. Create Dockerfile like this:
|
|
90
80
|
|
|
@@ -113,7 +103,7 @@ CMD ["/bin/bash"]
|
|
|
113
103
|
|
|
114
104
|
## 4. Source code
|
|
115
105
|
|
|
116
|
-
If you want to install Teuton by your own, or there are not installation scripts for your OS,
|
|
106
|
+
If you want to install Teuton by your own, or there are not installation scripts for your OS, here you have information how to install all the required packages for Teuton.
|
|
117
107
|
|
|
118
108
|
Manual installation:
|
|
119
109
|
1. Git installation
|
|
@@ -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/docs/learn/18-log.md
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
## Example
|
|
8
8
|
|
|
9
|
+
* Logging ERROR, WARN and INFO messages.
|
|
10
|
+
|
|
9
11
|
```ruby
|
|
10
12
|
group "Learning about log messages" do
|
|
11
13
|
log "Using log messages."
|
|
@@ -21,46 +23,79 @@ group "Learning about log messages" do
|
|
|
21
23
|
end
|
|
22
24
|
```
|
|
23
25
|
|
|
26
|
+
* Logging an Array config param, and a Hash config param:
|
|
27
|
+
|
|
28
|
+
```yaml
|
|
29
|
+
---
|
|
30
|
+
global:
|
|
31
|
+
values1:
|
|
32
|
+
- A1
|
|
33
|
+
- B1
|
|
34
|
+
- C1
|
|
35
|
+
values2:
|
|
36
|
+
p1: A2
|
|
37
|
+
p2: B2
|
|
38
|
+
p3: C2
|
|
39
|
+
cases:
|
|
40
|
+
- tt_members: TOCHANGE
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```ruby
|
|
44
|
+
group "Log: Array, Hash" do
|
|
45
|
+
log "-------------"
|
|
46
|
+
log "Array values : #{get(:values1)}"
|
|
47
|
+
log "Hash values : #{get(:values2)}"
|
|
48
|
+
end
|
|
49
|
+
```
|
|
50
|
+
|
|
24
51
|
## Output
|
|
25
52
|
|
|
26
53
|
Content of `var/18-log/case-01.txt` file.
|
|
27
54
|
|
|
28
|
-
```
|
|
55
|
+
```txt
|
|
29
56
|
CONFIGURATION
|
|
30
|
-
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
57
|
+
+----------------+-----------------------------------+
|
|
58
|
+
| tt_config_path | examples/18-log/config.yaml |
|
|
59
|
+
| tt_members | TOCHANGE |
|
|
60
|
+
| tt_script_path | examples/18-log/start.rb |
|
|
61
|
+
| tt_sequence | false |
|
|
62
|
+
| tt_skip | false |
|
|
63
|
+
| values1 | ["A1", "B1", "C1"] |
|
|
64
|
+
| values2 | {:p1=>"A2", :p2=>"B2", :p3=>"C2"} |
|
|
65
|
+
+----------------+-----------------------------------+
|
|
36
66
|
|
|
37
67
|
LOGS
|
|
38
|
-
[
|
|
39
|
-
[
|
|
40
|
-
[
|
|
41
|
-
[
|
|
42
|
-
[
|
|
68
|
+
[22:35:04] INFO: Using log messages.
|
|
69
|
+
[22:35:04] INFO: uid=1000(david) gid=1000(david) grupos=1000(david),478(wheel),464(vboxusers),108(libvirt),107(qemu),462(vagrant),460(docker),452(ollama)
|
|
70
|
+
[22:35:04] ERROR: Problem detected!
|
|
71
|
+
[22:35:04] WARN!: This is a warning
|
|
72
|
+
[22:35:04] INFO: Hi, there!
|
|
73
|
+
[22:35:04] INFO: -------------
|
|
74
|
+
[22:35:04] INFO: Array values : ["A1", "B1", "C1"]
|
|
75
|
+
[22:35:04] INFO: Hash values : {:p1=>"A2", :p2=>"B2", :p3=>"C2"}
|
|
43
76
|
|
|
44
77
|
GROUPS
|
|
45
78
|
- Learning about log messages
|
|
46
79
|
01 (1.0/1.0)
|
|
47
80
|
Description : Create user david
|
|
48
81
|
Command : id david
|
|
49
|
-
|
|
82
|
+
Output : uid=1000(david) gid=1000(david) grupos=1000(david),478(wheel),464(vboxusers),108(libvirt),107(qemu),462(vagrant),460(docker),452(ollama)
|
|
83
|
+
Duration : 0.005 (local)
|
|
50
84
|
Alterations : find(david) & count
|
|
51
|
-
Expected : Greater than 0
|
|
52
|
-
Result : 1
|
|
85
|
+
Expected : Greater than 0
|
|
86
|
+
Result : 1
|
|
53
87
|
|
|
54
88
|
RESULTS
|
|
55
89
|
+--------------+---------------------------+
|
|
56
|
-
| case_id | 01 |
|
|
57
|
-
| start_time | 2023-01-26 09:14:22 +0000 |
|
|
58
|
-
| finish_time | 2023-01-26 09:14:22 +0000 |
|
|
59
|
-
| duration | 0.002012326 |
|
|
60
90
|
| unique_fault | 0 |
|
|
91
|
+
| case_id | 01 |
|
|
92
|
+
| start_time | 2026-10-12 22:35:04 +0100 |
|
|
93
|
+
| finish_time | 2026-10-12 22:35:04 +0100 |
|
|
94
|
+
| duration | 0.004786563 |
|
|
61
95
|
| max_weight | 1.0 |
|
|
62
96
|
| good_weight | 1.0 |
|
|
63
|
-
| fail_weight | 0
|
|
97
|
+
| fail_weight | 0 |
|
|
64
98
|
| fail_counter | 0 |
|
|
65
99
|
| grade | 100 |
|
|
66
100
|
+--------------+---------------------------+
|
|
101
|
+
```
|
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
|
|
@@ -15,7 +15,7 @@ module DSL
|
|
|
15
15
|
elsif input.instance_of?(String) || input.instance_of?(Regexp) || input.instance_of?(Array)
|
|
16
16
|
expect_any input
|
|
17
17
|
else
|
|
18
|
-
puts Rainbow("[ERROR] Case expect TypeError: <expect #{input} (#{input.class})>").red
|
|
18
|
+
puts Rainbow("[ERROR] Case expect TypeError: <expect #{input} (#{input.class})>").bright.red
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -164,7 +164,7 @@ class ExpectSequence
|
|
|
164
164
|
elsif value.is_a? Regexp
|
|
165
165
|
return true << index if value.match(line)
|
|
166
166
|
else
|
|
167
|
-
puts "[ERROR] expect_sequence #{value.class}"
|
|
167
|
+
puts Rainbow("[ERROR] expect_sequence #{value.class}").bright.red
|
|
168
168
|
exit 1
|
|
169
169
|
end
|
|
170
170
|
false
|
|
@@ -11,8 +11,8 @@ module DSL
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
items = script.split(" ")
|
|
14
|
-
if items.
|
|
15
|
-
msg = Rainbow("
|
|
14
|
+
if items.empty?
|
|
15
|
+
msg = Rainbow("[ERROR] run_script: Incorrect command '#{command}'").bright.red
|
|
16
16
|
verboseln(msg)
|
|
17
17
|
return
|
|
18
18
|
end
|
|
@@ -28,7 +28,7 @@ module DSL
|
|
|
28
28
|
command = items.join(" ")
|
|
29
29
|
run(command, args)
|
|
30
30
|
else
|
|
31
|
-
msg = Rainbow("
|
|
31
|
+
msg = Rainbow("[ERROR] run_script: Incorrect protocol(#{host.protocol})").bright.red
|
|
32
32
|
verboseln(msg)
|
|
33
33
|
end
|
|
34
34
|
end
|
data/lib/teuton/case/dsl/send.rb
CHANGED
|
@@ -38,7 +38,7 @@ module DSL
|
|
|
38
38
|
logfile.write "#{msg}\n"
|
|
39
39
|
logfile.flush
|
|
40
40
|
rescue => e
|
|
41
|
-
msg = Rainbow("==> [FAIL] Case #{get(:tt_members)}: 'scp #{localfilepath}' to #{remotefilepath}").
|
|
41
|
+
msg = Rainbow("==> [FAIL] Case #{get(:tt_members)}: 'scp #{localfilepath}' to #{remotefilepath}").yellow
|
|
42
42
|
msg += "\n--> [ERROR] #{e}"
|
|
43
43
|
verboseln(msg)
|
|
44
44
|
logfile.write "#{msg}\n"
|
|
@@ -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
|
|
@@ -35,7 +35,7 @@ module DSL
|
|
|
35
35
|
verbose(Rainbow("!").green)
|
|
36
36
|
end
|
|
37
37
|
elsif host.protocol != "local"
|
|
38
|
-
msg = Rainbow("==> [ERROR] upload: Incorrect protocol(#{host.protocol})").red
|
|
38
|
+
msg = Rainbow("==> [ERROR] upload: Incorrect protocol(#{host.protocol})").bright.red
|
|
39
39
|
verboseln(msg)
|
|
40
40
|
end
|
|
41
41
|
end
|
|
@@ -46,9 +46,9 @@ class ExecuteBase
|
|
|
46
46
|
begin
|
|
47
47
|
text = ec.convert(text)
|
|
48
48
|
rescue => e
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
warn Rainbow("[ERROR] ExecuteBase: #{e}").bright.red
|
|
50
|
+
warn Rainbow("[ERROR] Declare text encoding. Example:").white
|
|
51
|
+
warn Rainbw("[ERROR] run 'command', on: :host, encoding: 'ISO-8859-1'").white
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
text.split("\n").compact
|
|
@@ -36,10 +36,10 @@ def use(filename)
|
|
|
36
36
|
begin
|
|
37
37
|
require_relative findfiles.first
|
|
38
38
|
Project.value[:uses] << File.basename(findfiles.first)
|
|
39
|
-
rescue => e
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
rescue StandardError => e
|
|
40
|
+
warn Rainbow("[ERROR] case_manager/dsl: #{e}").bright.red
|
|
41
|
+
warn Rainbow("[ERROR] File not found!").white
|
|
42
|
+
warn Rainbow("[ERROR] Fix line <use '#{filename}'>").white
|
|
43
43
|
exit 1
|
|
44
44
|
end
|
|
45
45
|
end
|
|
@@ -15,18 +15,16 @@ class ExportManager
|
|
|
15
15
|
# @param input (Hash) Selected export options
|
|
16
16
|
def call(main_report, cases, args)
|
|
17
17
|
if args.class != Hash
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
warn Rainbow("[ERROR] ExportManager: argument error!").bright.red
|
|
19
|
+
warn Rainbow("[ERROR] Fix line <export #{args}>").white
|
|
20
|
+
warn Rainbow("[ERROR] Replace by <export format: 'txt'>").white
|
|
21
|
+
warn ""
|
|
22
22
|
exit 1
|
|
23
23
|
end
|
|
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
|