teuton 3.2.1 → 3.4.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 +18 -20
- data/docs/commands/README.md +12 -10
- data/docs/commands/check.md +17 -15
- data/docs/commands/{readme.md → doc.md} +3 -5
- data/docs/commands/help.md +23 -13
- data/docs/devel/todo.md +2 -8
- data/docs/dsl/README.md +9 -8
- data/docs/dsl/event.md +172 -0
- data/docs/dsl/target.md +0 -14
- data/docs/install/t-node.md +10 -21
- data/docs/learn/01-cmd_new.md +1 -1
- data/docs/learn/02-target.md +52 -50
- data/docs/learn/03-remote_hosts.md +15 -16
- data/docs/learn/04-config.md +70 -69
- data/docs/learn/05-use.md +1 -1
- data/docs/learn/06-cmd_check.md +28 -26
- data/docs/learn/07-target_weight.md +7 -5
- data/docs/learn/08-unique_values.md +32 -30
- data/docs/learn/09-send.md +2 -2
- data/docs/learn/10-debug.md +38 -1
- data/docs/learn/11-export.md +1 -1
- data/docs/learn/12-preserve.md +4 -4
- data/docs/learn/13-feedback.md +12 -11
- data/docs/learn/14-moodle_id.md +3 -3
- data/docs/learn/15-readme.md +12 -12
- data/docs/learn/16-include.md +9 -9
- data/docs/learn/17-alias.md +2 -2
- data/docs/learn/18-log.md +46 -44
- data/docs/learn/19-read_vars.md +1 -1
- data/docs/learn/20-macros.md +1 -1
- data/docs/learn/21-exit_codes.md +1 -1
- data/docs/learn/22-result.md +1 -1
- data/docs/learn/23-test-code.md +14 -11
- data/docs/learn/24-test-sql.md +6 -6
- data/docs/learn/25-expect-result.md +1 -1
- data/docs/learn/26-expect_sequence.md +2 -2
- data/docs/learn/27-run_script.md +9 -6
- data/docs/learn/28-upload.md +3 -1
- data/docs/learn/31-event-stop.md +134 -0
- data/docs/learn/32-event-zero.md +127 -0
- data/docs/more.md +4 -1
- data/lib/teuton/case/{action.rb → action/action.rb} +18 -10
- data/lib/teuton/case/action/manager.rb +198 -0
- data/lib/teuton/case/case.rb +15 -13
- data/lib/teuton/case/close.rb +7 -7
- data/lib/teuton/case/dsl/all.rb +1 -0
- data/lib/teuton/case/dsl/event.rb +5 -0
- data/lib/teuton/case/dsl/expect.rb +6 -4
- data/lib/teuton/case/dsl/log.rb +10 -9
- 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 +10 -3
- 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 +19 -8
- data/lib/teuton/check/dsl/all.rb +10 -16
- data/lib/teuton/check/dsl/event.rb +10 -0
- data/lib/teuton/check/dsl/expect.rb +21 -45
- data/lib/teuton/check/dsl/getset.rb +2 -2
- data/lib/teuton/check/dsl/run.rb +2 -2
- data/lib/teuton/check/dsl/target.rb +17 -0
- data/lib/teuton/check/show.rb +35 -41
- data/lib/teuton/cli/app.rb +16 -8
- data/lib/teuton/readme/dsl/all.rb +16 -2
- 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 +42 -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 +5 -36
- data/lib/teuton/utils/project.rb +4 -3
- data/lib/teuton/version.rb +1 -1
- metadata +14 -7
- data/docs/tutorial/es/nginx/README.md +0 -546
- data/lib/teuton/deprecated/utils.rb +0 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c511c3e1920ec1a32a84db7d3eb244c2b3158cc21f45c6f6992b5b6d3d67cd55
|
|
4
|
+
data.tar.gz: b888a70c354935e13779f2a548e11f0a352c3ac8cc90db2670b53b0b01e57535
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4e0d923a83e0d8befa87a779e64ca9dfddf46b2e50f36761a51f63563e23983ee8883d92e3df3a29bb6fdfbc4eea9984c113fcb5de97406cd4d5ad168e3c694f
|
|
7
|
+
data.tar.gz: f4624afd770821f062673edb9736e580738e8c2ee7ca5ef686a58a838ea1aee8055f8ee29c0874147ef015b8c8a5d571e9ff5bc32ae8b74f46bcf6e60533bd49
|
data/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
# TEUTON
|
|
3
3
|
|
|
4
|
-
[](https://badge.fury.io/rb/teuton)
|
|
4
|
+
[](https://badge.fury.io/rb/teuton)
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
_Test your infrastructure as code._
|
|
7
|
+
_Test your infrastructure as code._
|
|
8
8
|
|
|
9
|
-

|
|
9
|
+

|
|
10
10
|
|
|
11
11
|
The infrastructure test is useful for:
|
|
12
12
|
* Sysadmin teachers who want to evaluate students remote machines.
|
|
@@ -27,12 +27,12 @@ gem install teuton
|
|
|
27
27
|
|
|
28
28
|
```ruby
|
|
29
29
|
# File: examples/02-target/start.rb
|
|
30
|
-
group "
|
|
31
|
-
target "Create user obiwan"
|
|
30
|
+
group "Practicing targets" do
|
|
31
|
+
target "Create user obiwan"
|
|
32
32
|
run "id obiwan"
|
|
33
33
|
expect ["uid=", "(obiwan)", "gid="]
|
|
34
34
|
|
|
35
|
-
target "Delete user vader"
|
|
35
|
+
target "Delete user vader", weight: 2
|
|
36
36
|
run "id vader"
|
|
37
37
|
expect_fail
|
|
38
38
|
end
|
|
@@ -46,18 +46,13 @@ end
|
|
|
46
46
|
**Usage**: Run test with `teuton run TESTPATH`.
|
|
47
47
|
|
|
48
48
|
```console
|
|
49
|
-
$
|
|
50
|
-
------------------------------------
|
|
51
|
-
Started at 2025-12-01 18:14:44 +0000
|
|
52
|
-
F.
|
|
53
|
-
Finished in 0.005 seconds
|
|
54
|
-
------------------------------------
|
|
49
|
+
$ teutonx examples/02-target
|
|
55
50
|
|
|
56
|
-
CASE RESULTS
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
CASE RESULTS
|
|
52
|
+
┌──────┬───────────┬───────┬───────┐
|
|
53
|
+
│ CASE │ MEMBERS │ GRADE │ STATE │
|
|
54
|
+
│ 01 │ anonymous │ 33.0 │ ? │
|
|
55
|
+
└──────┴───────────┴───────┴───────┘
|
|
61
56
|
```
|
|
62
57
|
|
|
63
58
|
**Output**: reports saved into `var/TESTNAME` folder.
|
|
@@ -89,11 +84,11 @@ Consult the generated [output files](examples/02-target/output.d/)
|
|
|
89
84
|
2. Teuton commands
|
|
90
85
|
* [teuton config](docs/commands/config.md): suggest config file.
|
|
91
86
|
* [teuton check](docs/commands/check.md): check test syntax.
|
|
87
|
+
* [teuton doc](docs/commands/doc.md): generate test documentation.
|
|
92
88
|
* [teuton help](docs/commands/help.md): show command help.
|
|
93
89
|
* [teuton new](docs/commands/new.md): create new test.
|
|
94
|
-
* [teuton readme](docs/commands/readme.md): generate test documentation.
|
|
95
90
|
* [teuton run](docs/commands/run.md): run test.
|
|
96
|
-
3.
|
|
91
|
+
3. Learning guide: Learn writing tests. [Examples](examples).
|
|
97
92
|
* [Create NEW test](docs/learn/01-cmd_new.md)
|
|
98
93
|
* [Evaluate TARGET](docs/learn/02-target.md)
|
|
99
94
|
* [Check REMOTE HOSTS](docs/learn/03-remote_hosts.md)
|
|
@@ -108,7 +103,7 @@ Consult the generated [output files](examples/02-target/output.d/)
|
|
|
108
103
|
* [PRESERVE old reports](docs/learn/12-preserve.md)
|
|
109
104
|
* [Hide FEEDBACK from reports](docs/learn/13-feedback.md)
|
|
110
105
|
* [MOODLE](docs/learn/14-moodle_id.md)
|
|
111
|
-
* [Build
|
|
106
|
+
* [Build DOC from test](docs/learn/15-doc.md)
|
|
112
107
|
* [INCLUDE more configuration files](docs/learn/16-include.md)
|
|
113
108
|
* [ALIAS](docs/learn/17-alias.md)
|
|
114
109
|
* [LOG messages](docs/learn/18-log.md)
|
|
@@ -122,10 +117,13 @@ Consult the generated [output files](examples/02-target/output.d/)
|
|
|
122
117
|
* [EXPECT_SEQUENCE](docs/learn/26-expect_sequence.md)
|
|
123
118
|
* [RUN_SCRIPT](docs/learn/27-run_script.md)
|
|
124
119
|
* [UPLOAD](docs/learn/28-upload.md)
|
|
120
|
+
* [EVENT stop](docs/learn/31-event-stop.md)
|
|
121
|
+
* [EVENT scores to zero](docs/learn/32-event-zero.md)
|
|
125
122
|
4. [Configuration file](docs/config_file.md): Reserved params, configure hosts, etc.
|
|
126
123
|
5. [Language reference](docs/dsl/README.md). DSL used to define tests.
|
|
127
124
|
* [expect](docs/dsl/expect.md): check run output with expectations.
|
|
128
125
|
* [export](docs/dsl/export.md): save evaluation reports.
|
|
126
|
+
* [event](docs/dsl/event.md): execute action when conditions are met.
|
|
129
127
|
* [get](docs/dsl/get.md): read config params.
|
|
130
128
|
* [group](docs/dsl/group.md): group targets.
|
|
131
129
|
* [play](docs/dsl/play.md): starts main execution.
|
data/docs/commands/README.md
CHANGED
|
@@ -4,21 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
```
|
|
6
6
|
$ teuton
|
|
7
|
+
|
|
7
8
|
Commands:
|
|
8
|
-
teuton [run] [OPTIONS] DIRECTORY
|
|
9
|
-
teuton check [OPTIONS] DIRECTORY
|
|
10
|
-
teuton config
|
|
11
|
-
teuton
|
|
12
|
-
teuton
|
|
13
|
-
teuton
|
|
14
|
-
teuton
|
|
9
|
+
teuton [run] [OPTIONS] DIRECTORY # Run test from directory
|
|
10
|
+
teuton check [OPTIONS] DIRECTORY # Check test and config file content
|
|
11
|
+
teuton config DIRECTORY # Suggest configuration.
|
|
12
|
+
teuton doc DIRECTORY # Display practice exercise statement
|
|
13
|
+
teuton help [COMMAND] # Describe available commands or one specific command
|
|
14
|
+
teuton new DIRECTORY # Create skeleton for a new project
|
|
15
|
+
teuton tree # Print a tree of all available commands
|
|
16
|
+
teuton version # Show the program version
|
|
15
17
|
```
|
|
16
18
|
|
|
17
19
|
Available command functions:
|
|
18
20
|
1. [run](run.md)
|
|
19
21
|
2. [check](check.md)
|
|
20
22
|
3. [config](config.md)
|
|
21
|
-
4. [
|
|
22
|
-
5. [
|
|
23
|
-
6. [
|
|
23
|
+
4. [doc](doc.md)
|
|
24
|
+
5. [help](help.md)
|
|
25
|
+
6. [new](new.md)
|
|
24
26
|
7. **version**: _Show current version_. Usage: `teuton version`.
|
data/docs/commands/check.md
CHANGED
|
@@ -27,11 +27,12 @@ Alias: `teuton c foo`, `teuton -c foo`, `teuton --check foo`
|
|
|
27
27
|
## Example
|
|
28
28
|
|
|
29
29
|
```
|
|
30
|
-
$ teuton check examples/02-target
|
|
30
|
+
$ teuton check examples/02-target
|
|
31
|
+
|
|
32
|
+
┌────────────────────────────┐
|
|
33
|
+
│ GROUP: Learn about targets │
|
|
34
|
+
└────────────────────────────┘
|
|
31
35
|
|
|
32
|
-
+----------------------------+
|
|
33
|
-
| GROUP: Learn about targets |
|
|
34
|
-
+----------------------------+
|
|
35
36
|
(001) target Create user obiwan
|
|
36
37
|
weight 2.0
|
|
37
38
|
run 'id obiwan' on localhost
|
|
@@ -42,17 +43,18 @@ $ teuton check examples/02-target
|
|
|
42
43
|
run 'id vader' on localhost
|
|
43
44
|
expect_fail
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
|
|
47
|
+
┌──────────────┬───────┐
|
|
48
|
+
│ DSL Stats │ Count │
|
|
49
|
+
├──────────────┼───────┤
|
|
50
|
+
│ Groups │ 1 │
|
|
51
|
+
│ Targets │ 2 │
|
|
52
|
+
│ Runs │ 2 │
|
|
53
|
+
│ * localhost │ 2 │
|
|
54
|
+
└──────────────┴───────┘
|
|
55
|
+
Warn | Configfile not found
|
|
56
|
+
- File: ../examples/02-target/config.yaml
|
|
57
|
+
Info | Recomended content:
|
|
56
58
|
---
|
|
57
59
|
global:
|
|
58
60
|
cases:
|
|
@@ -5,13 +5,11 @@
|
|
|
5
5
|
_Show test info as README file. Useful for create a readme file for the exercise._
|
|
6
6
|
|
|
7
7
|
Usage:
|
|
8
|
-
* `teuton
|
|
9
|
-
* `teuton
|
|
8
|
+
* `teuton doc DIRPATH`
|
|
9
|
+
* `teuton doc DIRPATH > README.md`
|
|
10
10
|
|
|
11
11
|
This function reads test and config files, and generate Markdown output with guidelines and target descriptions about the exercise.
|
|
12
12
|
|
|
13
|
-
Alias: `teuton r DIRPATH`, `teuton -r DIRPATH`, `teuton --readme DIRPATH`
|
|
14
|
-
|
|
15
13
|
## Example
|
|
16
14
|
|
|
17
15
|
Test content:
|
|
@@ -34,7 +32,7 @@ play do
|
|
|
34
32
|
end
|
|
35
33
|
```
|
|
36
34
|
|
|
37
|
-
Generate test documentation: `teuton
|
|
35
|
+
Generate test documentation: `teuton doc examples/02-target`
|
|
38
36
|
|
|
39
37
|
---
|
|
40
38
|
```
|
data/docs/commands/help.md
CHANGED
|
@@ -13,25 +13,35 @@ Alias: `teuton h`,`teuton -h`, `teuton --help`
|
|
|
13
13
|
**Example**: `teuton help`
|
|
14
14
|
```
|
|
15
15
|
Commands:
|
|
16
|
-
teuton [run] [OPTIONS] DIRECTORY
|
|
17
|
-
teuton check [OPTIONS] DIRECTORY
|
|
18
|
-
teuton config
|
|
19
|
-
teuton
|
|
20
|
-
teuton
|
|
21
|
-
teuton
|
|
22
|
-
teuton
|
|
16
|
+
teuton [run] [OPTIONS] DIRECTORY # Run test from directory
|
|
17
|
+
teuton check [OPTIONS] DIRECTORY # Check test and config file content
|
|
18
|
+
teuton config DIRECTORY # Suggest configuration.
|
|
19
|
+
teuton doc DIRECTORY # Display practice exercise statement
|
|
20
|
+
teuton help [COMMAND] # Describe available commands or one specific command
|
|
21
|
+
teuton new DIRECTORY # Create skeleton for a new project
|
|
22
|
+
teuton tree # Print a tree of all available commands
|
|
23
|
+
teuton version # Show the program version
|
|
23
24
|
```
|
|
24
25
|
|
|
25
|
-
**Example**: `teuton help
|
|
26
|
+
**Example**: `teuton help check`
|
|
27
|
+
|
|
26
28
|
```
|
|
27
29
|
Usage:
|
|
28
|
-
teuton
|
|
30
|
+
teuton check [OPTIONS] DIRECTORY
|
|
29
31
|
|
|
30
32
|
Options:
|
|
31
|
-
[--
|
|
33
|
+
[--onlyconfig], [--no-onlyconfig], [--skip-onlyconfig]
|
|
34
|
+
[--color], [--no-color], [--skip-color]
|
|
35
|
+
[--cname=CNAME]
|
|
36
|
+
[--cpath=CPATH]
|
|
32
37
|
|
|
33
38
|
Description:
|
|
34
|
-
|
|
39
|
+
(1) teuton check PATH/TO/DIR , Check content of start.rb and config.yaml files.
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
(2) teuton check PATH/TO/DIR --cname=demo , Check content of start.rb and demo.yaml files:
|
|
42
|
+
|
|
43
|
+
(3) teuton check PATH/TO/DIR --onlyconfig , Only show config file recomendations
|
|
44
|
+
|
|
45
|
+
(4) teuton check PATH/TO/DIR/foo.rb , Check content of foo.rb and foo.yaml files.
|
|
46
|
+
|
|
47
|
+
(5) teuton check PATH/TO/DIR/foo.rb --cname=demo , Check content of foo.rb and demo.yaml files.```
|
data/docs/devel/todo.md
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
[<< back](../../README.md)
|
|
2
2
|
|
|
3
|
-
# Roadmap Teuton v3.
|
|
3
|
+
# Roadmap Teuton v3.3.0 - 2026
|
|
4
4
|
|
|
5
5
|
# 1. Revisar
|
|
6
6
|
|
|
7
7
|
* Revisar (tests): result.grep(a).grep(b)
|
|
8
|
-
* "Limpiar" las funciones "deprecated"
|
|
9
8
|
* Aplicar las recomendaciones del informe de seguridad de Andrés.
|
|
10
9
|
* verify get(:key) and get('key') works fine!
|
|
11
10
|
* Formatter: xml
|
|
12
|
-
* Revisar la utilidad de action.assets al generar README.
|
|
13
11
|
|
|
14
12
|
# 2. Documentacion
|
|
15
13
|
|
|
16
|
-
* Nuevo repo `teuton-book`: para documentación, tutoriales en español.
|
|
17
14
|
* Documentar y hacer videos. Tener foros de la comunidad o presencia en reddit o stackoverflow.... o algo parecido???
|
|
18
15
|
* Snode Dockerfile with SSH server
|
|
19
16
|
* **ngrok**:
|
|
@@ -23,11 +20,8 @@
|
|
|
23
20
|
|
|
24
21
|
# 3. Features
|
|
25
22
|
|
|
26
|
-
## 3.1. teuton
|
|
23
|
+
## 3.1. teuton doc
|
|
27
24
|
|
|
28
|
-
* Renombrar "teuton readme" por "teuton doc".
|
|
29
|
-
* Modificar código, documentación y los ejemplos
|
|
30
|
-
* Modificar los ejemplos de dvarrui/teuton-tests
|
|
31
25
|
* Añadir opciones de lenguaje a `teuton doc`.
|
|
32
26
|
* Por defecto se usará `--lang=en`.
|
|
33
27
|
* Pero poder especificar el idioma usando el paráemetro `lang`. Por ejemplo :`teuton doc --lang=es`
|
data/docs/dsl/README.md
CHANGED
|
@@ -12,19 +12,20 @@ Types:
|
|
|
12
12
|
|
|
13
13
|
## Keyword table
|
|
14
14
|
|
|
15
|
-
| DSL | Type | Descripción
|
|
16
|
-
| :------------------ | :--------: |
|
|
15
|
+
| DSL | Type | Descripción |
|
|
16
|
+
| :------------------ | :--------: | :------------------------------------------ |
|
|
17
17
|
| [expect](expect.md) | Definition | Check the obtained result with the expected value. |
|
|
18
18
|
| [export](export.md) | Execution | Make reports with the results of every evaluation. |
|
|
19
|
-
| [
|
|
20
|
-
| [
|
|
21
|
-
| [
|
|
19
|
+
| [event](./event.md) | Definition | Execute action when conditions are met |
|
|
20
|
+
| [get](get.md) | Settings | Read param value from configuration file. |
|
|
21
|
+
| [group](group.md) | Definition | Define a group of items to check. |
|
|
22
|
+
| [play](play.md) | Execution | Run the challenge. |
|
|
22
23
|
| [result](result.md) | Definition | Contain the output of previous `run` order. |
|
|
23
|
-
| [run](run.md)| Definition | Execute command into remote host or localhost.
|
|
24
|
+
| [run](run.md)| Definition | Execute command into remote host or localhost. |
|
|
24
25
|
| [target](target.md) | Definition | Define a target. This is the item to be checked. |
|
|
25
|
-
| [send](send.md) | Execution | Send copy of report file to remote host.
|
|
26
|
+
| [send](send.md) | Execution | Send copy of report file to remote host. |
|
|
26
27
|
| [set](set.md) | Settings | Set new param value for running configuration. |
|
|
27
|
-
| [show](show.md) | Execution | Show the results on screen.
|
|
28
|
+
| [show](show.md) | Execution | Show the results on screen. |
|
|
28
29
|
|
|
29
30
|
### Programming language
|
|
30
31
|
|
data/docs/dsl/event.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
[<< back](../README.md)
|
|
2
|
+
|
|
3
|
+
# event
|
|
4
|
+
|
|
5
|
+
Sometimes it may be necessary to trigger an action when a specific condition occurs; for this, we can use events.
|
|
6
|
+
|
|
7
|
+
Events are defined using the following structure:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
event on: OBJECT, when: CONDITION do
|
|
11
|
+
ACTION
|
|
12
|
+
end
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Where
|
|
16
|
+
* OBJECT can be `:last_target`
|
|
17
|
+
* CONDITION can be `:failed`
|
|
18
|
+
* And ACTION can be `stop`, `scores_to_zero`, or both.
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
|
|
22
|
+
```ruby
|
|
23
|
+
event on: :last_target, when: :failed do
|
|
24
|
+
stop
|
|
25
|
+
end
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
An event is defined to trigger the `stop` action when the last target fails.
|
|
29
|
+
|
|
30
|
+
The "stop" action halts the test, setting the number of targets yet to be evaluated to zero, while the rest retain their current assessment.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# Events
|
|
34
|
+
|
|
35
|
+
Events are used to define actions that are triggered only when specific conditions are met.
|
|
36
|
+
|
|
37
|
+
Syntax:
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
event on: OBJECT, when: CONDITION do ACTIONS end
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Events consist of three parts:
|
|
44
|
+
|
|
45
|
+
* `on: OBJECT` - defines the object for which the event is being set.
|
|
46
|
+
* `when: CONDITION` - defines the condition that must be met by the OBJECT to trigger the action(s).
|
|
47
|
+
* `do ACTIONS end` – defines the action(s) to be executed when the event is triggered.
|
|
48
|
+
|
|
49
|
+
In the initial version, the following are available:
|
|
50
|
+
|
|
51
|
+
| Type | Element | Description | Status |
|
|
52
|
+
| --------- | -------------- | --------------------------------------- | ------ |
|
|
53
|
+
| OBJECT | last_target | Applies to the last evaluated target | |
|
|
54
|
+
| OBJECT | every_target | Applies to each individual target | TODO |
|
|
55
|
+
| OBJECT | all_targets | Applies to all targets collectively | TODO |
|
|
56
|
+
| CONDITION | failed | The object's state is "failed" | |
|
|
57
|
+
| CONDITION | passed | The object's state is "correct" | |
|
|
58
|
+
| ACTION | scores_to_zero | Resets all points earned so far to zero | |
|
|
59
|
+
| ACTION | stop | Stops the test for this case | |
|
|
60
|
+
|
|
61
|
+
## Example 1: "stop" action
|
|
62
|
+
|
|
63
|
+
Example:
|
|
64
|
+
|
|
65
|
+
```ruby
|
|
66
|
+
group "Target with an exit condition" do
|
|
67
|
+
target "User 'root' exists"
|
|
68
|
+
run "id root"
|
|
69
|
+
expect_ok
|
|
70
|
+
|
|
71
|
+
target "User 'vader' exists", when_fails: :stop
|
|
72
|
+
run "id vader"
|
|
73
|
+
expect_ok
|
|
74
|
+
|
|
75
|
+
event on: :last_target, when: :failed, do
|
|
76
|
+
stop
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
target "User 'mail' exists"
|
|
80
|
+
run "id mail"
|
|
81
|
+
expect_ok
|
|
82
|
+
end
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The test is executed as follows:
|
|
86
|
+
|
|
87
|
+
* target 1: Evaluated and scored.
|
|
88
|
+
* target 2: Evaluated and scored.
|
|
89
|
+
* event:
|
|
90
|
+
* on: :last_target – based on the result of the last target:
|
|
91
|
+
* when: :failed
|
|
92
|
+
* If the result is a failure, the test ends here (for this case).
|
|
93
|
+
* If the result is successful, the process continues normally with target 3.
|
|
94
|
+
* Upon completion:
|
|
95
|
+
* The remaining "targets" are left unevaluated.
|
|
96
|
+
* The final score is derived from both the evaluated and unevaluated targets.
|
|
97
|
+
|
|
98
|
+
## Example 2: "grades_to_zero" action
|
|
99
|
+
|
|
100
|
+
Example:
|
|
101
|
+
|
|
102
|
+
```ruby
|
|
103
|
+
group "Target with an exit condition" do
|
|
104
|
+
target "User 'root' exists"
|
|
105
|
+
run "id root"
|
|
106
|
+
expect_ok
|
|
107
|
+
|
|
108
|
+
target "User 'vader' exists"
|
|
109
|
+
run "id vader"
|
|
110
|
+
expect_ok
|
|
111
|
+
|
|
112
|
+
event on: :last_target, when: :failed, do
|
|
113
|
+
scores_to_zero
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
target "User 'mail' exists"
|
|
117
|
+
run "id mail"
|
|
118
|
+
expect_ok
|
|
119
|
+
end
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
This test is executed as follows:
|
|
123
|
+
|
|
124
|
+
* target 1: Executed and evaluated.
|
|
125
|
+
* target 2: Executed and evaluated.
|
|
126
|
+
* event:
|
|
127
|
+
* on: :last_target — based on the result of the last target:
|
|
128
|
+
* when: :failed
|
|
129
|
+
* If the result is a failure, all "targets" evaluated up to that point are set to zero.
|
|
130
|
+
* If the result is successful, the process continues normally.
|
|
131
|
+
* Upon completion:
|
|
132
|
+
* The remaining unevaluated "targets" are processed.
|
|
133
|
+
* The final score is derived from both the evaluated and unevaluated targets.
|
|
134
|
+
|
|
135
|
+
## Example 3: Combining two actions
|
|
136
|
+
|
|
137
|
+
Example:
|
|
138
|
+
|
|
139
|
+
```ruby
|
|
140
|
+
group "Target with an exit condition" do
|
|
141
|
+
target "User 'root' exists"
|
|
142
|
+
run "id root"
|
|
143
|
+
expect_ok
|
|
144
|
+
|
|
145
|
+
target "User 'vader' exists"
|
|
146
|
+
run "id vader"
|
|
147
|
+
expect_ok
|
|
148
|
+
|
|
149
|
+
event on: :last_target, when: :failed, do
|
|
150
|
+
log "Test stopped due to failure of target 2"
|
|
151
|
+
scores_to_zero
|
|
152
|
+
stop
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
target "User 'mail' exists"
|
|
156
|
+
run "id mail"
|
|
157
|
+
expect_ok
|
|
158
|
+
end
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
This test is executed as follows:
|
|
162
|
+
|
|
163
|
+
* target 1: Executed and evaluated. Target 2: Executed and evaluated.
|
|
164
|
+
* event
|
|
165
|
+
* on: :last_target — based on the outcome of the last target, the following actions are taken:
|
|
166
|
+
* when: :failed
|
|
167
|
+
* If the result is a failure:
|
|
168
|
+
* A message is recorded in the report log.
|
|
169
|
+
* All targets evaluated up to this point are reset to zero,
|
|
170
|
+
* and the test is terminated.
|
|
171
|
+
* In this case, the final score will be zero.
|
|
172
|
+
* If the result is successful, the process continues as normal.
|
data/docs/dsl/target.md
CHANGED
|
@@ -17,17 +17,3 @@ By default weight is `1.0`, but it's posible specified other values:
|
|
|
17
17
|
```ruby
|
|
18
18
|
target "Write here your description", weight: 2.5
|
|
19
19
|
```
|
|
20
|
-
|
|
21
|
-
## [DEPRECATED] Alias
|
|
22
|
-
|
|
23
|
-
`goal` keyword is an alias of `target`. So it's the same:
|
|
24
|
-
|
|
25
|
-
```ruby
|
|
26
|
-
target "Write here your description"
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
or
|
|
30
|
-
|
|
31
|
-
```ruby
|
|
32
|
-
goal "Write here your description"
|
|
33
|
-
```
|
data/docs/install/t-node.md
CHANGED
|
@@ -106,24 +106,13 @@ CMD ["/bin/bash"]
|
|
|
106
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.
|
|
107
107
|
|
|
108
108
|
Manual installation:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
1.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
1.
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
1.
|
|
119
|
-
* (a) `git clone https://github.com/dvarrui/teuton.git` or
|
|
120
|
-
* (b) Download and unzip [file](https://github.com/dvarrui/teuton-panel/archive/master.zip).
|
|
121
|
-
1. Move into Teuton folder
|
|
122
|
-
* Run `cd teuton`
|
|
123
|
-
1. Gems installation.
|
|
124
|
-
* `rake install`, to install required gems.
|
|
125
|
-
1. Only for developers
|
|
126
|
-
* Run `rake devel:debian` or
|
|
127
|
-
* `rake devel:opensuse`, install gem for developers.
|
|
128
|
-
1. Final check
|
|
129
|
-
* `rake`
|
|
109
|
+
|
|
110
|
+
1. Install Git. Run `git --version` to show current version
|
|
111
|
+
1. Install ruby. Run `ruby -v` to show current version (3.2.8)
|
|
112
|
+
1. Install Rake (`gem install rake`), then `rake --version` to show current version (13.4.2).
|
|
113
|
+
1. Clone repo `git clone https://github.com/dvarrui/teuton.git` or download and unzip.
|
|
114
|
+
1. Move into Teuton folder: `cd teuton`
|
|
115
|
+
1. Install gems: `rake install`.
|
|
116
|
+
1. Only Debian OS: `rake devel:debian`.
|
|
117
|
+
1. Obly OpenSUSE OS: `rake devel:opensuse`.
|
|
118
|
+
1. Final check: `rake`
|
data/docs/learn/01-cmd_new.md
CHANGED