teuton 2.10.8 → 2.11.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 +65 -18
- data/docs/commands/README.md +18 -81
- data/docs/commands/check.md +66 -0
- data/docs/commands/config.md +120 -0
- data/docs/commands/help.md +37 -0
- data/docs/commands/new.md +34 -0
- data/docs/commands/readme.md +52 -0
- data/docs/commands/{run-tests.md → run.md} +1 -1
- data/docs/config_file.md +125 -0
- data/docs/devel/README.md +12 -0
- data/docs/dsl/expect.md +2 -2
- data/docs/dsl/run.md +30 -67
- data/docs/install/s-node.md +9 -7
- data/docs/install/t-node.md +18 -19
- data/docs/learn/11-export.md +1 -1
- data/docs/learn/13-feedback.md +1 -1
- data/docs/learn/14-moodle_id.md +4 -4
- data/docs/learn/15-readme.md +14 -8
- data/docs/learn/16-include.md +21 -16
- data/docs/learn/17-alias.md +2 -2
- data/docs/learn/18-log.md +5 -3
- data/docs/learn/19-read_vars.md +7 -3
- data/docs/learn/20-macros.md +6 -4
- data/docs/learn/21-exit_codes.md +3 -3
- data/docs/learn/22-result.md +7 -3
- data/docs/learn/23-test-code.md +17 -7
- data/docs/learn/24-test-sql.md +19 -18
- data/docs/learn/25-expect-result.md +1 -0
- data/docs/learn/26-expect_sequence.md +12 -7
- data/docs/learn/27-run_script.md +11 -5
- data/docs/tutorial/es/nginx/README.md +546 -0
- data/lib/teuton/case/case.rb +0 -2
- data/lib/teuton/case/dsl/expect.rb +2 -2
- data/lib/teuton/case/dsl/log.rb +1 -1
- data/lib/teuton/case/dsl/run.rb +2 -3
- data/lib/teuton/case/dsl/upload.rb +1 -1
- data/lib/teuton/case/execute/execute_base.rb +3 -6
- data/lib/teuton/case/execute/execute_local.rb +5 -2
- data/lib/teuton/case/execute/execute_ssh.rb +0 -1
- data/lib/teuton/case/execute/execute_telnet.rb +0 -2
- data/lib/teuton/case/play.rb +2 -2
- data/lib/teuton/case/result/result.rb +1 -3
- data/lib/teuton/case_manager/case_manager.rb +14 -17
- data/lib/teuton/case_manager/dsl.rb +4 -4
- data/lib/teuton/case_manager/export_manager.rb +22 -17
- data/lib/teuton/case_manager/{check_cases.rb → ext/check_cases.rb} +7 -6
- data/lib/teuton/case_manager/ext/hall_of_fame.rb +28 -0
- data/lib/teuton/case_manager/{report.rb → ext/report.rb} +6 -8
- data/lib/teuton/case_manager/send_manager.rb +1 -0
- data/lib/teuton/case_manager/{show_report.rb → show_resume_report.rb} +12 -26
- data/lib/teuton/case_manager/stats_manager.rb +26 -0
- data/lib/teuton/check/checker.rb +16 -8
- data/lib/teuton/check/main.rb +2 -2
- data/lib/teuton/check/show.rb +3 -3
- data/lib/teuton/cli.rb +3 -2
- data/lib/teuton/readme/dsl/getset.rb +1 -0
- data/lib/teuton/readme/main.rb +2 -2
- data/lib/teuton/readme/readme.rb +2 -2
- data/lib/teuton/report/formatter/default/array.rb +1 -3
- data/lib/teuton/report/formatter/default/markdown.rb +1 -1
- data/lib/teuton/report/formatter/default/txt.rb +1 -1
- data/lib/teuton/report/formatter/default/xml.rb +93 -29
- data/lib/teuton/report/formatter/formatter.rb +2 -1
- data/lib/teuton/report/formatter/resume/array.rb +1 -3
- data/lib/teuton/report/formatter/resume/txt.rb +6 -2
- data/lib/teuton/report/formatter/resume/xml.rb +92 -0
- data/lib/teuton/report/report.rb +1 -1
- data/lib/teuton/utils/config_file_reader.rb +141 -0
- data/lib/teuton/utils/name_file_finder.rb +12 -15
- data/lib/teuton/utils/project.rb +19 -21
- data/lib/teuton/utils/settings.rb +3 -1
- data/lib/teuton/version.rb +1 -1
- data/lib/teuton.rb +11 -10
- metadata +35 -30
- data/docs/commands/check-example.md +0 -53
- data/docs/es/aprender/01-cmd_new.md +0 -27
- data/docs/es/aprender/02-target.md +0 -131
- data/docs/es/aprender/README.md +0 -36
- data/docs/ideas/todo.md +0 -44
- data/docs/install/README.md +0 -38
- data/lib/teuton/case_manager/hall_of_fame.rb +0 -29
- data/lib/teuton/files/README.md +0 -9
- data/lib/teuton/utils/configfile_reader.rb +0 -135
- /data/docs/{ideas → devel}/contributions.md +0 -0
- /data/docs/{ideas → es}/Challenge-Server-Project.md +0 -0
- /data/docs/{ideas → es}/servidor-de-retos.md +0 -0
- /data/docs/{install/modes_of_use.md → modes_of_use.md} +0 -0
- /data/lib/teuton/{case_manager → deprecated}/utils.rb +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5088e7bd81367702f9c4bf03819a8b0c6314d42491afb5a35afc985102db54a8
|
|
4
|
+
data.tar.gz: e6fed00de115a204785a5c9d8949ab45bfab14088a91c49b4e43dad868020366
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9a54014188a4eb0869d3bb82e35da1043c7e663bff461b3feb32c8b9e653a7e4770f4d24970a193b1cb8f55cb280014f4e7e3f92c140c19b04559f11833f16c1
|
|
7
|
+
data.tar.gz: 69a5dd3e075fae27c3495d0d406284d8d448e1a8f68decea3905ed9fd08fe60395d0454ba291f6680aa489766485e6d18cf1b346a717ed9a190b097cd8d4d2e9
|
data/README.md
CHANGED
|
@@ -21,28 +21,54 @@ Install Ruby and then:
|
|
|
21
21
|
gem install teuton
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
#
|
|
24
|
+
# Quickstart
|
|
25
|
+
|
|
26
|
+
**Create** your test file:
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
# File: examples/02-target/start.rb
|
|
30
|
+
group "Learn about targets" do
|
|
31
|
+
target "Create user obiwan", weight: 2
|
|
32
|
+
run "id obiwan"
|
|
33
|
+
expect ["uid=", "(obiwan)", "gid="]
|
|
34
|
+
|
|
35
|
+
target "Delete user vader"
|
|
36
|
+
run "id vader"
|
|
37
|
+
expect_fail
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
start do
|
|
41
|
+
show
|
|
42
|
+
export
|
|
43
|
+
end
|
|
44
|
+
```
|
|
30
45
|
|
|
31
|
-
|
|
46
|
+
**Usage**: Run test with `teuton run TESTPATH`.
|
|
32
47
|
|
|
33
48
|
```console
|
|
34
49
|
$ teuton run examples/02-target
|
|
35
50
|
------------------------------------
|
|
36
|
-
Started at 2025-
|
|
51
|
+
Started at 2025-12-01 18:14:44 +0000
|
|
37
52
|
F.
|
|
38
53
|
Finished in 0.005 seconds
|
|
39
54
|
------------------------------------
|
|
40
55
|
|
|
41
56
|
CASE RESULTS
|
|
42
|
-
|
|
43
|
-
| CASE | MEMBERS
|
|
44
|
-
| 01 |
|
|
45
|
-
|
|
57
|
+
+------+-----------+-------+-------+
|
|
58
|
+
| CASE | MEMBERS | GRADE | STATE |
|
|
59
|
+
| 01 | anonymous | 33.0 | ? |
|
|
60
|
+
+------+-----------+-------+-------+
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Output**: reports saved into `var/TESTNAME` folder.
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
$ tree var
|
|
67
|
+
var
|
|
68
|
+
└── 02-target
|
|
69
|
+
├── case-01.txt
|
|
70
|
+
├── moodle.csv
|
|
71
|
+
└── resume.txt
|
|
46
72
|
```
|
|
47
73
|
|
|
48
74
|
Consult the generated [output files](examples/02-target/output.d/)
|
|
@@ -51,17 +77,38 @@ Consult the generated [output files](examples/02-target/output.d/)
|
|
|
51
77
|
|
|
52
78
|
* Use simple DSL to define your tests: `target`, `run`,`expect` and more.
|
|
53
79
|
* Remote devices only require SSH or Telnet service installed.
|
|
54
|
-
* Output format: txt, html, json, yaml, etc.
|
|
80
|
+
* Output format: txt, html, json, yaml, markdown, etc.
|
|
55
81
|
* Multiplatform.
|
|
56
82
|
* [Free Software License](LICENSE).
|
|
57
83
|
|
|
58
84
|
# Documentation
|
|
59
85
|
|
|
60
|
-
*
|
|
61
|
-
* [
|
|
62
|
-
* [
|
|
63
|
-
*
|
|
64
|
-
* [
|
|
86
|
+
* Installation
|
|
87
|
+
* [Teuton installation](docs/install/t-node.md)
|
|
88
|
+
* [SSH/Telnet installation](docs/install/s-node.md)
|
|
89
|
+
* Teuton commands
|
|
90
|
+
* [teuton config](docs/commands/config.md)
|
|
91
|
+
* [teuton check](docs/commands/check.md)
|
|
92
|
+
* [teuton help](docs/commands/help.md)
|
|
93
|
+
* [teuton new](docs/commands/new.md)
|
|
94
|
+
* [teuton readme](docs/commands/readme.md)
|
|
95
|
+
* [teuton run](docs/commands/run.md)
|
|
96
|
+
* [Learning guide](docs/learn/README.md). Learning to create tests by doing.
|
|
97
|
+
* [Learning Examples](examples). The learning guide is based on these examples.
|
|
98
|
+
* [Configuration file](docs/config_file.md)
|
|
99
|
+
* [DSL - Language reference](docs/dsl/README.md). DSL used to define tests.
|
|
100
|
+
* [expect](docs/dsl/expect.md)
|
|
101
|
+
* [export](docs/dsl/export.md)
|
|
102
|
+
* [get](docs/dsl/get.md)
|
|
103
|
+
* [group](docs/dsl/group.md)
|
|
104
|
+
* [play](docs/dsl/play.md)
|
|
105
|
+
* [result](docs/dsl/result.md)
|
|
106
|
+
* [run](docs/dsl/run.md)
|
|
107
|
+
* [send](docs/dsl/send.md)
|
|
108
|
+
* [set](docs/dsl/set.md)
|
|
109
|
+
* [show](docs/dsl/show.md)
|
|
110
|
+
* [target](docs/dsl/target.md)
|
|
111
|
+
* [Modes of use](docs/modes_of_use.md): Classroom, contest, standalone.
|
|
65
112
|
* [Blogs and videos](docs/videos.md)
|
|
66
113
|
|
|
67
114
|
# Contact
|
data/docs/commands/README.md
CHANGED
|
@@ -2,86 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
# Commands
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
#
|
|
14
|
-
|
|
15
|
-
Show help about command functions.
|
|
16
|
-
|
|
17
|
-
Usage:
|
|
18
|
-
* `teuton help`
|
|
19
|
-
* `teuton help FUNCTION_NAME`
|
|
20
|
-
|
|
21
|
-
Alias: `teuton h`,`teuton -h`, `teuton --help`
|
|
22
|
-
|
|
23
|
-
# 2. Show version
|
|
24
|
-
|
|
25
|
-
Show current version.
|
|
26
|
-
|
|
27
|
-
Usage: `teuton version`
|
|
28
|
-
|
|
29
|
-
Alias: `teuton v`, `teuton -v`, `teuton --version`
|
|
30
|
-
|
|
31
|
-
# 3. Create new test
|
|
32
|
-
|
|
33
|
-
Create test skeleton.
|
|
34
|
-
|
|
35
|
-
Usage: `teuton new foo`
|
|
36
|
-
|
|
37
|
-
Example:
|
|
38
|
-
|
|
39
|
-
```console
|
|
40
|
-
$ teuton new foo
|
|
41
|
-
|
|
42
|
-
Creating foo project
|
|
43
|
-
* Create dir => foo
|
|
44
|
-
* Create file => foo/config.yaml
|
|
45
|
-
* Create file => foo/start.rb
|
|
5
|
+
```
|
|
6
|
+
$ teuton
|
|
7
|
+
Commands:
|
|
8
|
+
teuton [run] [OPTIONS] DIRECTORY # Run test from directory
|
|
9
|
+
teuton check [OPTIONS] DIRECTORY # Check test and config file content
|
|
10
|
+
teuton config [OPTIONS] DIRECTORY # Suggest configuration or run server
|
|
11
|
+
teuton help [COMMAND] # Describe available commands or one specific command
|
|
12
|
+
teuton new DIRECTORY # Create skeleton for a new project
|
|
13
|
+
teuton readme DIRECTORY # Show README extracted from test contents
|
|
14
|
+
teuton version # Show the program version
|
|
46
15
|
```
|
|
47
16
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
Alias: `teuton n foo`, `teuton -n foo`, `teuton --new foo`
|
|
57
|
-
|
|
58
|
-
# 4. Check test
|
|
59
|
-
|
|
60
|
-
Check test and config files from DIRPATH folder.
|
|
61
|
-
|
|
62
|
-
Usage: `teuton check DIRPATH`
|
|
63
|
-
|
|
64
|
-
[Example](check-example.md)
|
|
65
|
-
|
|
66
|
-
| Command | Description |
|
|
67
|
-
| ---------------------------- | ----------- |
|
|
68
|
-
| teuton check path/to/dir/foo | Test content of start.rb and config.yaml files. |
|
|
69
|
-
| teuton check path/to/dir/foo --cname=demo | Test content of start.rb and demo.yaml files. |
|
|
70
|
-
| teuton check path/to/file/foo.rb | Test content of foo.rb and foo.yaml files. |
|
|
71
|
-
| teuton check path/to/file/foo.rb --cname=demo | Test content of foo.rb and demo.yaml files.|
|
|
72
|
-
|
|
73
|
-
Alias: `teuton c foo`, `teuton -c foo`, `teuton --check foo`
|
|
74
|
-
|
|
75
|
-
# 5. Run test
|
|
76
|
-
|
|
77
|
-
Read about how to [run tests](run-tests.md)
|
|
78
|
-
|
|
79
|
-
# 6. Show test info as README file
|
|
80
|
-
|
|
81
|
-
Create a readme file for the exercise.
|
|
82
|
-
|
|
83
|
-
Usage: `teuton readme DIRPATH > README.md`
|
|
84
|
-
|
|
85
|
-
This function reads test and config files, and generate Markdown output with guidelines and target descriptions about the exercise.
|
|
86
|
-
|
|
87
|
-
Alias: `teuton r DIRPATH`, `teuton -r DIRPATH`, `teuton --readme DIRPATH`
|
|
17
|
+
Available command functions:
|
|
18
|
+
1. [run](run.md)
|
|
19
|
+
2. [check](check.md)
|
|
20
|
+
3. [config](config.md)
|
|
21
|
+
4. [help](help.md)
|
|
22
|
+
5. [new](new.md)
|
|
23
|
+
6. [readme](readme.md)
|
|
24
|
+
7. **version**: _Show current version_. Usage: `teuton version`.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
[<< back](../../README.md)
|
|
2
|
+
|
|
3
|
+
# check
|
|
4
|
+
|
|
5
|
+
_Check test and config files from test folder._
|
|
6
|
+
|
|
7
|
+
Usage: `teuton check PATH/TO/DIR`
|
|
8
|
+
|
|
9
|
+
| Command | Description |
|
|
10
|
+
| ---------------------------- | ----------- |
|
|
11
|
+
| teuton check PATH/TO/DIR/foo | Test content of start.rb and config.yaml files. |
|
|
12
|
+
| teuton check PATH/TO/DIR/foo --cname=demo | Test content of start.rb and demo.yaml files. |
|
|
13
|
+
| teuton check PATH/TO/FILE/foo.rb | Test content of foo.rb and foo.yaml files. |
|
|
14
|
+
| teuton check PATH/TO/FILE/foo.rb --cname=demo | Test content of foo.rb and demo.yaml files.|
|
|
15
|
+
|
|
16
|
+
Options:
|
|
17
|
+
|
|
18
|
+
| Param | Description | Default value |
|
|
19
|
+
| ---------------- | ---------------------------------------- | ------------- |
|
|
20
|
+
| --no-panelconfig | Show check information | Enabled |
|
|
21
|
+
| --panelconfig | Only show config file recomended content | Disabled |
|
|
22
|
+
| --cpath | Specify path to config file | PATH/TO/config.yaml |
|
|
23
|
+
| --cname | Specify name to config file | config.yaml |
|
|
24
|
+
|
|
25
|
+
Alias: `teuton c foo`, `teuton -c foo`, `teuton --check foo`
|
|
26
|
+
|
|
27
|
+
## Example
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
$ teuton check examples/02-target
|
|
31
|
+
|
|
32
|
+
+----------------------------+
|
|
33
|
+
| GROUP: Learn about targets |
|
|
34
|
+
+----------------------------+
|
|
35
|
+
(001) target Create user obiwan
|
|
36
|
+
weight 2.0
|
|
37
|
+
run 'id obiwan' on localhost
|
|
38
|
+
expect ["uid=", "(obiwan)", "gid="] (Array)
|
|
39
|
+
|
|
40
|
+
(002) target Delete user vader
|
|
41
|
+
weight 1.0
|
|
42
|
+
run 'id vader' on localhost
|
|
43
|
+
expect_fail
|
|
44
|
+
|
|
45
|
+
+--------------+-------+
|
|
46
|
+
| DSL Stats | Count |
|
|
47
|
+
+--------------+-------+
|
|
48
|
+
| Groups | 1 |
|
|
49
|
+
| Targets | 2 |
|
|
50
|
+
| Runs | 2 |
|
|
51
|
+
| * localhost | 2 |
|
|
52
|
+
+--------------+-------+
|
|
53
|
+
[WARN] Configfile not found
|
|
54
|
+
.../examples/02-target/config.yaml
|
|
55
|
+
[INFO] Recomended content:
|
|
56
|
+
---
|
|
57
|
+
global:
|
|
58
|
+
cases:
|
|
59
|
+
- tt_members: TOCHANGE
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The check process notifies that
|
|
63
|
+
* This test hasn't config file
|
|
64
|
+
* and recommends content for our config file. But it isn't necessary for this example.
|
|
65
|
+
* exit_code 0 = Syntax ok.
|
|
66
|
+
* exit code 1 = Syntax ERROR.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
[<< back](../../README.md)
|
|
2
|
+
|
|
3
|
+
# config
|
|
4
|
+
|
|
5
|
+
_Help to create config file._
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
* `teuton config DIRECTORY`
|
|
9
|
+
* `teuton config --server DIRECTORY`
|
|
10
|
+
|
|
11
|
+
## Suggest config content
|
|
12
|
+
|
|
13
|
+
* This is our test file content.
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
# File: examples/03-remote_hosts/start.rb`
|
|
17
|
+
|
|
18
|
+
group "Remote host" do
|
|
19
|
+
target "Create user root"
|
|
20
|
+
run "id root", on: :host1
|
|
21
|
+
expect ["uid=", "(root)", "gid="]
|
|
22
|
+
|
|
23
|
+
target "Delete user vader"
|
|
24
|
+
run "id vader", on: :host1
|
|
25
|
+
expect_fail
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
play do
|
|
29
|
+
show
|
|
30
|
+
export
|
|
31
|
+
end
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
* Run `teuton config examples/03-remote_hosts` to suggest config file content:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
---
|
|
38
|
+
global:
|
|
39
|
+
cases:
|
|
40
|
+
- tt_members: TOCHANGE
|
|
41
|
+
host1_ip: TOCHANGE
|
|
42
|
+
host1_username: TOCHANGE
|
|
43
|
+
host1_password: TOCHANGE
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Init Config Server
|
|
47
|
+
|
|
48
|
+
_Initialize Config Server, so students connect and help to build config file content._
|
|
49
|
+
|
|
50
|
+
* Project files:
|
|
51
|
+
```
|
|
52
|
+
foo
|
|
53
|
+
├── config.yaml
|
|
54
|
+
└── start.rb
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
# File: foo/config.yaml
|
|
59
|
+
---
|
|
60
|
+
global:
|
|
61
|
+
cases:
|
|
62
|
+
- tt_members: TOCHANGE
|
|
63
|
+
tt_moodle_id: TOCHANGE
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
* `teuton config --server foo`, init config server.
|
|
67
|
+
```
|
|
68
|
+
--------------------------------------------------
|
|
69
|
+
ConfigServer URL: http://192.168.1.42:8080
|
|
70
|
+
|
|
71
|
+
Project path : foo
|
|
72
|
+
Global params (0)
|
|
73
|
+
Cases params (2)
|
|
74
|
+
* tt_members
|
|
75
|
+
* tt_moodle_id
|
|
76
|
+
--------------------------------------------------
|
|
77
|
+
== Sinatra (v4.2.1) has taken the stage on 8080 for development with backup from Puma
|
|
78
|
+
Puma starting in single mode...
|
|
79
|
+
* Puma version: 7.1.0 ("Neon Witch")
|
|
80
|
+
* Ruby version: ruby 3.2.8 (2025-03-26 revision 13f495dc2c) [x86_64-linux]
|
|
81
|
+
* Min threads: 0
|
|
82
|
+
* Max threads: 5
|
|
83
|
+
* Environment: development
|
|
84
|
+
* PID: 18938
|
|
85
|
+
* Listening on http://0.0.0.0:8080
|
|
86
|
+
Use Ctrl-C to stop
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
* Now students connect to host 192.168.1.42 and send their configuracion values.
|
|
90
|
+
* Student host:
|
|
91
|
+
|
|
92
|
+

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

|
|
97
|
+
|
|
98
|
+
* When all students submit their data, the teacher presses CTRL-C to end the service
|
|
99
|
+
* The received data is saved in separate files within the `config.d` subfolder
|
|
100
|
+
* Project files:
|
|
101
|
+
```
|
|
102
|
+
foo
|
|
103
|
+
├── config.d
|
|
104
|
+
│ ├── from_127.0.0.1.yaml
|
|
105
|
+
│ ├── from_192.168.1.14.yaml
|
|
106
|
+
│ └── from_192.168.1.28.yaml
|
|
107
|
+
├── config.yaml
|
|
108
|
+
└── start.rb
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
* And now the main configuration file (config.yaml) has the following content:
|
|
112
|
+
* Global param `tt_include: config.d`.
|
|
113
|
+
* No cases in main config file. Read case data from files into `config.d` subfolder.
|
|
114
|
+
|
|
115
|
+
```yaml
|
|
116
|
+
---
|
|
117
|
+
global:
|
|
118
|
+
tt_include: config.d
|
|
119
|
+
cases: []
|
|
120
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[<< back](../../README.md)
|
|
2
|
+
|
|
3
|
+
# help
|
|
4
|
+
|
|
5
|
+
_Show help about command functions._
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
* `teuton help`
|
|
9
|
+
* `teuton help FUNCTION_NAME`
|
|
10
|
+
|
|
11
|
+
Alias: `teuton h`,`teuton -h`, `teuton --help`
|
|
12
|
+
|
|
13
|
+
**Example**: `teuton help`
|
|
14
|
+
```
|
|
15
|
+
Commands:
|
|
16
|
+
teuton [run] [OPTIONS] DIRECTORY # Run test from directory
|
|
17
|
+
teuton check [OPTIONS] DIRECTORY # Check test and config file content
|
|
18
|
+
teuton config [OPTIONS] DIRECTORY # Suggest configuration or run server
|
|
19
|
+
teuton help [COMMAND] # Describe available commands or one specific command
|
|
20
|
+
teuton new DIRECTORY # Create skeleton for a new project
|
|
21
|
+
teuton readme DIRECTORY # Show README extracted from test contents
|
|
22
|
+
teuton version # Show the program version
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Example**: `teuton help config`
|
|
26
|
+
```
|
|
27
|
+
Usage:
|
|
28
|
+
teuton config [OPTIONS] DIRECTORY
|
|
29
|
+
|
|
30
|
+
Options:
|
|
31
|
+
[--server], [--no-server], [--skip-server]
|
|
32
|
+
|
|
33
|
+
Description:
|
|
34
|
+
config DIRECTORY, "Suggest the content of the configuration file based on the test"
|
|
35
|
+
|
|
36
|
+
config --server DIRECTORY, "Init Config Server. Students connect and help to build config file content"
|
|
37
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[<< back](../../README.md)
|
|
2
|
+
|
|
3
|
+
# new
|
|
4
|
+
|
|
5
|
+
_Create the skeleton of a new project._
|
|
6
|
+
|
|
7
|
+
Usage: `teuton new DIRECTORY`
|
|
8
|
+
|
|
9
|
+
Example:
|
|
10
|
+
|
|
11
|
+
```console
|
|
12
|
+
$ teuton new foo
|
|
13
|
+
|
|
14
|
+
Creating foo project
|
|
15
|
+
* Create dir => foo
|
|
16
|
+
* Create file => foo/config.yaml
|
|
17
|
+
* Create file => foo/start.rb
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
This command will create the next structure:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
foo
|
|
24
|
+
├── config.yaml
|
|
25
|
+
└── start.rb
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
| Type | Path | Description |
|
|
29
|
+
| --------- | --------------- | -------------- |
|
|
30
|
+
| Directory | foo | Base directory |
|
|
31
|
+
| File | foo/start.rb | Main file with test definitions |
|
|
32
|
+
| File | foo/config.yaml | YAML configuration file |
|
|
33
|
+
|
|
34
|
+
Alias: `teuton n foo`, `teuton -n foo`, `teuton --new foo`
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
[<< back](../../README.md)
|
|
2
|
+
|
|
3
|
+
# readme
|
|
4
|
+
|
|
5
|
+
_Show test info as README file. Useful for create a readme file for the exercise._
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
* `teuton readme DIRPATH`
|
|
9
|
+
* `teuton readme DIRPATH > README.md`
|
|
10
|
+
|
|
11
|
+
This function reads test and config files, and generate Markdown output with guidelines and target descriptions about the exercise.
|
|
12
|
+
|
|
13
|
+
Alias: `teuton r DIRPATH`, `teuton -r DIRPATH`, `teuton --readme DIRPATH`
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
Test content:
|
|
18
|
+
```
|
|
19
|
+
$ cat examples/02-target/start.rb
|
|
20
|
+
|
|
21
|
+
group "Learn about targets" do
|
|
22
|
+
target "Create user obiwan", weight: 2
|
|
23
|
+
run "id obiwan"
|
|
24
|
+
expect ["uid=", "(obiwan)", "gid="]
|
|
25
|
+
|
|
26
|
+
target "Delete user vader"
|
|
27
|
+
run "id vader"
|
|
28
|
+
expect_fail
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
start do
|
|
32
|
+
show
|
|
33
|
+
export
|
|
34
|
+
end
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Generate test documentation: `teuton readme examples/02-target`
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
```
|
|
41
|
+
Date : 2025-12-02 16:00:09 +0000
|
|
42
|
+
Teuton : 2.11.0
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
# Test name: 02-target
|
|
46
|
+
|
|
47
|
+
## Learn about targets
|
|
48
|
+
|
|
49
|
+
Go to [LOCALHOST](#required-hosts) host, and do next:
|
|
50
|
+
* (x2.0) Create user obiwan.
|
|
51
|
+
* (x1.0) Delete user vader.
|
|
52
|
+
---
|
data/docs/config_file.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
[<< back](../README.md)
|
|
2
|
+
|
|
3
|
+
# Config file
|
|
4
|
+
|
|
5
|
+
By default, Teuton projects use `config.yaml` as configuration file.
|
|
6
|
+
|
|
7
|
+
Our tests may or may not have a configuration file. It is common to have a configuration file to easily adapt the test execution to different hosts, environments or situations. For example: adapt the config file for each course for the different students we are going to evaluate.
|
|
8
|
+
|
|
9
|
+
## Creating new project
|
|
10
|
+
|
|
11
|
+
* Create a new project `teuton new foo`.
|
|
12
|
+
```
|
|
13
|
+
Creating foo project
|
|
14
|
+
* Create dir => foo
|
|
15
|
+
* Create file => foo/config.yaml
|
|
16
|
+
* Create file => foo/start.rb
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
* We now have the following files.
|
|
20
|
+
```
|
|
21
|
+
foo
|
|
22
|
+
├── config.yaml
|
|
23
|
+
└── start.rb
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
* Configuration file content.
|
|
27
|
+
```yaml
|
|
28
|
+
# File: foo/config.yaml
|
|
29
|
+
---
|
|
30
|
+
global:
|
|
31
|
+
cases:
|
|
32
|
+
- tt_members: TOCHANGE
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The configuration file is in YAML format with two main sections: `global` y `cases`. The `global` section can be empty. Parameters defined in the `global` section will be accessible to all cases.
|
|
36
|
+
The `cases` section contains specific parameters for each case.
|
|
37
|
+
|
|
38
|
+
## Global section vs cases section
|
|
39
|
+
|
|
40
|
+
**Example:**
|
|
41
|
+
|
|
42
|
+
```yaml
|
|
43
|
+
# File: examples/03-remote_hosts/config.yaml
|
|
44
|
+
---
|
|
45
|
+
global:
|
|
46
|
+
host1_username: root
|
|
47
|
+
cases:
|
|
48
|
+
- tt_members: student_1
|
|
49
|
+
host1_ip: 192.168.1.201
|
|
50
|
+
host1_password: secret_1
|
|
51
|
+
- tt_members: student_2
|
|
52
|
+
host1_ip: 192.168.1.202
|
|
53
|
+
host1_password: secret_2
|
|
54
|
+
- tt_members: student_3
|
|
55
|
+
host1_ip: 127.0.0.1
|
|
56
|
+
host1_password: secret_3
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
* The parameter `host1_username` is defined in the global section, so all cases will read the same value. Example: `get(:host1_username) == "root"`.
|
|
60
|
+
* The parameters `tt_members`, `host1_ip`, and `host1_password` are defined in each case. So, every student has diferents values. The student number 1 will have one value, student number 2 another, and so on.
|
|
61
|
+
|
|
62
|
+
It is posible to add as many parameters as you need. But remember that parameters defined in the global section will be available to all students (cases), while parameters defined in the cases section will be specifically defined for each student (case).
|
|
63
|
+
|
|
64
|
+
## Reserved params
|
|
65
|
+
|
|
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
|
+
|
|
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_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 |
|
|
73
|
+
| **tt_include** | global | Optional | The contents of the files within the directory defined by the parameter are added to our main configuration file |
|
|
74
|
+
| **tt_sequence** | global | Optional | By default, all cases are evaluated in parallel unless sequential mode is enabled. Sequential mode is useful for debugging processes.|
|
|
75
|
+
| **tt_source_ip** | cases | Auto | Automatically filled in during remote setup. This value is completed when the student sends their configuration remotely.|
|
|
76
|
+
| **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. |
|
|
77
|
+
| **tt_skip** | | Optional | False by default. To skip a case and not evaluate it, set the value to true. |
|
|
78
|
+
| **tt_testname** | global | Optional | Customize your test name |
|
|
79
|
+
|
|
80
|
+
## Host properties
|
|
81
|
+
|
|
82
|
+
Parameters used to define the properties of each host must begin with an identifier (HOSTID).
|
|
83
|
+
|
|
84
|
+
Lits of available host properties:
|
|
85
|
+
|
|
86
|
+
| Param name | Required | Default value | Description |
|
|
87
|
+
| --------------- | -------- | ------------- | ----------- |
|
|
88
|
+
| HOSTID_ip | Yes | | IP address or hostname of the host identified by HOSTID |
|
|
89
|
+
| HOSTID_username | No | | User account to access HOSTID |
|
|
90
|
+
| HOSTID_password | No | | Password to access HOSTID |
|
|
91
|
+
| HOSTID_protocol | No | ssh | Available options: ssh (default), telnet |
|
|
92
|
+
| HOSTID_port | No | 22/23 | Default value: 22 (ssh), 23 (telnet) |
|
|
93
|
+
| HOSTID_route | No | | This option is used to configure a gateway to access HOSTID |
|
|
94
|
+
|
|
95
|
+
We can create as many host configurations as different devices are required to complete the activity.
|
|
96
|
+
|
|
97
|
+
If `HOSTID_password` is not defined, then SSH connection will use the SSH keys.
|
|
98
|
+
|
|
99
|
+
**Example**: If each student needs two hosts for the activity, one web server and the other as web cliente, we need to define 2 hosts: one with HOSTID `server`and the other wiht HOSTID `client`:
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
global:
|
|
103
|
+
cases:
|
|
104
|
+
- tt_members: student_1
|
|
105
|
+
server_ip: 192.168.13.1
|
|
106
|
+
server_username: root
|
|
107
|
+
server_password: server_secret_1
|
|
108
|
+
client_ip: 192.168.13.2
|
|
109
|
+
client_username: david
|
|
110
|
+
client_password: david_secret_1
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Or we can use other names, for example one with HOSTID `host1` and the other with HOSTID `host2`.
|
|
114
|
+
|
|
115
|
+
```yaml
|
|
116
|
+
global:
|
|
117
|
+
cases:
|
|
118
|
+
- tt_members: student_1
|
|
119
|
+
host1_ip: 192.168.13.1
|
|
120
|
+
host1_username: root
|
|
121
|
+
host1_password: server_secret_1
|
|
122
|
+
host2_ip: 192.168.13.2
|
|
123
|
+
host2_username: david
|
|
124
|
+
host2_password: david_secret_1
|
|
125
|
+
```
|