teuton 2.4.0 → 2.4.2
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 +9 -6
- data/docs/changelog/todo.md +10 -1
- data/docs/changelog/v2.4.md +5 -1
- data/docs/commands/README.md +8 -17
- data/docs/commands/example_check.md +4 -4
- data/docs/commands/example_run.md +10 -32
- data/docs/dsl/README.md +27 -39
- data/docs/dsl/{definition/expect.md → expect.md} +2 -18
- data/docs/dsl/{execution/export.md → export.md} +4 -8
- data/docs/dsl/{setting/get.md → get.md} +4 -10
- data/docs/dsl/{definition/group.md → group.md} +2 -7
- data/docs/dsl/{execution/play.md → play.md} +1 -6
- data/docs/dsl/{definition/result.md → result.md} +1 -6
- data/docs/dsl/{definition/run_remote.md → run.md} +57 -23
- data/docs/dsl/{execution/send.md → send.md} +1 -8
- data/docs/dsl/{setting/set.md → set.md} +1 -7
- data/docs/dsl/{execution/show.md → show.md} +7 -16
- data/docs/dsl/target.md +33 -0
- data/docs/ideas/todo.md +35 -115
- data/docs/install/README.md +26 -42
- data/docs/install/s-node.md +35 -0
- data/docs/install/t-node.md +76 -0
- data/docs/learn/01-cmd_new.md +28 -0
- data/docs/learn/{01-target.md → 02-target.md} +21 -28
- data/docs/learn/03-remote_hosts.md +59 -87
- data/docs/learn/04-config.md +147 -0
- data/docs/learn/05-use.md +25 -45
- data/docs/learn/06-cmd_check.md +50 -0
- data/docs/learn/07-target_weight.md +44 -0
- data/docs/learn/08-unique_values.md +70 -0
- data/docs/learn/09-send.md +20 -0
- data/docs/learn/10-debug.md +45 -0
- data/docs/learn/11-export.md +35 -0
- data/docs/learn/{09-preserve.md → 12-preserve.md} +1 -1
- data/docs/learn/13-feedback.md +49 -0
- data/docs/learn/14-moodle_id.md +24 -0
- data/docs/learn/{08-readme.md → 15-readme.md} +5 -9
- data/docs/learn/{13-include.md → 16-include.md} +1 -3
- data/docs/learn/{14-alias.md → 17-alias.md} +0 -0
- data/docs/learn/{07-log.md → 18-log.md} +19 -23
- data/docs/learn/{12-get_vars.md → 19-read_vars.md} +3 -3
- data/docs/learn/20-macros.md +49 -0
- data/docs/learn/{16-exit_codes.md → 21-exit_codes.md} +0 -0
- data/docs/learn/{10-result.md → 22-result.md} +3 -3
- data/docs/learn/23-test-code.md +54 -0
- data/docs/learn/24-test-sql.md +69 -0
- data/docs/learn/README.md +31 -32
- data/lib/teuton/application.rb +2 -5
- data/lib/teuton/case_manager/case/case.rb +2 -1
- data/lib/teuton/case_manager/case/dsl/expect.rb +3 -1
- data/lib/teuton/case_manager/case/dsl/goto.rb +1 -1
- data/lib/teuton/case_manager/case/dsl/log.rb +5 -3
- data/lib/teuton/case_manager/case/dsl/send.rb +2 -2
- data/lib/teuton/case_manager/case/dsl/target.rb +1 -1
- data/lib/teuton/case_manager/case/result/ext_compare.rb +20 -21
- data/lib/teuton/case_manager/case/result/ext_filter.rb +15 -8
- data/lib/teuton/case_manager/case_manager.rb +10 -8
- data/lib/teuton/check/show.rb +1 -1
- data/lib/teuton/files/config.yaml +1 -2
- data/lib/teuton/files/start.rb +4 -4
- data/lib/teuton/readme/dsl.rb +9 -1
- data/lib/teuton/readme/readme.rb +8 -1
- data/lib/teuton/report/formatter/base_formatter.rb +2 -0
- data/lib/teuton/report/formatter/formatter.rb +1 -0
- data/lib/teuton/report/show.rb +8 -0
- data/lib/teuton/version.rb +1 -1
- data/lib/teuton.rb +2 -1
- metadata +72 -54
- data/docs/dsl/definition/run_local.md +0 -33
- data/docs/dsl/definition/target.md +0 -40
- data/docs/install/scripts.md +0 -96
- data/docs/learn/02-config.md +0 -121
- data/docs/learn/04-new_test.md +0 -87
- data/docs/learn/06-debug.md +0 -110
- data/docs/learn/11-moodle_id.md +0 -19
@@ -1,121 +1,93 @@
|
|
1
1
|
[<< back](README.md)
|
2
2
|
|
3
|
-
#
|
3
|
+
# Remote hosts
|
4
4
|
|
5
|
-
|
6
|
-
* Check a group of remote hosts.
|
7
|
-
* Export reports using other output formats.
|
8
|
-
* Checking remote machine (host1) with Windows OS.
|
5
|
+
To run test on remote host we have to define them into config file.
|
9
6
|
|
10
|
-
|
11
|
-
|
12
|
-
3
|
13
|
-
4. [Results](#results).
|
14
|
-
|
15
|
-
## Config file
|
16
|
-
|
17
|
-
This configuration file contains:
|
18
|
-
* 2 global params denitions.
|
19
|
-
* 3 cases.
|
20
|
-
* 4 specific case params definitions.
|
7
|
+
Let's see an example with:
|
8
|
+
* 1 global param.
|
9
|
+
* 3 cases with 3 params.
|
21
10
|
|
22
11
|
```yaml
|
23
12
|
---
|
24
13
|
global:
|
25
14
|
host1_username: root
|
26
|
-
host1_password: profesor
|
27
15
|
cases:
|
28
|
-
- tt_members:
|
16
|
+
- tt_members: student_1
|
29
17
|
host1_ip: 192.168.1.201
|
30
|
-
|
31
|
-
|
32
|
-
- tt_members: R2D2
|
18
|
+
host1_password: secret_1
|
19
|
+
- tt_members: student_2
|
33
20
|
host1_ip: 192.168.1.202
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
host1_hostname: jedis
|
39
|
-
username: obiwan
|
21
|
+
host1_password: secret_2
|
22
|
+
- tt_members: student_3
|
23
|
+
host1_ip: 127.0.0.1
|
24
|
+
host1_password: secret_3
|
40
25
|
```
|
41
26
|
|
42
|
-
|
43
|
-
|
44
|
-
Define 3 targets (items to be checked):
|
27
|
+
Every remote host definition require some params:
|
45
28
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
expect "Nombre:"
|
55
|
-
|
56
|
-
target "Create user #{gett(:username)}"
|
57
|
-
run "net user", on: :host1
|
58
|
-
expect get(:username)
|
59
|
-
end
|
60
|
-
```
|
29
|
+
| Param | Description | Default value |
|
30
|
+
| ----- | -------------- | ------------- |
|
31
|
+
| ip | Remote host IP | |
|
32
|
+
| port | Remote host port | 22 |
|
33
|
+
| username | Remote user account | Not required with public SSH id |
|
34
|
+
| password | Remote user pasword | Not required with public SSH id |
|
35
|
+
| protocol | SSH or Telner | SSH |
|
36
|
+
| route | Defines host2 used as gateway to reach host | |
|
61
37
|
|
62
|
-
|
38
|
+
## Definition section
|
63
39
|
|
64
|
-
|
40
|
+
Define 1 target (item to be checked):
|
65
41
|
|
66
42
|
```ruby
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
export format: :html
|
72
|
-
send copy_to: :host1
|
43
|
+
group "Remote hosts" do
|
44
|
+
target "Create user david"
|
45
|
+
run "id david", on: :host1
|
46
|
+
expect "david"
|
73
47
|
end
|
74
48
|
```
|
75
49
|
|
76
|
-
|
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).
|
50
|
+
> NOTE: This example requires GNU/Linux OS on remote machine (host1).
|
83
51
|
|
84
|
-
|
52
|
+
Execution:
|
85
53
|
|
86
54
|
```
|
55
|
+
> teuton run examples/03-remote_hosts
|
56
|
+
|
87
57
|
CASE RESULTS
|
88
|
-
|
89
|
-
| CASE | MEMBERS
|
90
|
-
| 01 |
|
91
|
-
|
|
92
|
-
| 03 |
|
93
|
-
|
58
|
+
+------+-----------+-------+-------+
|
59
|
+
| CASE | MEMBERS | GRADE | STATE |
|
60
|
+
| 01 | student_1 | 0.0 | ? |
|
61
|
+
| 02 | student_2 | 0.0 | ? |
|
62
|
+
| 03 | student_3 | 100.0 | ✔ |
|
63
|
+
+------+-----------+-------+-------+
|
94
64
|
|
95
65
|
CONN ERRORS
|
96
|
-
|
97
|
-
| CASE | MEMBERS
|
98
|
-
| 01 |
|
99
|
-
|
|
100
|
-
|
66
|
+
+------+-----------+-------+------------------+
|
67
|
+
| CASE | MEMBERS | HOST | ERROR |
|
68
|
+
| 01 | student_1 | host1 | host_unreachable |
|
69
|
+
| 02 | student_2 | host1 | host_unreachable |
|
70
|
+
+------+-----------+-------+------------------+
|
101
71
|
```
|
102
72
|
|
103
|
-
|
73
|
+
Notice that case-03 is 100% and conection works. It is running on localhost because has localhost IP (127.0.0.1)
|
74
|
+
|
75
|
+
Results:
|
104
76
|
|
105
77
|
```
|
106
|
-
var
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
└── resume.txt
|
78
|
+
❯ tree var/03-remote_hosts
|
79
|
+
|
80
|
+
var/03-remote_hosts
|
81
|
+
├── case-01.txt
|
82
|
+
├── case-02.txt
|
83
|
+
├── case-03.txt
|
84
|
+
├── moodle.csv
|
85
|
+
└── resume.txt
|
115
86
|
```
|
116
87
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
* `
|
121
|
-
* `
|
88
|
+
## tt_skip param
|
89
|
+
|
90
|
+
To disable a case, add skip param `tt_skip: true`.
|
91
|
+
* `tt_skip` it is true by default.
|
92
|
+
* `tt_skip: false` ignore this case.
|
93
|
+
* `tt_skip: true`, evaluate this case.
|
@@ -0,0 +1,147 @@
|
|
1
|
+
[<< back](README.md)
|
2
|
+
|
3
|
+
# config
|
4
|
+
|
5
|
+
_It's good idea save dinamic data into config file._
|
6
|
+
|
7
|
+
By default, `config.yaml` is our config file. Example:
|
8
|
+
|
9
|
+
```yaml
|
10
|
+
global:
|
11
|
+
cases:
|
12
|
+
- tt_members: name_student_1
|
13
|
+
username: david
|
14
|
+
- tt_members: name_student_2
|
15
|
+
username: fran
|
16
|
+
```
|
17
|
+
|
18
|
+
> **How to choose another config file?** Read this [document](../commands/example_run.md#3-choosing-config-file).
|
19
|
+
|
20
|
+
By default, `start.rb` it's our main execution file. Example:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
group "Reading params from config file" do
|
24
|
+
|
25
|
+
target "Create user #{get(:username)}"
|
26
|
+
run "id #{get(:username)}"
|
27
|
+
expect get(:username)
|
28
|
+
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
* [get](../dsl/get.md) keyword read params from configuration file. It's posible personalize tests with diferent values for every case.
|
33
|
+
|
34
|
+
## Example
|
35
|
+
|
36
|
+
```console
|
37
|
+
> teuton run examples/04-config
|
38
|
+
|
39
|
+
CASE RESULTS
|
40
|
+
+------+----------------+-------+-------+
|
41
|
+
| CASE | MEMBERS | GRADE | STATE |
|
42
|
+
| 01 | name_student_1 | 100.0 | ✔ |
|
43
|
+
| 02 | name_student_2 | 0.0 | ? |
|
44
|
+
+------+----------------+-------+-------+
|
45
|
+
```
|
46
|
+
|
47
|
+
Reports:
|
48
|
+
|
49
|
+
```
|
50
|
+
var/04-config
|
51
|
+
├── case-01.txt
|
52
|
+
├── case-02.txt
|
53
|
+
├── moodle.csv
|
54
|
+
└── resume.txt
|
55
|
+
```
|
56
|
+
|
57
|
+
Let's see case 01 report.
|
58
|
+
|
59
|
+
```
|
60
|
+
> more var/04-config/case-01.txt
|
61
|
+
|
62
|
+
CONFIGURATION
|
63
|
+
+-------------+----------------+
|
64
|
+
| tt_members | name_student_1 |
|
65
|
+
| tt_sequence | false |
|
66
|
+
| tt_skip | false |
|
67
|
+
| tt_testname | 04-config |
|
68
|
+
| username | david |
|
69
|
+
+-------------+----------------+
|
70
|
+
|
71
|
+
GROUPS
|
72
|
+
- Reading params from config file
|
73
|
+
01 (1.0/1.0)
|
74
|
+
Description : Create user david
|
75
|
+
Command : id david
|
76
|
+
Duration : 0.002 (local)
|
77
|
+
Alterations : find(david) & count
|
78
|
+
Expected : Greater than 0 (String)
|
79
|
+
Result : 1 (Integer)
|
80
|
+
|
81
|
+
RESULTS
|
82
|
+
+--------------+---------------------------+
|
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
|
+
| unique_fault | 0 |
|
88
|
+
| max_weight | 1.0 |
|
89
|
+
| good_weight | 1.0 |
|
90
|
+
| fail_weight | 0.0 |
|
91
|
+
| fail_counter | 0 |
|
92
|
+
| grade | 100 |
|
93
|
+
+--------------+---------------------------+```
|
94
|
+
```
|
95
|
+
|
96
|
+
## Using differents configuration files
|
97
|
+
|
98
|
+
Example with 3 config files (yaml files):
|
99
|
+
|
100
|
+
```
|
101
|
+
❯ tree examples/04-config
|
102
|
+
|
103
|
+
examples/04-config
|
104
|
+
├── config.yaml
|
105
|
+
├── rock.yaml
|
106
|
+
├── start.rb
|
107
|
+
└── starwars.yaml
|
108
|
+
```
|
109
|
+
|
110
|
+
Usign default config file (`config.yaml`):
|
111
|
+
|
112
|
+
```
|
113
|
+
❯ teuton run examples/04-config
|
114
|
+
|
115
|
+
CASE RESULTS
|
116
|
+
+------+----------------+-------+-------+
|
117
|
+
| CASE | MEMBERS | GRADE | STATE |
|
118
|
+
| 01 | name_student_1 | 100.0 | ✔ |
|
119
|
+
| 02 | name_student_2 | 0.0 | ? |
|
120
|
+
+------+----------------+-------+-------+
|
121
|
+
```
|
122
|
+
|
123
|
+
Using `example/04-config/starwars.yaml`:
|
124
|
+
|
125
|
+
```
|
126
|
+
❯ teuton run --cname=starwars examples/04-config
|
127
|
+
|
128
|
+
CASE RESULTS
|
129
|
+
+------+------------+-------+-------+
|
130
|
+
| CASE | MEMBERS | GRADE | STATE |
|
131
|
+
| 01 | Yoda | 0.0 | ? |
|
132
|
+
| 02 | Darth Maul | 0.0 | ? |
|
133
|
+
+------+------------+-------+-------+
|
134
|
+
```
|
135
|
+
|
136
|
+
Using `example/04-config/rock.yaml`:
|
137
|
+
|
138
|
+
```
|
139
|
+
❯ teuton run --cpath=examples/04-config/rock.yaml examples/04-config
|
140
|
+
|
141
|
+
CASE RESULTS
|
142
|
+
+------+------------+-------+-------+
|
143
|
+
| CASE | MEMBERS | GRADE | STATE |
|
144
|
+
| 01 | AC/DC band | 0.0 | ? |
|
145
|
+
| 02 | Muse band | 0.0 | ? |
|
146
|
+
+------+------------+-------+-------+
|
147
|
+
```
|
data/docs/learn/05-use.md
CHANGED
@@ -1,39 +1,28 @@
|
|
1
1
|
[<< back](README.md)
|
2
2
|
|
3
|
-
#
|
3
|
+
# use
|
4
4
|
|
5
|
-
|
6
|
-
* Organize huge amount of groups/targets into several files.
|
7
|
-
* Checking Windows OS infrastructure (host1).
|
5
|
+
`use` keyword allow us organize huge amount of groups/targets into several files.
|
8
6
|
|
9
|
-
|
10
|
-
2. [Execution section](#execution-section)
|
11
|
-
3. [Users file](#users-file)
|
12
|
-
4. [Network file](#network-file)
|
7
|
+
## Example
|
13
8
|
|
14
|
-
|
15
|
-
|
16
|
-
This example has more files:
|
9
|
+
> This example requires Windows OS on remote machine.
|
17
10
|
|
18
11
|
```bash
|
19
|
-
|
20
|
-
|
21
|
-
|
12
|
+
❯ tree examples/05-use
|
13
|
+
examples/05-use
|
14
|
+
├── lib
|
15
|
+
│ ├── network.rb
|
16
|
+
│ └── users.rb
|
22
17
|
├── config.yaml
|
23
|
-
|
24
|
-
├── README.md
|
25
|
-
├── start.rb
|
26
|
-
└── users.rb
|
18
|
+
└── start.rb
|
27
19
|
```
|
28
20
|
|
29
|
-
|
30
|
-
|
31
|
-
Previous `start.rb` file is now splited in: start.rb, users.rb and network.rb.
|
32
|
-
|
33
|
-
Let's see current `start.rb` file:
|
21
|
+
* `start.rb` file is now splited into: `start.rb`, `users.rb` and `network.rb`.
|
34
22
|
|
35
23
|
```ruby
|
36
|
-
|
24
|
+
# File: start.rb
|
25
|
+
use 'lib/users'
|
37
26
|
use 'network'
|
38
27
|
|
39
28
|
play do
|
@@ -42,40 +31,31 @@ play do
|
|
42
31
|
end
|
43
32
|
```
|
44
33
|
|
45
|
-
* `use`, indicates external
|
46
|
-
|
47
|
-
## Users file
|
48
|
-
|
49
|
-
> Require Windows OS on remote machine.
|
34
|
+
* `use`, indicates that we require external file, that will be imported into our start.rb file.
|
35
|
+
* Notice that you can specify relative route `use 'lib/users'`, or only filename `use 'network'`. In the second case, teuton will search a file with that name into project folders.
|
50
36
|
|
51
|
-
|
37
|
+
> It's a good idea to organize project files, when the number of groups/targets is high.
|
52
38
|
|
53
39
|
```ruby
|
54
|
-
|
40
|
+
# File: users.rb
|
55
41
|
|
56
|
-
|
42
|
+
group "Using file: users" do
|
43
|
+
target "Create user #{get(:username)}"
|
57
44
|
run "net user", on: :host1
|
58
45
|
expect get(:username)
|
59
|
-
|
60
46
|
end
|
61
47
|
```
|
62
48
|
|
63
|
-
## Network file
|
64
|
-
|
65
|
-
> Require Windows OS on remote machine.
|
66
|
-
|
67
|
-
Let's see `network.rb` file:
|
68
|
-
|
69
49
|
```ruby
|
70
|
-
|
50
|
+
# File: network.rb
|
71
51
|
|
72
|
-
|
52
|
+
group "Using file: network" do
|
53
|
+
target "Update computer name with #{get(:hostname)}"
|
73
54
|
run "hostname", on: :host1
|
74
|
-
expect_one get(:
|
55
|
+
expect_one get(:hostname)
|
75
56
|
|
76
57
|
target "Ensure DNS Server is working"
|
77
|
-
run "
|
78
|
-
expect "
|
79
|
-
|
58
|
+
run "host www.google.es", on: :host1
|
59
|
+
expect "www.google.es has address "
|
80
60
|
end
|
81
61
|
```
|
@@ -0,0 +1,50 @@
|
|
1
|
+
|
2
|
+
[<< back](README.md)
|
3
|
+
|
4
|
+
# check test
|
5
|
+
|
6
|
+
Check Teuton test syntax and show statistics.
|
7
|
+
|
8
|
+
```
|
9
|
+
❯ teuton check examples/05-use
|
10
|
+
|
11
|
+
+--------------------------+
|
12
|
+
| GROUP: Using file: users |
|
13
|
+
+--------------------------+
|
14
|
+
(001) target Create user get(username)
|
15
|
+
weight 1.0
|
16
|
+
run 'id get(username)' on host1
|
17
|
+
expect get(username) (String)
|
18
|
+
|
19
|
+
+----------------------------+
|
20
|
+
| GROUP: Using file: network |
|
21
|
+
+----------------------------+
|
22
|
+
(002) target Update computer name with get(hostname)
|
23
|
+
weight 1.0
|
24
|
+
run 'hostname' on host1
|
25
|
+
expect_one get(hostname) (String)
|
26
|
+
|
27
|
+
(003) target Ensure DNS Server is working
|
28
|
+
weight 1.0
|
29
|
+
run 'host www.google.es' on host1
|
30
|
+
expect www.google.es has address (String)
|
31
|
+
|
32
|
+
+-------------+-------+
|
33
|
+
| DSL Stats | Count |
|
34
|
+
+-------------+-------+
|
35
|
+
| Groups | 2 |
|
36
|
+
| Targets | 3 |
|
37
|
+
| Runs | 3 |
|
38
|
+
| * host1 | 3 |
|
39
|
+
| Uniques | 0 |
|
40
|
+
| Logs | 0 |
|
41
|
+
| | |
|
42
|
+
| Gets | 5 |
|
43
|
+
| * username | 3 |
|
44
|
+
| * hostname | 2 |
|
45
|
+
| Sets | 0 |
|
46
|
+
+-------------+-------+
|
47
|
+
+----------------------+
|
48
|
+
| Revising CONFIG file |
|
49
|
+
+----------------------+
|
50
|
+
```
|
@@ -0,0 +1,44 @@
|
|
1
|
+
[<< back](README.md)
|
2
|
+
|
3
|
+
# Target weight
|
4
|
+
|
5
|
+
* Changing default target weight:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
# File: network.rb
|
9
|
+
|
10
|
+
group "Using file: network" do
|
11
|
+
target "Update computer name with #{get(:hostname)}"
|
12
|
+
run "hostname", on: :host1
|
13
|
+
expect_one get(:hostname)
|
14
|
+
|
15
|
+
target "Ensure DNS Server is working", weight: 2.0
|
16
|
+
run "host www.google.es", on: :host1
|
17
|
+
expect "www.google.es has address "
|
18
|
+
end
|
19
|
+
```
|
20
|
+
|
21
|
+
```
|
22
|
+
❯ teuton check examples/07-target_weight
|
23
|
+
|
24
|
+
+--------------------------+
|
25
|
+
| GROUP: Using file: users |
|
26
|
+
+--------------------------+
|
27
|
+
(001) target Create user get(username)
|
28
|
+
weight 1.0
|
29
|
+
run 'id get(username)' on host1
|
30
|
+
expect get(username) (String)
|
31
|
+
|
32
|
+
+----------------------------+
|
33
|
+
| GROUP: Using file: network |
|
34
|
+
+----------------------------+
|
35
|
+
(002) target Update computer name with get(hostname)
|
36
|
+
weight 1.0
|
37
|
+
run 'hostname' on host1
|
38
|
+
expect_one get(hostname) (String)
|
39
|
+
|
40
|
+
(003) target Ensure DNS Server is working
|
41
|
+
weight 2.0
|
42
|
+
run 'host www.google.es' on host1
|
43
|
+
expect www.google.es has address (String)
|
44
|
+
```
|
@@ -0,0 +1,70 @@
|
|
1
|
+
[<< back](README.md)
|
2
|
+
|
3
|
+
# Unique value
|
4
|
+
|
5
|
+
* `unique NAME, VALUE` keyword defines unique values.
|
6
|
+
* All cases that do not comply with this requirement will obtain a score of 0 and it will be reflected in the reports.
|
7
|
+
|
8
|
+
Example:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
# File: lib/unique.rb
|
12
|
+
|
13
|
+
group "Unique value: hostname" do
|
14
|
+
run "hostname -f", on: :host1
|
15
|
+
|
16
|
+
unique "Host name", result.value
|
17
|
+
end
|
18
|
+
```
|
19
|
+
|
20
|
+
Cheking test:
|
21
|
+
|
22
|
+
```
|
23
|
+
❯ teuton check examples/08-unique_values
|
24
|
+
|
25
|
+
+--------------------------+
|
26
|
+
| GROUP: Using file: users |
|
27
|
+
+--------------------------+
|
28
|
+
(001) target Create user get(username)
|
29
|
+
weight 1.0
|
30
|
+
run 'id get(username)' on host1
|
31
|
+
expect get(username) (String)
|
32
|
+
|
33
|
+
+----------------------------+
|
34
|
+
| GROUP: Using file: network |
|
35
|
+
+----------------------------+
|
36
|
+
(002) target Update computer name with get(hostname)
|
37
|
+
weight 1.0
|
38
|
+
run 'hostname' on host1
|
39
|
+
expect_one get(hostname) (String)
|
40
|
+
|
41
|
+
(003) target Ensure DNS Server is working
|
42
|
+
weight 2.0
|
43
|
+
run 'host www.google.es' on host1
|
44
|
+
expect www.google.es has address (String)
|
45
|
+
|
46
|
+
+-------------------------------+
|
47
|
+
| GROUP: Unique value: hostname |
|
48
|
+
+-------------------------------+
|
49
|
+
run 'hostname -f' on host1
|
50
|
+
! Unique value for <Host name>
|
51
|
+
|
52
|
+
+-------------+-------+
|
53
|
+
| DSL Stats | Count |
|
54
|
+
+-------------+-------+
|
55
|
+
| Groups | 3 |
|
56
|
+
| Targets | 3 |
|
57
|
+
| Runs | 4 |
|
58
|
+
| * host1 | 4 |
|
59
|
+
| Uniques | 1 |
|
60
|
+
| Logs | 1 |
|
61
|
+
| | |
|
62
|
+
| Gets | 5 |
|
63
|
+
| * username | 3 |
|
64
|
+
| * hostname | 2 |
|
65
|
+
| Sets | 0 |
|
66
|
+
+-------------+-------+
|
67
|
+
+----------------------+
|
68
|
+
| Revising CONFIG file |
|
69
|
+
+----------------------+
|
70
|
+
```
|
@@ -0,0 +1,20 @@
|
|
1
|
+
[<< back](README.md)
|
2
|
+
|
3
|
+
# Send
|
4
|
+
|
5
|
+
* [export](../dsl/export.md) keyword generate reports into diferents formats:
|
6
|
+
* [send](../dsl/send.md) keyword send report copies to every remote host.
|
7
|
+
|
8
|
+
## Example
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
play do
|
12
|
+
show
|
13
|
+
export
|
14
|
+
send copy_to: :host1
|
15
|
+
end
|
16
|
+
```
|
17
|
+
|
18
|
+
* `show`, show process log on screen.
|
19
|
+
* `export`, create reports with `txt` format.
|
20
|
+
* `send copy_to: :host1`, copy output report into remote machine (host1).
|
@@ -0,0 +1,45 @@
|
|
1
|
+
[<< back](README.md)
|
2
|
+
|
3
|
+
# debug
|
4
|
+
|
5
|
+
* Debug your tests.
|
6
|
+
|
7
|
+
```
|
8
|
+
> tree examples/10-debug
|
9
|
+
|
10
|
+
examples/10-debug
|
11
|
+
├── config.yaml
|
12
|
+
├── external.rb
|
13
|
+
├── internal.rb
|
14
|
+
└── start.rb
|
15
|
+
```
|
16
|
+
|
17
|
+
Tests grows and becames huge, with a lot of targets (That isn't a problem). Then, we organize them spliting into several files and invoke `use` keywork from our main rb file to load other files (That's good idea).
|
18
|
+
|
19
|
+
Sometimes we need to verify or check rb file consistency and syntax, and we will do it with `teuton check PATH/TO/PROJECT/FOLDER`.
|
20
|
+
|
21
|
+
## Debug
|
22
|
+
|
23
|
+
Every time we invoke `run` keywork, an OS command is executed. The output is showed on screen and saved into **result** internal object.
|
24
|
+
|
25
|
+
We could debug it invoking `result.debug` into our tests. Let's see an example from `external.rb` file:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
# File: external.rb
|
29
|
+
|
30
|
+
group "Windows: external configuration from localhost" do
|
31
|
+
|
32
|
+
target "From localhost, check if exist connectivity with #{get(:windows_ip)}"
|
33
|
+
run "ping #{get(:windows_ip)} -c 1"
|
34
|
+
result.debug
|
35
|
+
expect_one "0% packet loss"
|
36
|
+
result.debug
|
37
|
+
|
38
|
+
target "From localhost, check if Netbios-ssn service working on #{get(:windows_ip)}"
|
39
|
+
run "nmap -Pn #{get(:windows_ip)}"
|
40
|
+
expect "139/tcp", "open"
|
41
|
+
|
42
|
+
end
|
43
|
+
```
|
44
|
+
|
45
|
+
`result.debug` it's usefull when you are verifying command output captured by Teuton.
|