teuton 2.1.8 → 2.1.9

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.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -8
  3. data/bin/check_teuton +43 -0
  4. data/docs/changelog/contributions.md +32 -0
  5. data/docs/changelog/v2.1.md +22 -0
  6. data/docs/changelog/v2.2.md +29 -0
  7. data/docs/commands/README.md +105 -7
  8. data/docs/commands/example_check.md +54 -0
  9. data/docs/commands/example_run.md +112 -0
  10. data/docs/dsl/README.md +11 -9
  11. data/docs/dsl/definition/expect.md +25 -21
  12. data/docs/dsl/definition/group.md +5 -1
  13. data/docs/dsl/definition/result.md +45 -34
  14. data/docs/dsl/definition/run_local.md +34 -0
  15. data/docs/dsl/definition/run_remote.md +119 -0
  16. data/docs/dsl/definition/target.md +6 -0
  17. data/docs/dsl/execution/export.md +27 -19
  18. data/docs/dsl/execution/play.md +4 -0
  19. data/docs/dsl/execution/send.md +21 -2
  20. data/docs/dsl/execution/show.md +13 -8
  21. data/docs/dsl/setting/get.md +24 -8
  22. data/docs/dsl/setting/set.md +8 -3
  23. data/docs/install/README.md +19 -26
  24. data/docs/install/modes_of_use.md +27 -26
  25. data/docs/install/scripts.md +53 -36
  26. data/docs/install/vagrant_docker.md +56 -0
  27. data/docs/learn/README.md +13 -6
  28. data/docs/learn/example-01-target.md +78 -61
  29. data/docs/learn/example-02-config.md +152 -0
  30. data/docs/learn/example-03-remote-hosts.md +31 -25
  31. data/docs/learn/example-04-use.md +23 -17
  32. data/docs/learn/example-05-debug.md +24 -17
  33. data/docs/learn/example-06-log.md +70 -0
  34. data/lib/teuton/application.rb +7 -4
  35. data/lib/teuton/case_manager/case/case.rb +4 -1
  36. data/lib/teuton/case_manager/case/dsl/expect.rb +3 -1
  37. data/lib/teuton/case_manager/case/dsl/goto.rb +12 -7
  38. data/lib/teuton/case_manager/case/dsl/macro.rb +38 -0
  39. data/lib/teuton/case_manager/case/dsl/main.rb +1 -2
  40. data/lib/teuton/case_manager/case/dsl/target.rb +1 -1
  41. data/lib/teuton/case_manager/case/runner.rb +7 -7
  42. data/lib/teuton/case_manager/case_manager.rb +1 -20
  43. data/lib/teuton/case_manager/check_cases.rb +12 -2
  44. data/lib/teuton/case_manager/dsl.rb +4 -6
  45. data/lib/teuton/case_manager/export_manager.rb +29 -3
  46. data/lib/teuton/case_manager/report.rb +29 -8
  47. data/lib/teuton/case_manager/show.rb +8 -4
  48. data/lib/teuton/cli.rb +1 -0
  49. data/lib/teuton/cli/play.rb +1 -0
  50. data/lib/teuton/cli/version.rb +1 -4
  51. data/lib/teuton/files/config.yaml +0 -1
  52. data/lib/teuton/files/start.rb +1 -1
  53. data/lib/teuton/files/template/case.html +135 -0
  54. data/lib/teuton/files/template/resume.html +115 -0
  55. data/lib/teuton/project/laboratory/builtin.rb +2 -1
  56. data/lib/teuton/project/laboratory/dsl.rb +13 -15
  57. data/lib/teuton/project/laboratory/laboratory.rb +5 -1
  58. data/lib/teuton/project/laboratory/show.rb +21 -13
  59. data/lib/teuton/project/name_file_finder.rb +6 -1
  60. data/lib/teuton/project/project.rb +7 -3
  61. data/lib/teuton/project/readme/dsl.rb +3 -1
  62. data/lib/teuton/project/readme/readme.rb +37 -26
  63. data/lib/teuton/project/skeleton.rb +20 -4
  64. data/lib/teuton/report/close.rb +15 -11
  65. data/lib/teuton/report/formatter/formatter_factory.rb +10 -6
  66. data/lib/teuton/report/formatter/html_formatter.rb +16 -79
  67. data/lib/teuton/report/formatter/resume_html_formatter.rb +39 -0
  68. data/lib/teuton/report/formatter/resume_yaml_formatter.rb +7 -1
  69. data/lib/teuton/report/report.rb +5 -4
  70. data/lib/teuton/report/show.rb +55 -26
  71. metadata +26 -39
  72. data/docs/changelog/todo.md +0 -46
  73. data/docs/commands/create_skeleton.md +0 -31
  74. data/docs/commands/help.md +0 -13
  75. data/docs/commands/revise_test.md +0 -46
  76. data/docs/commands/run_test_unit.md +0 -78
  77. data/docs/commands/show_version.md +0 -9
  78. data/docs/developers/01-telnet.md +0 -121
  79. data/docs/developers/02-ssh.md +0 -93
  80. data/docs/developers/03-encoding.md +0 -153
  81. data/docs/developers/comparative.md +0 -17
  82. data/docs/dsl/_Sidebar.md +0 -30
  83. data/docs/dsl/definition/goto.md +0 -112
  84. data/docs/dsl/definition/run.md +0 -23
  85. data/docs/install/tested_os.md +0 -25
  86. data/docs/install/vagrant.md +0 -9
  87. data/docs/learn/example-02-configfile.md +0 -174
  88. data/docs/learn/quick-demo.md +0 -170
  89. data/lib/teuton/case_manager/case/dsl/check.rb +0 -24
  90. data/lib/teuton/case_manager/case/dsl/missing.rb +0 -12
  91. data/lib/teuton/files/gitignore +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfb81fb786d0111b84d43f68a98b222639f37cc620fcf1156bf8722416f78a25
4
- data.tar.gz: 71ba4a3325eb5d2ed76b64efbe9476fc77d82794d620416482a7ac57b835f692
3
+ metadata.gz: c3c302d5d5b9c2d2f2dc70ca29ae86a2841306b32d0274948fd2b801f1171e28
4
+ data.tar.gz: f3cab7959971634f856db2ec691760a1c25cda19cfaa922c6ab6fe90aa366bd0
5
5
  SHA512:
6
- metadata.gz: 599b8e1e1dece4f9a3afad33c1d7e71417a280f31ed7e78632d62d8b2819d8cb99d04409b152a1e1cabfa90191e244863ca02593fbe44638ddd9fde9bdb682d7
7
- data.tar.gz: d781970ef1d69087099915f6474df31af872fd64823e2643279407df6f9a83731127696c91bb5b8a0627b3543d0cfb6dac8c2db29b0edb006a64222a589ea01d
6
+ metadata.gz: 5875b36ddc9caebcf9e28fc5d01cf2b3eaa9f4c8220f8e19f85f7b79af5647518703a8f69f83435a158b9e92a568f8aa5a699f8b38f80936eba030a270fc4199
7
+ data.tar.gz: 638adf64c88bf2f481ac7e10e4b427266c64c5ced38d47ed9f86456e0f53196adfe45402ef4114ba319f586fd54a80e7253cdf9aedf2dc37f28b570761f7bdfc
data/README.md CHANGED
@@ -17,25 +17,22 @@ Teuton allow us:
17
17
  * Write test units for real or virtual machines using simple DSL.
18
18
  * Check compliance with requirements on remote machines.
19
19
 
20
- ---
21
20
  # Documentation
22
21
 
23
22
  * [Installation](https://github.com/teuton-software/teuton/tree/devel/docs/install/README.md)
24
23
  1. Install Ruby on your system.
25
- 2. `gem install teuton`
24
+ 1. `gem install teuton`
26
25
  * [Learning](https://github.com/teuton-software/teuton/tree/devel/docs/learn/README.md)
27
26
  * [Commands](https://github.com/teuton-software/teuton/tree/devel/docs/commands/README.md)
28
- * [DSL keywords](https://github.com/teuton-software/teuton/tree/devel/docs/dsl/README.md)
27
+ * [Teuton language](https://github.com/teuton-software/teuton/tree/devel/docs/dsl/README.md)
29
28
 
30
- ---
31
29
  # Features
32
30
 
33
31
  * [Free Software License](https://github.com/teuton-software/teuton/tree/devel/LICENSE).
34
- * Multiplatform .
35
- * Use SSH or Telnet protocol to connect to remote machines.
36
- * Developed using the ruby language.
32
+ * Multiplatform.
33
+ * Remote machines only require SSH or Telnet service installed.
34
+ * Developed using ruby language.
37
35
 
38
- ---
39
36
  # Contact
40
37
 
41
38
  * **Email**: `teuton.software@protonmail.com`
data/bin/check_teuton ADDED
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'yaml'
4
+
5
+ module CheckTeuton
6
+ ##
7
+ # Start check_teuton
8
+ # @param arg (String) First input argument
9
+ def self.start(arg)
10
+ show_help if arg.nil? or arg == 'help'
11
+ run(arg)
12
+ end
13
+
14
+ ##
15
+ # Show help
16
+ def self.show_help()
17
+ puts "check_teuton"
18
+ puts " help => Show this help"
19
+ puts " PATH/TO/CASE/YAML => Read yaml for Nagios/Icinga"
20
+ exit 0
21
+ end
22
+
23
+ def self.run(filename)
24
+ unless File.exist?(filename)
25
+ puts "UNKNOWN - File not found! (#{filename})"
26
+ exit 3
27
+ end
28
+ data = YAML.load(File.read(filename))
29
+ testname = data[:config][:tt_testname]
30
+ grade = data[:results][:grade].to_i
31
+ if grade == 100
32
+ puts "OK - #{testname}/case-#{data[:results][:case_id]} Grade=100%"
33
+ exit 0
34
+ elsif grade < 50
35
+ puts "CRITICAL - #{testname}/case-#{data[:results][:case_id]} Grade=0%"
36
+ exit 2
37
+ end
38
+ puts "WARNING - #{testname}/case-#{data[:results][:case_id]} Grade=#{grade}%"
39
+ exit 1
40
+ end
41
+ end
42
+
43
+ CheckTeuton.start(ARGV[0])
@@ -0,0 +1,32 @@
1
+
2
+ # TO-DO list
3
+
4
+ List of things to do, classified into 3 sections:
5
+ * (A) I know read and write.
6
+ * (B) I work as IT teacher
7
+ * (C) I want to program ruby language
8
+
9
+ > I write this list without any criteria.
10
+ > Only an unordered list of interesting/usefull things to be done.
11
+
12
+ ## Section A
13
+
14
+ Documentation
15
+
16
+ * Revise documentation.
17
+ * Make videos showing how to use this tool
18
+ * Video about download and install this tool
19
+ * Test installation scripts
20
+ * Vídeo with Windows installation.
21
+ * Video using examples 01 to 05...
22
+ * Write a special documentation for novice
23
+
24
+ ## Section B
25
+
26
+ * Create your own (simple or complex) teuton tests.
27
+ * Upload your own tests to github.com/teuton-software/challenge repository.
28
+
29
+ ## Section C
30
+
31
+ * Contact with us to help develop this tool :-)
32
+
@@ -137,3 +137,25 @@ Add new features to DSL
137
137
  * Use Bundler to install gems instead of rake.
138
138
  * It will be usefull use sysadming-game as gem? And install it with `gem install teuton`.
139
139
  * Vagrant: test how to use vagrant machines as case hosts.
140
+
141
+ ---
142
+ Info sobre novedades de la versión 2.1
143
+ 1. Teuton readme y dsl readme
144
+ 2. Macros de define macro
145
+ 3. Export yaml y html
146
+ 4. Teuton --no-color
147
+ 5 teuton run --case
148
+ 6 teuton run --cname
149
+ 7 teuton run --cpath
150
+ 8 actualizar formatos de salida
151
+ 9 instalación mediante gemas
152
+ 10 teuton panel
153
+ 11 teuton client y server
154
+ 12 nuevos nombres de comandos...
155
+ 13 cambio de goto a run
156
+ ....
157
+
158
+ * config -> host_port
159
+ * teuton run into
160
+ * resume.html
161
+ * txt format -> remove conn_errors when errors = 0
@@ -0,0 +1,29 @@
1
+
2
+ Para la 2.2 entonces:
3
+ 1. Metadatis con tags y búsqueda. Facilitar a los usuarios encontrar retos.
4
+ 2. Teuton run con estado para la corrección progresiva. Esto da juego a diferentes formas de usar la herramienta.
5
+ 3. Teuton web para recibir peticiones de los clientes... ?!
6
+ 4. Editor de ficheros de configuración.... una especie de asistente de ayuda..
7
+ 5. Editor de tests ?! .... lo veo complejo... a menos que se empiece por una versión simplificada..
8
+ 6. Empaquetar tests para facilitar su movilidad . Esto se combina muy bien con la opción de búsqueda de retos.... pensar en firma gpg o md5 de comprobación etc..
9
+ 7 crear una" librería " de las macros más frecuentes?!... una ayuda para facilitar la creación de test... esto se puede emparejar con el editor de test...
10
+ 8 actualizar las pruebas con vagrant para la versión actual. Mejora de la calidad del código.
11
+ 9. Documentar y hacer videos.
12
+ 10. Tener foros de la comunidad o presencia en reddit o stackoverflow.... o algo parecido???
13
+ ...
14
+ Esta es una lista de ideas para la versión 2.2 y que no se me olvide... lo podemos ir ajustando 😊
15
+
16
+
17
+ * `result.test("...")`
18
+ * `send :email_to => :members_emails`
19
+
20
+ Gamification
21
+ * When students demand help they could recibe some advises.
22
+ * Define a loop of executions of our activity. For example:
23
+ every 5 minutes, run the activity, and repeat this 10 times.
24
+ `start :times=>10, :duration=>5 do`
25
+ * More ideas: bonus, lives, etc.
26
+
27
+ Create 2 evaluation modes:
28
+ 1. Evaluate targets (current mode): `start :score=>:targets do ...`
29
+ 1. Evaluate task: `start :score=>:tasks do ...`
@@ -1,10 +1,108 @@
1
+ [<< back](../../README.md)
1
2
 
2
3
  # Commands
3
4
 
4
- | Command | Description |
5
- | --------------------- | -------------------------------------- |
6
- | teuton | [Show help](help.md) |
7
- | teuton version | [Show version](show_version.md) |
8
- | teuton create DIRPATH | [Create skeleton project](create_skeleton.md) into DIRPATH |
9
- | teuton play DIRPATH | [Run a Test Unit](run_test_unit.md) contained into DIRPATH |
10
- | teuton test DIRPATH | [Revise Test without run it](revise_test.md) |
5
+ Available command functions:
6
+ 1. Show help
7
+ 2. Show version
8
+ 3. Create new test skeleton
9
+ 4. Check teuton test
10
+ 5. Run teuton test
11
+ * Running Teuton test
12
+ * Command options
13
+ * Choosing other config file name
14
+
15
+ # 1. Show help
16
+
17
+ Usage:
18
+
19
+ ```bash
20
+ teuton
21
+ ```
22
+
23
+ Example:
24
+
25
+ ```bash
26
+ > teuton
27
+ Commands:
28
+ teuton [run] [OPTIONS] DIRECTORY # Run challenge from directory
29
+ teuton check [OPTIONS] DIRECTORY # Test or check challenge contents
30
+ teuton help [COMMAND] # Describe available commands or one specific command
31
+ teuton new DIRECTORY # Create skeleton for a new project
32
+ teuton readme DIRECTORY # Create README.md file from challenge contents
33
+ teuton version # Show the program version
34
+
35
+ ```
36
+
37
+ # 2. Show version
38
+
39
+ Usage:
40
+
41
+ ```bash
42
+ teuton version
43
+ ```
44
+
45
+ Example:
46
+
47
+ ```bash
48
+ $ teuton version
49
+ teuton (version 2.1.9)
50
+ ```
51
+
52
+ Alias:
53
+ * `teuton v`
54
+ * `teuton -v`
55
+ * `teuton --version`
56
+
57
+ # 3. Create new test skeleton
58
+
59
+ Usage:
60
+
61
+ ```bash
62
+ teuton new foo
63
+ ```
64
+
65
+ Example:
66
+
67
+ ```bash
68
+ > teuton new foo
69
+
70
+ [INFO] Creating foo project skeleton
71
+ * Create dir => foo
72
+ * Create file => foo/config.yaml
73
+ * Create file => foo/start.rb
74
+ * Create file => foo/.gitignore
75
+ ```
76
+
77
+ This command will create the next structure:
78
+
79
+ | File/Directory | Description |
80
+ | --------------- | -------------- |
81
+ | foo | Base directory |
82
+ | foo/start.rb | Main Script |
83
+ | foo/config.yaml | YAML configuration file |
84
+ | foo/.gitignore | By default, ignore YAML files to be upload on git repository |
85
+
86
+ # 5. Check teuton test
87
+
88
+ Usage:
89
+
90
+ ```bash
91
+ teuton check DIRPATH
92
+ ```
93
+
94
+ Description: this command check teuton test source files,located into DIRPATH folder.
95
+
96
+ [Example](example_check.md)
97
+
98
+ # 4. Run teuton test
99
+
100
+ Usage:
101
+
102
+ ```bash
103
+ teuton run DIRPATH
104
+ ```
105
+
106
+ Description: this command run teuton test located into DIRPATH folder.
107
+
108
+ [Example](example_run.md)
@@ -0,0 +1,54 @@
1
+ [<< back](README.md)
2
+
3
+ # Check Teuton Test
4
+
5
+ Objective: Revise Teuton test located into `example\learn-01-target`.
6
+
7
+ Usage:
8
+
9
+ ```
10
+ teuton check examples/learn-01-target
11
+ ```
12
+
13
+ Example:
14
+
15
+ ```bash
16
+ > teuton check examples/learn-01-target
17
+ [INFO] ScriptPath => examples/learn-01-target/start.rb
18
+ [INFO] ConfigPath => examples/learn-01-target/config.yaml
19
+ [INFO] Pwd => /mnt/home/leap/proy/repos/teuton.d/teuton
20
+ [INFO] TestName => learn-01-target
21
+
22
+ +----------------------------+
23
+ | GROUP: Learn about targets |
24
+ +----------------------------+
25
+ (001) target Create user david
26
+ weight 1.0
27
+ run 'id david' on localhost
28
+ expect david (String)
29
+
30
+ +--------------+-------+
31
+ | DSL Stats | Count |
32
+ +--------------+-------+
33
+ | Groups | 1 |
34
+ | Targets | 1 |
35
+ | Goto | 1 |
36
+ | * localhost | 1 |
37
+ | Uniques | 0 |
38
+ | Logs | 0 |
39
+ | | |
40
+ | Gets | 0 |
41
+ | Sets | 0 |
42
+ +--------------+-------+
43
+ +----------------------+
44
+ | Revising CONFIG file |
45
+ +----------------------+
46
+ [WARN] File /mnt/home/leap/proy/repos/teuton.d/teuton/examples/learn-01-target/config.yaml not found!
47
+ [INFO] Recomended content:
48
+ ---
49
+ :global:
50
+ :cases:
51
+ - :tt_members: VALUE
52
+ ```
53
+
54
+ > The check process notifies that this Test Unit hasn't config file, and Teuton recommends content for config file. But it isn't necessary for this example.
@@ -0,0 +1,112 @@
1
+
2
+ [<< back](README.md)
3
+
4
+ 1. [Run test](#1-run-test)
5
+ 2. [Command options](#2-command-options)
6
+ 3. [Choosing config file](#3-choosing-config-file)
7
+
8
+ # 1. Run test
9
+
10
+ Description: Running Teuton test located into `example/learn-01-target` folder.
11
+
12
+ Usage:
13
+
14
+ ```bash
15
+ teuton run example/learn-01-target
16
+ ```
17
+
18
+ Example:
19
+
20
+ ```bash
21
+ > teuton run examples/learn-01-target
22
+ [INFO] ScriptPath => examples/learn-01-target/start.rb
23
+ [INFO] ConfigPath => examples/learn-01-target/config.yaml
24
+ [INFO] Pwd => /mnt/home/leap/proy/repos/teuton.d/teuton
25
+ [INFO] TestName => learn-01-target
26
+
27
+ ==================================
28
+ Executing [teuton] (version 2.1.9)
29
+ [INFO] Running in parallel (2020-04-19 14:09:41 +0100)
30
+ .
31
+ [INFO] Duration = 0.004 (2020-04-19 14:09:41 +0100)
32
+ ==================================
33
+
34
+ INITIAL CONFIGURATIONS
35
+ +---------------+-------------------------------------------+
36
+ | tt_title | Executing [teuton] (version 2.1.9) |
37
+ | tt_scriptname | examples/learn-01-target/start.rb |
38
+ | tt_configfile | examples/learn-01-target/config.yaml |
39
+ | tt_pwd | /mnt/home/leap/proy/repos/teuton.d/teuton |
40
+ | tt_testname | learn-01-target |
41
+ | tt_sequence | false |
42
+ +---------------+-------------------------------------------+
43
+
44
+ CASE RESULTS
45
+ +------+-----------+-------+-------+
46
+ | CASE | MEMBERS | GRADE | STATE |
47
+ | 01 | anonymous | 100.0 | |
48
+ +------+-----------+-------+-------+
49
+
50
+ FINAL VALUES
51
+ +-------------+---------------------------+
52
+ | start_time | 2020-04-19 14:09:41 +0100 |
53
+ | finish_time | 2020-04-19 14:09:41 +0100 |
54
+ | duration | 0.004231917 |
55
+ +-------------+---------------------------+
56
+ ```
57
+
58
+ # 2. Command options
59
+
60
+ Usage: `teuton help run`
61
+
62
+ ```
63
+ Usage:
64
+ teuton [run] [OPTIONS] DIRECTORY
65
+
66
+ Options:
67
+ [--export=EXPORT]
68
+ [--cname=CNAME]
69
+ [--cpath=CPATH]
70
+ [--case=CASE]
71
+ [--color], [--no-color]
72
+ [--quiet], [--no-quiet]
73
+ ```
74
+
75
+ | ID | Command | Descriptiont |
76
+ | -- | -------------------- | ------------ |
77
+ | 01 | teuton foo | Run foo/start.rb, with config file foo/config.yaml |
78
+ | 02 | teuton run foo | Run foo/start.rb, with config file foo/config.yaml |
79
+ | 03 | ruby teuton foo | Same as 01 on Windows OS |
80
+ | 04 | ruby teuton run foo | Same as 02 on WIndows OS |
81
+ | 05 | teuton . | Run ./start.rb with ./config.yaml file |
82
+ | 06 | teuton run --export=json foo | Run foo/start.rb and force json format during exporting. Others output formats availables are: txt, colored_text, json, yaml |
83
+ | 07 | teuton run --cname=rock foo | Run foo/start.rb with foo/rock.yaml config file |
84
+ | 08 | teuton foo/demo42.rb | Run foo/demo42.rb with foo/demo42.yaml config file |
85
+ | 08 | teuton run --cpath=starwars/jedi.yaml foo | Run foo/start.rb with starwars/jedi.yaml config file |
86
+ | 09 | teuton run --case=6,16 foo | Run foo/start.rb with foo/config.yaml config file but only for case id '06' and '16' |
87
+
88
+ # 3. Choosing config file
89
+
90
+ **Default names:**:
91
+ By default, when you run `teuton run foo`, this will search for:
92
+ * `foo/start.rb` test file and
93
+ * `foo/config.yaml` config file.
94
+
95
+ **Using cname param:**
96
+ It's posible execute `teuton run --cname=rock foo`, and choose diferent config file into projet folder:
97
+ * `foo/start.rb` test file and
98
+ * `foo/rock.yaml` config file.
99
+
100
+ > `cname` param searchs YAML config file into the same project folder.
101
+
102
+ **Using cpath param:**
103
+ An also, it's posible execute `teuton run --cpath=/home/david/startwars.yaml foo`, and choose config file using its absolute path:
104
+ * `foo/start.rb` test file and
105
+ * `/home/david/starwars.yaml` config file.
106
+
107
+ > `cpath` param selects YAML config file, from the specified path.
108
+
109
+ **Using diferent main rb name:**
110
+ When you execute `teuton run foo/mazingerz.rb`, this will search for:
111
+ * `foo/mazingerz.rb` test file and
112
+ * `foo/mazingerz.yaml` config file.