teuton 2.3.5 → 2.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -5
- data/bin/teuton +1 -1
- data/docs/CHANGELOG.md +8 -0
- data/docs/changelog/v2.4.md +16 -0
- data/docs/dsl/definition/expect.md +11 -7
- data/docs/dsl/definition/result.md +7 -6
- data/docs/dsl/definition/run_local.md +0 -1
- data/docs/dsl/definition/target.md +1 -1
- data/docs/dsl/execution/export.md +14 -16
- data/docs/dsl/execution/send.md +12 -12
- data/docs/dsl/setting/get.md +5 -5
- data/docs/es/exit_code.md +59 -0
- data/docs/es/guess_os.md +28 -0
- data/docs/{Challenge-Server-Project.md → ideas/Challenge-Server-Project.md} +0 -0
- data/docs/{changelog → ideas}/contributions.md +0 -0
- data/docs/{changelog → ideas}/ideas.md +0 -0
- data/docs/{changelog → ideas}/servidor-de-retos.md +0 -0
- data/docs/learn/{example-01-target.md → 01-target.md} +1 -3
- data/docs/learn/{example-02-config.md → 02-config.md} +1 -3
- data/docs/learn/{example-03-remote-hosts.md → 03-remote_hosts.md} +10 -10
- data/docs/learn/{example-04-new-test.md → 04-new_test.md} +8 -16
- data/docs/learn/{example-05-use.md → 05-use.md} +1 -3
- data/docs/learn/{example-06-debug.md → 06-debug.md} +1 -3
- data/docs/learn/{example-07-log.md → 07-log.md} +1 -3
- data/docs/learn/{example-08-readme.md → 08-readme.md} +1 -3
- data/docs/learn/{example-09-preserve.md → 09-preserve.md} +7 -4
- data/docs/learn/10-result.md +36 -0
- data/docs/learn/11-moodle_id.md +19 -0
- data/docs/learn/12-get_vars.md +37 -0
- data/docs/learn/13-include.md +59 -0
- data/docs/learn/16-exit_codes.md +24 -0
- data/docs/learn/README.md +19 -17
- data/lib/teuton/application.rb +24 -17
- data/lib/teuton/case_manager/case/builtin/main.rb +2 -3
- data/lib/teuton/case_manager/case/builtin/package.rb +2 -3
- data/lib/teuton/case_manager/case/builtin/service.rb +4 -5
- data/lib/teuton/case_manager/case/builtin/teuton_file.rb +3 -4
- data/lib/teuton/case_manager/case/builtin/teuton_host.rb +5 -6
- data/lib/teuton/case_manager/case/builtin/user.rb +1 -2
- data/lib/teuton/case_manager/case/case.rb +27 -27
- data/lib/teuton/case_manager/case/close.rb +2 -2
- data/lib/teuton/case_manager/case/config.rb +14 -14
- data/lib/teuton/case_manager/case/dsl/expect.rb +46 -39
- data/lib/teuton/case_manager/case/dsl/goto.rb +2 -2
- data/lib/teuton/case_manager/case/dsl/log.rb +5 -6
- data/lib/teuton/case_manager/case/dsl/macro.rb +11 -7
- data/lib/teuton/case_manager/case/dsl/main.rb +8 -8
- data/lib/teuton/case_manager/case/dsl/send.rb +12 -14
- data/lib/teuton/case_manager/case/dsl/unique.rb +1 -3
- data/lib/teuton/case_manager/case/main.rb +5 -5
- data/lib/teuton/case_manager/case/play.rb +1 -1
- data/lib/teuton/case_manager/case/result/ext_array.rb +9 -9
- data/lib/teuton/case_manager/case/result/ext_compare.rb +44 -58
- data/lib/teuton/case_manager/case/result/ext_filter.rb +20 -8
- data/lib/teuton/case_manager/case/result/result.rb +19 -18
- data/lib/teuton/case_manager/case/runner.rb +53 -60
- data/lib/teuton/case_manager/case_manager.rb +15 -15
- data/lib/teuton/case_manager/check_cases.rb +1 -4
- data/lib/teuton/case_manager/dsl.rb +5 -5
- data/lib/teuton/case_manager/export_manager.rb +8 -19
- data/lib/teuton/case_manager/hall_of_fame.rb +4 -6
- data/lib/teuton/case_manager/main.rb +4 -5
- data/lib/teuton/case_manager/report.rb +21 -16
- data/lib/teuton/case_manager/show.rb +2 -2
- data/lib/teuton/case_manager/utils.rb +13 -14
- data/lib/teuton/check/builtin.rb +5 -1
- data/lib/teuton/check/dsl.rb +10 -11
- data/lib/teuton/check/laboratory.rb +13 -15
- data/lib/teuton/check/show.rb +33 -35
- data/lib/teuton/cli.rb +31 -35
- data/lib/teuton/files/start.rb +3 -6
- data/lib/teuton/readme/dsl.rb +12 -6
- data/lib/teuton/readme/lang.rb +20 -21
- data/lib/teuton/readme/readme.rb +40 -42
- data/lib/teuton/report/close.rb +1 -8
- data/lib/teuton/report/formatter/array_formatter.rb +28 -39
- data/lib/teuton/report/formatter/base_formatter.rb +2 -13
- data/lib/teuton/report/formatter/csv_formatter.rb +12 -18
- data/lib/teuton/report/formatter/formatter_factory.rb +31 -29
- data/lib/teuton/report/formatter/html_formatter.rb +37 -21
- data/lib/teuton/report/formatter/json_formatter.rb +2 -8
- data/lib/teuton/report/formatter/list_formatter.rb +6 -12
- data/lib/teuton/report/formatter/moodle_csv_formatter.rb +3 -6
- data/lib/teuton/report/formatter/resume_array_formatter.rb +1 -1
- data/lib/teuton/report/formatter/resume_html_formatter.rb +29 -19
- data/lib/teuton/report/formatter/resume_json_formatter.rb +2 -3
- data/lib/teuton/report/formatter/resume_list_formatter.rb +4 -4
- data/lib/teuton/report/formatter/resume_txt_formatter.rb +14 -18
- data/lib/teuton/report/formatter/resume_yaml_formatter.rb +1 -9
- data/lib/teuton/report/formatter/txt_formatter.rb +19 -22
- data/lib/teuton/report/formatter/xml_formatter.rb +29 -37
- data/lib/teuton/report/formatter/yaml_formatter.rb +2 -12
- data/lib/teuton/report/report.rb +10 -10
- data/lib/teuton/report/show.rb +14 -33
- data/lib/teuton/skeleton.rb +6 -14
- data/lib/teuton/utils/configfile_reader.rb +22 -21
- data/lib/teuton/utils/name_file_finder.rb +21 -26
- data/lib/teuton/utils/verbose.rb +1 -2
- data/lib/teuton/version.rb +3 -4
- data/lib/teuton.rb +5 -6
- metadata +60 -86
- data/bin/check_teuton +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec3ce7a6b9c34c5ee3aba1203009dbe2a9c334e413ad695795f73e351fd466f0
|
4
|
+
data.tar.gz: 99d57501268057252084f3175a3f728e855200fc0319714229fb2f820e1ffef3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a476ced60b6439210596dcf224d3dcac7f27edf63b6683f3dd32458f173afd27e33d434f1611ff8572659440f96a96ad0078ff549ce3f3b2e113bf0c0e77cb82
|
7
|
+
data.tar.gz: 3c4d5866483aa04ec9559992c4cf5512a095c91b61a7058f454f511865c82d7d14e8986be87d2bb3f9a06d9828079066144be373b8307caca719443eafe179d5
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/teuton.svg)](https://badge.fury.io/rb/teuton)
|
3
3
|
![GitHub](https://img.shields.io/github/license/dvarrui/teuton)
|
4
|
-
![Gem](https://img.shields.io/gem/dv/teuton/2.3.
|
4
|
+
![Gem](https://img.shields.io/gem/dv/teuton/2.3.6)
|
5
5
|
|
6
6
|
# TEUTON
|
7
7
|
|
@@ -22,12 +22,12 @@ Teuton allow us:
|
|
22
22
|
# Documentation
|
23
23
|
|
24
24
|
* [Installation](https://github.com/teuton-software/teuton/tree/master/docs/install/README.md)
|
25
|
-
|
26
|
-
|
25
|
+
* Install Ruby on your system.
|
26
|
+
* Install Teuton as normal user: `gem install --user-install teuton` (or install as superuser `gem install teuton`).
|
27
27
|
* [Videos, blogs, news](docs/videos.md)
|
28
28
|
* [Learning](docs/learn/README.md)
|
29
29
|
* [Commands](docs/commands/README.md)
|
30
|
-
* [
|
30
|
+
* [Language reference](docs/dsl/README.md)
|
31
31
|
|
32
32
|
# Features
|
33
33
|
|
@@ -39,4 +39,3 @@ Teuton allow us:
|
|
39
39
|
# Contact
|
40
40
|
|
41
41
|
* **Email**: `teuton.software@protonmail.com`
|
42
|
-
* **Twitter**: `@SoftwareTeuton`
|
data/bin/teuton
CHANGED
data/docs/CHANGELOG.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
## [2.4.0]
|
3
|
+
|
4
|
+
New features:
|
5
|
+
- Add new DSL keyword: expect_last, expect_fisrt
|
6
|
+
- New doc and example: learn-15-exit_codes
|
7
|
+
- Remove os gem.
|
8
|
+
- Change test output colors to green as use others test tools.
|
9
|
+
|
10
|
+
Bug fixed:
|
11
|
+
- All "expect*" keywords must require 2 arguments. The second is optional.
|
12
|
+
|
13
|
+
Revise
|
14
|
+
- Remove colors to log text
|
15
|
+
- teuton readme: macros, getvars, expect_last, expect_first
|
16
|
+
- Formatter: xml, csv, list, etc.
|
@@ -32,13 +32,17 @@ expect 'obiwan' # Expect previous command output contains obiwan text
|
|
32
32
|
|
33
33
|
## Basic
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
35
|
+
| Command | Description |
|
36
|
+
| ------- | ----------- |
|
37
|
+
| expect "yoda" or expect_any "yoda" | one or more line/s with "yoda" |
|
38
|
+
| expect ["obiwan", "kenobi"] | one or more line/s with "obiwan" and kenobi" |
|
39
|
+
| expect_first "episode" | the first line with "episode" |
|
40
|
+
| expect_last "episode" | the last line with "episode" |
|
41
|
+
| expect_one "rogue" | only one line with "rogue" |
|
42
|
+
| expect_one ["obiwan","kenobi"] | only one line with "obiwan" and "kenobi" |
|
43
|
+
| expect_none "vader"| no line with "vader" |
|
44
|
+
| expect_none ["darth", "vader"] | no line with "darth" and "vader" |
|
45
|
+
| expect /Obiwan\|obi-wan/ | one or more line/s with Obiwan or obi-wan. This example uses regular expresions. |
|
42
46
|
|
43
47
|
## Advanced
|
44
48
|
|
@@ -68,21 +68,22 @@ result.grep_v("nologin").grep("/bin/bash").count.gt 0
|
|
68
68
|
|
69
69
|
| Function | VALUE type | Description |
|
70
70
|
| -------------------- | ----------- | ------------------------------------- |
|
71
|
+
| `result.count` | | Count lines from result and save this number into result object. |
|
72
|
+
| `result.first` | | Remove all lines except first one.|
|
71
73
|
| `result.find(VALUE)` | String | Filter lines that contains VALUE text |
|
72
74
|
| | RegExp | Filter lines that match VALUE regexp. For example `/?ello]`, filter lines with "Hello" or "hello" |
|
73
75
|
| | Array | Apply filter to every array element. For example `["Hi","Hello"]`, filter lines with "Hi" or "Hello". |
|
74
|
-
| `result.grep(VALUE)` |
|
76
|
+
| `result.grep(VALUE)` | String, RegExp, Array | Same as find |
|
77
|
+
| `result.grep_v(VALUE)` | String, RegExp, Array | Same as not_find |
|
78
|
+
| `result.last` | | Remove all lines except last one.|
|
75
79
|
| `result.not_find(VALUE)` | | Filter lines that not contains VALUE. VALUE may be String, Regular Expresion or an Array. |
|
76
|
-
| `result.grep_v(VALUE)` | | Same as not_find |
|
77
|
-
| `result.count` | | Count lines from result and save this number into result object. |
|
78
80
|
| `result.restore` | | Restore result data. After every filtering action result is modified, but this function restore data to their original state. |
|
79
81
|
|
80
82
|
**Information functions:**
|
81
83
|
|
82
84
|
| Function | Description |
|
83
85
|
| -------------------- | --------------------------------- |
|
84
|
-
| `result.exitstatus` | Return exit code from the last command executed by run statement |
|
85
|
-
| `result.value` | Return first output line or value |
|
86
|
-
| `result.content` | Return all output lines |
|
87
86
|
| `result.alterations` | Return transformations applied to the output |
|
87
|
+
| `result.content` | Return all output lines |
|
88
88
|
| `result.debug` | Print the result content on screen. Usefull for debugging process |
|
89
|
+
| `result.value` | Return first output line or value |
|
@@ -22,7 +22,7 @@ target "Write here your description"
|
|
22
22
|
By default weight is 1.0, but it's posible specified other value:
|
23
23
|
|
24
24
|
```ruby
|
25
|
-
target "Write here your description", :
|
25
|
+
target "Write here your description", weight: 2.5
|
26
26
|
```
|
27
27
|
|
28
28
|
## [DEPRECATED] Alias
|
@@ -23,7 +23,7 @@ Run test and build reports using `html` output format:
|
|
23
23
|
|
24
24
|
```ruby
|
25
25
|
play do
|
26
|
-
export :
|
26
|
+
export format: :html
|
27
27
|
end
|
28
28
|
```
|
29
29
|
|
@@ -37,18 +37,16 @@ end
|
|
37
37
|
| | Command | Description |
|
38
38
|
| -- | ------------------------ | ----------- |
|
39
39
|
| 01 | `export` | Export report files using default ouput format |
|
40
|
-
| 02 | `export :
|
41
|
-
| 03 | `export :
|
42
|
-
| 04 | `export :
|
43
|
-
| 05 | `export :
|
44
|
-
| 06 | `export :
|
45
|
-
| 07 | `export :
|
46
|
-
| 08 | `export :
|
47
|
-
| 09 | `export format:
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
| 17 | `export preserve: true` | Same as 07 |
|
54
|
-
| 18 | `export format: "html", preserve: true` | Same as 08 |
|
40
|
+
| 02 | `export format: :txt` | Export file using TXT ouput format |
|
41
|
+
| 03 | `export format: :html` | Export file using HTML ouput format |
|
42
|
+
| 04 | `export format: :yaml` | Export file using YAML ouput format |
|
43
|
+
| 05 | `export format: :json` | Export file using JSON ouput format |
|
44
|
+
| 06 | `export format: :colored_text` | Export file using colored TXT ouput format |
|
45
|
+
| 07 | `export preserve: true` | Same as 01 example buy preserving report copies |
|
46
|
+
| 08 | `export format: :html, preserve: true` | Same as 03 example but preserving report copies |
|
47
|
+
| 09 | `export format: "txt"` | Same as 02 |
|
48
|
+
| 10 | `export format: "html"` | Same as 03 |
|
49
|
+
| 11 | `export format: "yaml"` | Same as 04 |
|
50
|
+
| 12 | `export format: "json"` | Same as 05 |
|
51
|
+
| 13 | `export format: "colored_text"` | Same as 06 |
|
52
|
+
| 14 | `export format: "html", preserve: true` | Same as 08 |
|
data/docs/dsl/execution/send.md
CHANGED
@@ -14,13 +14,13 @@
|
|
14
14
|
```ruby
|
15
15
|
start do
|
16
16
|
export
|
17
|
-
send :
|
17
|
+
send copy_to: :host1
|
18
18
|
end
|
19
19
|
```
|
20
20
|
|
21
21
|
* `send` instruction must be execute after `export`. Reports must be generated before send them, of course.
|
22
22
|
* `host1`, it' the label that identified remote host. This information must be configured into config file.
|
23
|
-
* `send :
|
23
|
+
* `send copy_to: :host1`, copy every case resport file into temp directory on remote host `host1`.
|
24
24
|
|
25
25
|
## Example
|
26
26
|
|
@@ -38,8 +38,8 @@ Example 2: send report file to remote "./Desktop" folder.
|
|
38
38
|
|
39
39
|
| Action | Description |
|
40
40
|
| ------ | ----------- |
|
41
|
-
| `send :
|
42
|
-
| `send :
|
41
|
+
| `send copy_to: :host1, remote_dir: "/home/david"` | Reports will be saved into "/home/david" directory in remote machine `host1`. |
|
42
|
+
| `send copy_to: :host1, prefix: "samba_"` | Case report will be save into temp directory on every host `host1`, named as `samba_case-XX.txt`. |
|
43
43
|
|
44
44
|
> Teuton version 2.0.x
|
45
45
|
> * By default, `send` only works when remote OS type is UNIX base, like GNU/Linux, MACOS, BSD, etc.
|
@@ -49,14 +49,14 @@ Example 2: send report file to remote "./Desktop" folder.
|
|
49
49
|
|
50
50
|
If you export several files using differents output formats, you will use several `export` orders. Then when invoke `send` order, this will send the last exported file.
|
51
51
|
|
52
|
-
In this example we export
|
52
|
+
In this example we export html and txt files, but only send txt to remote hosts:
|
53
53
|
|
54
54
|
```ruby
|
55
55
|
start do
|
56
|
-
export :
|
57
|
-
export :
|
56
|
+
export format: :json
|
57
|
+
export format: :txt
|
58
58
|
|
59
|
-
send :
|
59
|
+
send copy_to: :host1
|
60
60
|
end
|
61
61
|
```
|
62
62
|
|
@@ -64,10 +64,10 @@ If you want to send every exported output file, then do like this:
|
|
64
64
|
|
65
65
|
```ruby
|
66
66
|
start do
|
67
|
-
export :
|
68
|
-
send :
|
67
|
+
export format: :html
|
68
|
+
send copy_to: :host1
|
69
69
|
|
70
|
-
export :
|
71
|
-
send :
|
70
|
+
export format: :txt
|
71
|
+
send copy_to: :host1
|
72
72
|
end
|
73
73
|
```
|
data/docs/dsl/setting/get.md
CHANGED
@@ -37,16 +37,16 @@ Supossing we are **case 01**, then:
|
|
37
37
|
**Writting example**: We also can create new temporal params:
|
38
38
|
|
39
39
|
```ruby
|
40
|
-
set(:
|
41
|
-
var = get(:
|
40
|
+
set(:name, "Obiwan")
|
41
|
+
var = get(:name)
|
42
42
|
```
|
43
43
|
|
44
|
-
So `var` value is "
|
44
|
+
So `var` value is "Obiwan".
|
45
45
|
|
46
46
|
**Simpler reading example**: Other ways or reading param values:
|
47
47
|
|
48
48
|
```ruby
|
49
|
-
var =
|
49
|
+
var = _name
|
50
50
|
```
|
51
51
|
|
52
|
-
So `var` value is "
|
52
|
+
So `var` value is "Obiwan" too. `_name` is an alias of `get(:name)`.
|
@@ -0,0 +1,59 @@
|
|
1
|
+
|
2
|
+
# Exit code
|
3
|
+
|
4
|
+
## Introducción
|
5
|
+
|
6
|
+
Exit code o código de salida es un valor numérico que devuelven los programas cuando terminan su ejecución. Por defecto, el valor 0 indica que el programa/comando ha terminado correctamente. Un valor distinto de cero indica que ha ocurrido alguna situación inesperada o error, y su significado dependerá de cada programa concreto.
|
7
|
+
|
8
|
+
En SO GNU/Linux para consultar por terminal este valor hacemos `echo $?`. Veamos dos ejemplos:
|
9
|
+
|
10
|
+
* Ejemplo que termina correctamente:
|
11
|
+
```
|
12
|
+
> id root
|
13
|
+
uid=0(root) gid=0(root) grupos=0(root)
|
14
|
+
> echo $?
|
15
|
+
0
|
16
|
+
```
|
17
|
+
|
18
|
+
* Ejemplo que termina con error:
|
19
|
+
```
|
20
|
+
> id vader
|
21
|
+
id: «vader»: no existe ese usuario
|
22
|
+
> echo $?
|
23
|
+
1
|
24
|
+
```
|
25
|
+
|
26
|
+
## Solicitud de nueva feature
|
27
|
+
|
28
|
+
Se nos ha solicitado incorporar en `Teuton` la opción de leer no sólo la salida del comando que se ejecuta con la instrucción `run`, sino también el valor devuelto por el **exit code** del mismo.
|
29
|
+
|
30
|
+
De momento no está implementado porque la forma de leer el valor exit code es diferente en cada SO, y `Teuton` (de momento) no tiene capacidad de "adivinar" el SO del host que se está monitorizando/evaluando.
|
31
|
+
|
32
|
+
> NOTA: Estamos trabajando en adivinar el SO de host con la nueva herramienta [guess_os](https://rubygems.org/gems/guess_os), pero todavía está un poco "verde".
|
33
|
+
|
34
|
+
_¿Cómo solucionamos el problema de leer el exit code en Teuton?_
|
35
|
+
|
36
|
+
## Propuesta
|
37
|
+
|
38
|
+
De momento hacemos la siguiente propuesta (hay varias formas de afrontarlo) para leer el exit code con `Teuton`.
|
39
|
+
|
40
|
+
> NOTA: Para hacerlo todo más sencillo hemos creado dos instrucciones nuevas `expect_last` y `expect_first`.
|
41
|
+
|
42
|
+
* Veamos un ejemplo que devuelve 0:
|
43
|
+
```ruby
|
44
|
+
target "Exist user root"
|
45
|
+
run "id root;echo $?"
|
46
|
+
expect_last "0"
|
47
|
+
```
|
48
|
+
* Veamos un ejemplo que devuelve 1:
|
49
|
+
```ruby
|
50
|
+
target "Exist user vader"
|
51
|
+
run "id vader;echo $?"
|
52
|
+
expect_last "1"
|
53
|
+
```
|
54
|
+
|
55
|
+
> https://github.com/teuton-software/teuton/blob/master/docs/learn/example-15-exit_codes.md
|
56
|
+
|
57
|
+
## Observaciones
|
58
|
+
|
59
|
+
Estos ejemplos se probaron en GNU/Linux pero para que sirvan en Windows, etc, hay que cambiar `echo $?` por su equivalente en cada SO.
|
data/docs/es/guess_os.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
# guess_os: Adivinar el sistema operativo
|
3
|
+
|
4
|
+
## Situación actual
|
5
|
+
|
6
|
+
Cuando usamos `Teuton`, escribimos comandos que se ejecutarán en el host que deseamos monitorizar/evaluar. Estos comandos sabemos cómo escribirlos porque conocemos de antemano el SO de nuestro host.
|
7
|
+
|
8
|
+
`Teuton` (de momento) no tiene la capacidad de "adivinar" el SO del host, ni aún conociéndolo, tampoco tiene el conocimiento para saber qué comandos son válidos para cada SO, ni cómo convertir comandos de un SO en otro.
|
9
|
+
|
10
|
+
## Propuesta
|
11
|
+
|
12
|
+
A pesar de todo, al recibir solicitudes en esta línea nos hemos puesto a trabajar en un módulo para intentar "adivinar" el SO de una máquina local o remota(SSH), y hemos creado [guess_os](https://rubygems.org/gems/guess_os).
|
13
|
+
|
14
|
+
Es la primera versión y de momento sólo reconoce correctamente algunos SO/versiones pero no todos. Tiene mucho que mejorar y por este motivo les pedimos un poco de colaboración (sólo te llevará unos minutos).
|
15
|
+
|
16
|
+
1. Instalar `guess_os` en tu equipo (`gem install --user-install guess_os`).
|
17
|
+
2. Ejecutar el comando `guess_os`.
|
18
|
+
3. Pulsar ENTER en la pregunta de IP, para adivinar el SO de la máquina local (localhost).
|
19
|
+
* Si el resultado devuelto coincide con la realidad ¡Estupendo! Ya puedes desintalar la gema si quieres (`gem uninstall guess_os`) o la puedes seguir probando y reportarnos fallos/ideas/mejoras/etc.
|
20
|
+
* Si el resultado devuelto NO coincide con lo que debe salir... entonces envíanos los datos de tu sistema y los que devuelve `guess_os` para ir mejorando esta herramienta.
|
21
|
+
|
22
|
+
¡Gracias!
|
23
|
+
|
24
|
+
```
|
25
|
+
Contacto
|
26
|
+
email : teuton.software@protonmail.com
|
27
|
+
Telegram : @TeutonSoftware
|
28
|
+
```
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,8 +1,6 @@
|
|
1
1
|
[<< back](README.md)
|
2
2
|
|
3
|
-
# Example:
|
4
|
-
|
5
|
-
> This example is on GitHub repository at `examples/learn-03-remote-hosts`.
|
3
|
+
# Example: 03-remote-hosts
|
6
4
|
|
7
5
|
Summary:
|
8
6
|
* Check a group of remote hosts.
|
@@ -47,7 +45,6 @@ Define 3 targets (items to be checked):
|
|
47
45
|
|
48
46
|
```ruby
|
49
47
|
group "How to test remote Windows hosts" do
|
50
|
-
|
51
48
|
target "Update hostname with #{gett(:host1_hostname)}"
|
52
49
|
run "hostname", on: :host1
|
53
50
|
expect_one get(:host1_hostname)
|
@@ -59,7 +56,6 @@ group "How to test remote Windows hosts" do
|
|
59
56
|
target "Create user #{gett(:username)}"
|
60
57
|
run "net user", on: :host1
|
61
58
|
expect get(:username)
|
62
|
-
|
63
59
|
end
|
64
60
|
```
|
65
61
|
|
@@ -71,15 +67,19 @@ end
|
|
71
67
|
play do
|
72
68
|
show
|
73
69
|
# export using other output formats
|
74
|
-
export :
|
75
|
-
export :
|
76
|
-
send :
|
70
|
+
export format: :txt
|
71
|
+
export format: :html
|
72
|
+
send copy_to: :host1
|
77
73
|
end
|
78
74
|
```
|
79
75
|
|
80
76
|
* `show`, show process log on screen.
|
81
|
-
* `export :
|
82
|
-
* `
|
77
|
+
* `export format: :txt`, create output reports files into `var/learn-03-remote-host/` directory using `txt` format.
|
78
|
+
* `export format: :html`, create output reports into `var/learn-03-remote-host/` directory using `html` format.
|
79
|
+
|
80
|
+
> Several output formats available: txt, colored_text, html, json and yaml.
|
81
|
+
|
82
|
+
* `send copy_to: :host1` keyword copy output report into remote machine (host1).
|
83
83
|
|
84
84
|
## Results
|
85
85
|
|
@@ -1,9 +1,7 @@
|
|
1
1
|
|
2
2
|
[<< back](README.md)
|
3
3
|
|
4
|
-
# Example:
|
5
|
-
|
6
|
-
> This example is on GitHub repository at `examples/learn-04-new-test`.
|
4
|
+
# Example: 04-new_test
|
7
5
|
|
8
6
|
Steps:
|
9
7
|
1. Create skeleton
|
@@ -41,12 +39,10 @@ This command will create:
|
|
41
39
|
Write your own targets using the keywords: `target`, `run` and `expect`. Let's see:
|
42
40
|
|
43
41
|
```ruby
|
44
|
-
group "
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
expect ["/home/david", "directory"]
|
49
|
-
|
42
|
+
group "Create new test" do
|
43
|
+
target "Exist </home/vader> directory"
|
44
|
+
run "file /home/vader", on: :host1
|
45
|
+
expect_none "No such file or directory"
|
50
46
|
end
|
51
47
|
```
|
52
48
|
|
@@ -54,12 +50,10 @@ The above example checks if exists '/home/david' directory, into *host1* device.
|
|
54
50
|
|
55
51
|
> Let's see the keywords used:
|
56
52
|
>
|
57
|
-
> * `target "Exist </home/
|
53
|
+
> * `target "Exist </home/vader> directory"`, Describe the target with our words, so every one could easily understand what we are trying
|
58
54
|
to check.
|
59
|
-
> * `run "file /home/
|
60
|
-
> * `
|
61
|
-
|
62
|
-
---
|
55
|
+
> * `run "file /home/vader", on: :host1`, : Execute the command into the remote machine (host1).
|
56
|
+
> * ` expect_none "No such file or directory"`: Compare command ouput with our expectations.
|
63
57
|
|
64
58
|
## STEP 3: Personalize Configfile
|
65
59
|
|
@@ -82,8 +76,6 @@ Use a YAML file (`foo/config.yaml`) or JSON for your own configurations. In this
|
|
82
76
|
|
83
77
|
> The above file configures 2 differents cases with their own params. The script use this information when execute every case.
|
84
78
|
|
85
|
-
---
|
86
|
-
|
87
79
|
## STEP 4: run the challenge
|
88
80
|
|
89
81
|
Now we only have to run the challenge:
|
@@ -1,10 +1,10 @@
|
|
1
1
|
[<< back](README.md)
|
2
2
|
|
3
|
-
# Example:
|
3
|
+
# Example: 09-preserve
|
4
4
|
|
5
|
-
|
5
|
+
Every time we run teuton test, older output report files are overwritten with new reports. if you want to preserve old versions then use `preserve`.
|
6
6
|
|
7
|
-
|
7
|
+
With `preserve` option we keep older copies.
|
8
8
|
|
9
9
|
1. [Execution section](#execution-section)
|
10
10
|
2. [Result](#result)
|
@@ -20,6 +20,7 @@ end
|
|
20
20
|
```
|
21
21
|
|
22
22
|
> More information about [export](../dsl/execution/export.md) keyword.
|
23
|
+
|
23
24
|
## Result
|
24
25
|
|
25
26
|
Example, executing `teuton run example/learn-09-preserve` twice:
|
@@ -31,7 +32,7 @@ var
|
|
31
32
|
│ ├── case-01.txt
|
32
33
|
│ ├── moodle.csv
|
33
34
|
│ └── resume.txt
|
34
|
-
├──
|
35
|
+
├── 20200519-123039
|
35
36
|
│ ├── case-01.txt
|
36
37
|
│ ├── moodle.csv
|
37
38
|
│ └── resume.txt
|
@@ -39,3 +40,5 @@ var
|
|
39
40
|
├── moodle.csv
|
40
41
|
└── resume.txt
|
41
42
|
```
|
43
|
+
|
44
|
+
* The first time test was launched at 11:30, and second at 12:30 the same day.
|
@@ -0,0 +1,36 @@
|
|
1
|
+
[<< back](README.md)
|
2
|
+
|
3
|
+
# Example: 10-result
|
4
|
+
|
5
|
+
Sometimes it can be useful to look at the information returned by the "run" command. For this we use the **"result" object**.
|
6
|
+
|
7
|
+
**Example 1:** In this example we run the "hostname" command on the machine and capture its output using "result". We'll use that value to make sure there isn't a user named as host name.
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
group "Using result object" do
|
11
|
+
# Capturing hostname value
|
12
|
+
run "hostname"
|
13
|
+
hostname = result.value
|
14
|
+
|
15
|
+
target "No #{hostname} user"
|
16
|
+
run "id hostname"
|
17
|
+
expect_none hostname
|
18
|
+
end
|
19
|
+
```
|
20
|
+
|
21
|
+
**Example 2:** When we are debugging our test and we want to see the content of the "result" object on the screen, we will use `result.debug`.
|
22
|
+
|
23
|
+
```
|
24
|
+
group "Checking users" do
|
25
|
+
users = ["root", "vader"]
|
26
|
+
|
27
|
+
users.each do |name|
|
28
|
+
target "Exists username #{name}"
|
29
|
+
run "id #{name}"
|
30
|
+
result.debug
|
31
|
+
expect "(#{name})"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
> More information about [result](../dsl/definition/result.md) keyword.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
[<< back](README.md)
|
2
|
+
|
3
|
+
# Example: 11-moodle_id
|
4
|
+
|
5
|
+
If you are a teacher and are using the Moodle platform, probably you will want to upload the results of the evaluation carried out by Teuton in Moodle.
|
6
|
+
|
7
|
+
Teuton generates a file called "moodle.csv" with the grades of each student. Only have to import the file into Moodle.
|
8
|
+
|
9
|
+
In the configuration file "config.yaml" add a field called "moodle_id" to each case. Fill it with the student's identification (For example, the email registered on the Moodle).
|
10
|
+
|
11
|
+
Example:
|
12
|
+
```
|
13
|
+
global:
|
14
|
+
cases:
|
15
|
+
- tt_members: Darth Vader
|
16
|
+
tt_moodle_id: vader@starwars.com
|
17
|
+
- tt_members: Obiwan Kenobi
|
18
|
+
tt_moodle_id: obiwan@starwars.com
|
19
|
+
```
|