teuton 2.4.4 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d08e48b0ba8d25877e8e77346605089c59c56553f659d26c16e457907594c5dc
4
- data.tar.gz: 030e7290d52ddef0087e9d5f4c391f259fc88bd0c20ec4b47500e9ffcf6be6f5
3
+ metadata.gz: 8f53359ed5f8eae1b3a798630c5d56ae46076073bface7d3788de57b245a80cb
4
+ data.tar.gz: 366afd9ccee6db9bdf5756fe5954050231681763489bab11b1841e9279998c08
5
5
  SHA512:
6
- metadata.gz: ad340ebd02ca80be898aff768e523f0b8773da4b3c92181db61efbde24a55b67ca02ba243f7f1217d947c28ff8bb3ba552c867ff17ada2d2097de2cf07dd5701
7
- data.tar.gz: 258e6510a41d0d5e1218e2f42db26c2857207db389158efa69fa0125a4593fbf85f2165b8f1a16f072da8830b44f6803863ba513f4635740583c9ba7ee56d38f
6
+ metadata.gz: a40866560ec0d622b48322c0689dfe36cb9820cf565ce4258a8b71d38a1a3cc88e57f68e208c0d2a6c1a0787b7a2698af0446757bb2167fdf04d2bcd8002178f
7
+ data.tar.gz: 288e6105576a15ac25eb20d298bb552b77347b65a3a2df6632d0ef26063061c77c32ef02af88a6f7244790df9573b6e79d7e9fee8b0606006a41b0cd171a51c5
data/README.md CHANGED
@@ -3,21 +3,16 @@
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/teuton.svg)](https://badge.fury.io/rb/teuton)
5
5
  ![GitHub](https://img.shields.io/github/license/dvarrui/teuton)
6
- ![Gem](https://img.shields.io/gem/dv/teuton/2.4.0)
7
6
 
8
7
  _Create Unit Test for your machines. Test your infrastructure as code._
9
8
 
10
9
  ![logo](./docs/images/logo.png)
11
10
 
12
- Teuton is an infrastructure test tool, useful for:
11
+ Infrastructure test, useful for:
13
12
  * Sysadmin teachers who want to evaluate students remote machines.
14
13
  * Sysadmin apprentices who want to evaluate their learning process as a game.
15
14
  * Professional sysadmin who want to monitor remote machines.
16
15
 
17
- Teuton allow us:
18
- * Write unit tests for real or virtual devices, using simple DSL.
19
- * Check compliance with requirements on local or remote devices.
20
-
21
16
  # Installation
22
17
 
23
18
  Install Ruby and then:
@@ -40,18 +35,19 @@ CASE RESULTS
40
35
  | CASE | MEMBERS | GRADE | STATE |
41
36
  | 01 | anonymous | 100.0 | ✔ |
42
37
  +------+-----------+-------+-------+
43
-
44
38
  ```
45
39
 
46
40
  # Features
47
41
 
48
- * [Free Software License](LICENSE).
42
+ * Simple DSL to define your tests: `target`, `run`,`expect` and more.
43
+ * Remote devices only require SSH or Telnet service installed.
44
+ * Output format: txt, html, json, yaml, etc.
49
45
  * Multiplatform.
50
- * Remote machines/devices only require SSH or Telnet service installed.
46
+ * [Free Software License](LICENSE).
51
47
 
52
48
  # Documentation
53
49
 
54
- * [Learn](docs/learn/README.md)
50
+ * [Getting started](docs/learn/README.md)
55
51
  * [Language reference](docs/dsl/README.md)
56
52
  * [Commands](docs/commands/README.md)
57
53
  * [Installation](docs/install/README.md)
@@ -10,18 +10,9 @@ Revise:
10
10
  * verify get(:key) and get('key') works fine!
11
11
  * Formatter: xml,
12
12
 
13
- Revise documentation:
14
- * Doc learn 10,11, 12,13 y 14
15
- * 10 result and moodle_id
16
- * 12 alias
17
- * 13 include
18
- * 14 macro
19
- * Doc tt_include
20
-
21
13
  Internal changes:
22
14
  * Application to Settings
23
15
  * Laboratory to Checker
24
- * Colorize to Rainbow
25
16
  * Unify messages ERROR, INFO, WARN. etc
26
17
  * Create SendManager as ExportManager?
27
18
  * Add tt_label as alias of tt_members
@@ -1,3 +1,9 @@
1
+ ## [2.4.5]
2
+
3
+ -- FIX: "expect_nothing" was always TRUE when SSH/Telnet connections fails!
4
+ Now when SSH/Telnet connections fails result contains "SSH: NO CONNECTION!"
5
+ So "expect_nothing" will fail.
6
+
1
7
  ## [2.4.4]
2
8
 
3
9
  -- Modify: teuton check output colors and exit codes.
@@ -0,0 +1,6 @@
1
+
2
+ ## [2.5.0]
3
+
4
+ - ADD: "tt_moodle_max_score" global configuration param. Teuton grades (0-100) are divided by this value when exporting data into "moodle.csv" output file.
5
+ - UPDATE: Revise documentation. Doc learn 10,11, 12,13 y 14. 10 result and moodle_id, 12 alias, 13 include, 14 macro, Doc tt_include
6
+ - UPDATE: Internal changes. Remove Colorize gem and replace with Rainbow.
@@ -51,11 +51,10 @@ Example:
51
51
  :global:
52
52
  :cases:
53
53
  - :tt_members: VALUE
54
-
55
- Check OK!
56
54
  ```
57
55
 
58
56
  The check process notifies that
59
57
  * This test hasn't config file
60
58
  * and recommends content for our config file. But it isn't necessary for this example.
61
- * Syntax is OK!
59
+ * exit_code 0 = Syntax ok.
60
+ * exit code 1 = Syntax ERROR.
@@ -1,8 +1,8 @@
1
1
  [<< back](../../README.md)
2
2
 
3
- # Installation process
3
+ # Installation
4
4
 
5
- There are 2 types of nodes/hosts:
5
+ There are 2 types of nodes/hosts, so there are 2 installations:
6
6
 
7
7
  | ID | Software | Description |
8
8
  | -- | -------- | ----------- |
@@ -20,6 +20,7 @@ Read [modes of use](modes_of_use.md) to know more about differents T-NODE/S-NODE
20
20
  | | Fedora | Workstation 29 | x84-64 | Ok | |
21
21
  | | LinuxMint | 18.3 | x86-64 | Ok | |
22
22
  | | openSUSE | Leap 15 | x86-64 | Ok | Ok |
23
+ | | openSUSE | Tumbleweed | x86-64 | Ok | Ok |
23
24
  | | Ubuntu | 18.04 | x86-64 | Ok | Ok |
24
25
  | Microsoft | Windows | 7 Enterprise | x86 | Ok | |
25
26
  | | Windows | 10 Pro | x86-64 | Ok | Ok |
@@ -8,7 +8,7 @@ Teuton generates a file called `moodle.csv` with the grades of each student into
8
8
 
9
9
  ## tt_moodle_id
10
10
 
11
- Add a new field called `tt_moodle_id` to each case in "config.yaml". Fill it with the student's identification (For example, the email registered on the Moodle, or ID number, etc.).
11
+ Add a new field called `tt_moodle_id` to each case in "config.yaml". Fill it with the student's Moodle identification. For example, registered email on or ID number on Moodle platform.
12
12
 
13
13
  Example:
14
14
 
@@ -21,4 +21,22 @@ cases:
21
21
  tt_moodle_id: obiwan@starwars.com
22
22
  ```
23
23
 
24
- Now, when running test "moodle.csv" will be generated with all student grades.
24
+ Now, when after test execution, use "moodle.csv" output file to load students grades and feedback into your Moodle platform.
25
+
26
+ ## tt_moodle_max_score
27
+
28
+ By default, teuton evaluates grades from 0 to 100. So grade max score is 100.0 by default. Sometimes teachers configure their moodle tasks with diferents max score, so it is necesary adjust Teuton output grades with Moodle input grades.
29
+
30
+ We use `tt_moodle_max_score` to customize Moodle max score. So when Teuton export `moodle.csv` values, divides Teuton grades by this value.
31
+
32
+ Example:
33
+
34
+ ```
35
+ global:
36
+ tt_moodle_max_score: 10
37
+ cases:
38
+ - tt_members: Darth Vader
39
+ tt_moodle_id: vader@starwars.com
40
+ - tt_members: Obiwan Kenobi
41
+ tt_moodle_id: obiwan@starwars.com
42
+ ```
@@ -70,9 +70,9 @@ class Application
70
70
  Rainbow.enabled = @options["color"]
71
71
  @options["panel"] = false if @options["panel"].nil?
72
72
 
73
- return if @options["case"].nil?
74
-
75
- a = @options["case"].split(",")
76
- @options["case"] = a.collect!(&:to_i)
73
+ unless @options["case"].nil?
74
+ numbers = @options["case"].split(",")
75
+ @options["case"] = numbers.collect!(&:to_i)
76
+ end
77
77
  end
78
78
  end
@@ -98,8 +98,13 @@ class Case
98
98
  non_interactive: true
99
99
  )
100
100
  end
101
- if @sessions[hostname].instance_of? Net::SSH::Connection::Session
102
- text = @sessions[hostname].exec!(@action[:command])
101
+ text = if @sessions[hostname].instance_of? Net::SSH::Connection::Session
102
+ @sessions[hostname].exec!(@action[:command])
103
+ # ssh.exec!("ls -l /home/jamis") do |channel, stream, data|
104
+ # stdout << data if stream == :stdout
105
+ # end
106
+ else
107
+ "SSH: NO CONNECTION!"
103
108
  end
104
109
  rescue Errno::EHOSTUNREACH
105
110
  @sessions[hostname] = :nosession
@@ -148,10 +153,11 @@ class Case
148
153
  # "Prompt" => Regexp.new(username[1, 40]))
149
154
  # "Prompt" => /[$%#>] \z/n)
150
155
  h.login(username, password)
151
- text = ""
152
156
  h.cmd(@action[:command]) { |i| text << i }
153
157
  h.close
154
158
  @sessions[hostname] = :ok
159
+ else
160
+ text = "TELNET: NO CONNECTION!"
155
161
  end
156
162
  rescue Net::OpenTimeout
157
163
  @sessions[hostname] = :nosession
@@ -16,7 +16,7 @@ class Laboratory
16
16
  revise_config_content
17
17
  end
18
18
 
19
- def show_panelconfig
19
+ def show_onlyconfig
20
20
  @verbose = false
21
21
  process_content
22
22
  @verbose = true
@@ -69,9 +69,9 @@ class Laboratory
69
69
  end
70
70
 
71
71
  def recomended_config_content
72
- verboseln Rainbow("[WARN] Configfile not found").bright.yellow
73
- verboseln Rainbow(" #{@path[:config]}").white
74
- verboseln Rainbow("[INFO] Recomended content:").bright.yellow
72
+ warn Rainbow("[WARN] Configfile not found").bright.yellow
73
+ warn Rainbow(" #{@path[:config]}").white
74
+ warn Rainbow("[INFO] Recomended content:").bright.yellow
75
75
  output = {global: nil, cases: []}
76
76
  output[:cases][0] = {}
77
77
  script_vars = find_script_vars
@@ -80,18 +80,14 @@ class Laboratory
80
80
  end
81
81
 
82
82
  def recomended_panelconfig_content
83
- output = {global: {}, cases: nil}
83
+ output = {global: nil, cases: [{}]}
84
84
  script_vars = find_script_vars
85
- script_vars.each { |i| output[:global][i] = "VALUE" }
85
+ # script_vars.each { |i| output[:global][i] = "VALUE" }
86
+ script_vars.each { |i| output[:cases][0][i] = "VALUE" }
86
87
  verboseln YAML.dump(output)
87
88
  end
88
89
 
89
90
  def revise_config_content
90
- my_screen_table = Terminal::Table.new do |st|
91
- st.add_row ["Revising CONFIG file"]
92
- end
93
- verboseln my_screen_table
94
-
95
91
  unless File.exist?(@path[:config])
96
92
  recomended_config_content
97
93
  return
data/lib/teuton/cli.rb CHANGED
@@ -15,23 +15,22 @@ class CLI < Thor
15
15
  end
16
16
 
17
17
  map ["c", "-c", "--check"] => "check"
18
- option :panelconfig, type: :boolean
18
+ option :onlyconfig, type: :boolean
19
+ option :color, type: :boolean
19
20
  option :cname, type: :string
20
21
  option :cpath, type: :string
21
22
  desc "check [OPTIONS] DIRECTORY", "Check test and config file content"
22
- long_desc <<-LONGDESC
23
+ long_desc <<~LONGDESC
24
+
25
+ (1) teuton check PATH/TO/DIR , Check content of start.rb and config.yaml files.
23
26
 
24
- (1) teuton check path/to/dir/foo
25
- , Check content of start.rb and config.yaml files.
27
+ (2) teuton check PATH/TO/DIR --cname=demo , Check content of start.rb and demo.yaml files:
26
28
 
27
- (2) teuton check path/to/dir/foo --cname=demo
28
- , Check content of start.rb and demo.yaml files.
29
+ (3) teuton check PATH/TO/DIR --onlyconfig , Only show config file recomendations
29
30
 
30
- (3) teuton check path/to/file/foo.rb
31
- , Check content of foo.rb and foo.yaml files.
31
+ (4) teuton check PATH/TO/DIR/foo.rb , Check content of foo.rb and foo.yaml files.
32
32
 
33
- (4) teuton check path/to/file/foo.rb --cname=demo
34
- , Check content of foo.rb and demo.yaml files.
33
+ (5) teuton check PATH/TO/DIR/foo.rb --cname=demo , Check content of foo.rb and demo.yaml files.
35
34
 
36
35
  LONGDESC
37
36
  def check(projectpath)
@@ -16,13 +16,18 @@ class MoodleCSVFormatter < ResumeArrayFormatter
16
16
  private
17
17
 
18
18
  def process_cases
19
+ max = @data[:config][:tt_moodle_max_score] || 100.0
20
+ grade_adjust = max.to_f / 100.0
19
21
  # MoodleID, Grade, Feedback
20
22
  w "MoodleID, TeutonGrade, TeutonFeedback\n"
21
23
  @data[:cases].each do |line|
22
24
  moodle_id = line[:moodle_id]
23
25
  moodle_id = line[:moodle_id].split(",") if moodle_id.instance_of? String
24
26
  moodle_id.each do |id|
25
- w "#{id.strip},#{line[:grade]},#{line[:moodle_feedback]}\n" unless line[:skip]
27
+ unless line[:skip]
28
+ grade = line[:grade].to_f * grade_adjust
29
+ w "#{id.strip},#{grade},#{line[:moodle_feedback]}\n"
30
+ end
26
31
  end
27
32
  end
28
33
  end
@@ -1,5 +1,5 @@
1
1
  module Teuton
2
- VERSION = "2.4.4"
2
+ VERSION = "2.5.0"
3
3
  APPNAME = "teuton"
4
4
  GEMNAME = "teuton"
5
5
  DOCKERNAME = "dvarrui/#{GEMNAME}"
data/lib/teuton.rb CHANGED
@@ -27,13 +27,11 @@ module Teuton
27
27
 
28
28
  app = Application.instance
29
29
  lab = Laboratory.new(app.script_path, app.config_path)
30
- if options[:panelconfig]
31
- lab.show_panelconfig
30
+ if options[:onlyconfig]
31
+ lab.show_onlyconfig
32
32
  else
33
33
  lab.show
34
34
  end
35
- puts Rainbow("Check OK!").green
36
- exit 0
37
35
  end
38
36
 
39
37
  private_class_method def self.require_dsl_and_script(dslpath)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teuton
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.4
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Vargas Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-23 00:00:00.000000000 Z
11
+ date: 2023-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow
@@ -131,6 +131,7 @@ extra_rdoc_files:
131
131
  - docs/changelog/v2.2.md
132
132
  - docs/changelog/v2.3.md
133
133
  - docs/changelog/v2.4.md
134
+ - docs/changelog/v2.5.md
134
135
  - docs/changelog/version2.1.md
135
136
  - docs/commands/README.md
136
137
  - docs/commands/example_check.md
@@ -197,6 +198,7 @@ files:
197
198
  - docs/changelog/v2.2.md
198
199
  - docs/changelog/v2.3.md
199
200
  - docs/changelog/v2.4.md
201
+ - docs/changelog/v2.5.md
200
202
  - docs/changelog/version2.1.md
201
203
  - docs/commands/README.md
202
204
  - docs/commands/example_check.md