teuton 2.9.5 → 2.10.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 +3 -3
- data/docs/commands/README.md +28 -83
- data/docs/commands/{example_check.md → check-example.md} +2 -6
- data/docs/commands/{example_run.md → howto-run-tests.md} +16 -10
- data/docs/install/README.md +10 -6
- data/docs/install/s-node.md +3 -3
- data/docs/install/t-node.md +75 -6
- data/docs/learn/13-feedback.md +8 -7
- data/lib/teuton/case/case.rb +5 -9
- data/lib/teuton/case/dsl/expect_sequence.rb +2 -2
- data/lib/teuton/case/dsl/send.rb +13 -8
- data/lib/teuton/case_manager/case_manager.rb +1 -0
- data/lib/teuton/case_manager/dsl.rb +24 -17
- data/lib/teuton/case_manager/export_manager.rb +13 -7
- data/lib/teuton/case_manager/report.rb +1 -1
- data/lib/teuton/case_manager/send_manager.rb +22 -6
- data/lib/teuton/case_manager/show_report.rb +0 -1
- data/lib/teuton/readme/readme.rb +1 -0
- data/lib/teuton/report/formatter/formatter.rb +1 -0
- data/lib/teuton/report/report.rb +1 -5
- data/lib/teuton/utils/project.rb +4 -4
- data/lib/teuton/version.rb +1 -1
- metadata +38 -24
- data/docs/changelog/changelog.1.md +0 -119
- data/docs/changelog/changelog.2.md +0 -128
- data/docs/changelog/todo.md +0 -16
- data/docs/install/manual.md +0 -41
- data/docs/install/vagrant_docker.md +0 -56
- data/lib/teuton/deprecated/application.rb +0 -80
- data/lib/teuton/deprecated/application_test.rb +0 -32
- data/lib/teuton/deprecated/runner.rb +0 -190
- data/lib/teuton/deprecated/utils.rb +0 -40
- /data/docs/{diagram.md → devel/diagram.md} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7936417ce11de28acf3bddee94dcf41b4848742eae8266cce8bf70792ff4e592
|
|
4
|
+
data.tar.gz: bf8175c24a48e80c6257ab90898b52421157a471010ac1e730b3926962394ef9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5a042452b9f025520bce19c4254e799ae9c51e5195804bc8a7d132c63d9271e7de3f03a9c14cb85b799635174a20cddc8a002bd43c565e91395d474059f82d1e
|
|
7
|
+
data.tar.gz: dd3051109b8b756709e34343bed5301140b33368f4fc3efed751f805960db29495ca9b84bfcaf36251715215a649e53be350cb4cee88e294d74285676a77e837
|
data/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://badge.fury.io/rb/teuton)
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
_Test your infrastructure as code._
|
|
8
8
|
|
|
9
9
|

|
|
10
10
|
|
|
@@ -25,7 +25,7 @@ gem install teuton
|
|
|
25
25
|
|
|
26
26
|
# Usage
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
Use `teuton run TESTPATH` command to run test:
|
|
29
29
|
|
|
30
30
|
```console
|
|
31
31
|
> teuton run examples/01-target
|
|
@@ -41,7 +41,7 @@ CASE RESULTS
|
|
|
41
41
|
|
|
42
42
|
# Features
|
|
43
43
|
|
|
44
|
-
*
|
|
44
|
+
* Use simple DSL to define your tests: `target`, `run`,`expect` and more.
|
|
45
45
|
* Remote devices only require SSH or Telnet service installed.
|
|
46
46
|
* Output format: txt, html, json, yaml, etc.
|
|
47
47
|
* Multiplatform.
|
data/docs/commands/README.md
CHANGED
|
@@ -6,66 +6,38 @@ Available command functions:
|
|
|
6
6
|
1. [Show help](#1-show-help)
|
|
7
7
|
2. [Show version](#2-show-version)
|
|
8
8
|
3. [Create new test](#3-create-new-test)
|
|
9
|
-
4. [Check
|
|
10
|
-
5. [Run
|
|
9
|
+
4. [Check test](#4-check-test)
|
|
10
|
+
5. [Run test](#5-run-test)
|
|
11
|
+
6. [Show test info as README file](#6-show-test-info-as-readme-file)
|
|
11
12
|
|
|
12
13
|
# 1. Show help
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
teuton
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Example:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
> teuton
|
|
22
|
-
Commands:
|
|
23
|
-
teuton [run] [OPTIONS] DIRECTORY # Run challenge from directory
|
|
24
|
-
teuton check [OPTIONS] DIRECTORY # Test or check challenge contents
|
|
25
|
-
teuton help [COMMAND] # Describe available commands or one specific command
|
|
26
|
-
teuton new DIRECTORY # Create skeleton for a new project
|
|
27
|
-
teuton readme DIRECTORY # Create README.md file from challenge contents
|
|
28
|
-
teuton version # Show the program version
|
|
29
|
-
|
|
30
|
-
```
|
|
15
|
+
Show help about command functions.
|
|
31
16
|
|
|
32
|
-
|
|
17
|
+
Usage:
|
|
18
|
+
* `teuton help`
|
|
19
|
+
* `teuton help FUNCTION_NAME`
|
|
33
20
|
|
|
34
|
-
|
|
35
|
-
* `teuton -h`
|
|
36
|
-
* `teuton --help`
|
|
21
|
+
Alias: `teuton h`,`teuton -h`, `teuton --help`
|
|
37
22
|
|
|
38
23
|
# 2. Show version
|
|
39
24
|
|
|
40
|
-
|
|
41
|
-
teuton version
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Example:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
$ teuton version
|
|
48
|
-
teuton (version 2.2.0)
|
|
49
|
-
```
|
|
25
|
+
Show current version.
|
|
50
26
|
|
|
51
|
-
|
|
27
|
+
Usage: `teuton version`
|
|
52
28
|
|
|
53
|
-
|
|
54
|
-
* `teuton -v`
|
|
55
|
-
* `teuton --version`
|
|
29
|
+
Alias: `teuton v`, `teuton -v`, `teuton --version`
|
|
56
30
|
|
|
57
31
|
# 3. Create new test
|
|
58
32
|
|
|
59
|
-
Create
|
|
33
|
+
Create test skeleton.
|
|
60
34
|
|
|
61
|
-
|
|
62
|
-
teuton new foo
|
|
63
|
-
```
|
|
35
|
+
Usage: `teuton new foo`
|
|
64
36
|
|
|
65
37
|
Example:
|
|
66
38
|
|
|
67
39
|
```console
|
|
68
|
-
|
|
40
|
+
$ teuton new foo
|
|
69
41
|
|
|
70
42
|
[INFO] Creating foo project skeleton
|
|
71
43
|
* Create dir => foo
|
|
@@ -78,24 +50,18 @@ This command will create the next structure:
|
|
|
78
50
|
| File/Directory | Description |
|
|
79
51
|
| --------------- | -------------- |
|
|
80
52
|
| foo | Base directory |
|
|
81
|
-
| foo/start.rb | Main
|
|
53
|
+
| foo/start.rb | Main file with test definitions |
|
|
82
54
|
| foo/config.yaml | YAML configuration file |
|
|
83
55
|
|
|
84
|
-
Alias:
|
|
85
|
-
|
|
86
|
-
* `teuton n foo`
|
|
87
|
-
* `teuton -n foo`
|
|
88
|
-
* `teuton --new foo`
|
|
56
|
+
Alias: `teuton n foo`, `teuton -n foo`, `teuton --new foo`
|
|
89
57
|
|
|
90
|
-
# 4. Check
|
|
58
|
+
# 4. Check test
|
|
91
59
|
|
|
92
|
-
|
|
93
|
-
teuton check DIRPATH
|
|
94
|
-
```
|
|
60
|
+
Check test and config files from DIRPATH folder.
|
|
95
61
|
|
|
96
|
-
|
|
62
|
+
Usage: `teuton check DIRPATH`
|
|
97
63
|
|
|
98
|
-
[Example](
|
|
64
|
+
[Example](check-example.md)
|
|
99
65
|
|
|
100
66
|
| Command | Description |
|
|
101
67
|
| ---------------------------- | ----------- |
|
|
@@ -104,39 +70,18 @@ Description: this command check teuton test and config files located into DIRPAT
|
|
|
104
70
|
| teuton check path/to/file/foo.rb | Test content of foo.rb and foo.yaml files. |
|
|
105
71
|
| teuton check path/to/file/foo.rb --cname=demo | Test content of foo.rb and demo.yaml files.|
|
|
106
72
|
|
|
107
|
-
Alias:
|
|
108
|
-
|
|
109
|
-
* `teuton c foo`
|
|
110
|
-
* `teuton -c foo`
|
|
111
|
-
* `teuton --check foo`
|
|
73
|
+
Alias: `teuton c foo`, `teuton -c foo`, `teuton --check foo`
|
|
112
74
|
|
|
113
|
-
# 5. Run
|
|
75
|
+
# 5. Run test
|
|
114
76
|
|
|
115
|
-
|
|
116
|
-
teuton run DIRPATH
|
|
117
|
-
```
|
|
77
|
+
Read about [how to run tests](howto-run-tests.md)
|
|
118
78
|
|
|
119
|
-
|
|
79
|
+
# 6. Show test info as README file
|
|
120
80
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
Alias:
|
|
124
|
-
|
|
125
|
-
* `teuton foo`
|
|
126
|
-
|
|
127
|
-
# 6. Show README
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
teuton readme DIRPATH
|
|
131
|
-
```
|
|
81
|
+
Create a readme file for the exercise.
|
|
132
82
|
|
|
133
|
-
|
|
134
|
-
what kind of problem/exercise it is going to be evaluated. The students need this
|
|
135
|
-
information to resolv the problem/exercise into their machines.
|
|
83
|
+
Usage: `teuton readme DIRPATH > README.md`
|
|
136
84
|
|
|
137
|
-
|
|
85
|
+
This function reads test and config files, and generate Markdown output with guidelines and target descriptions about the exercise.
|
|
138
86
|
|
|
139
|
-
Alias:
|
|
140
|
-
* `teuton r DIRPATH`
|
|
141
|
-
* `teuton -r DIRPATH`
|
|
142
|
-
* `teuton --readme DIRPATH`
|
|
87
|
+
Alias: `teuton r DIRPATH`, `teuton -r DIRPATH`, `teuton --readme DIRPATH`
|
|
@@ -9,16 +9,12 @@
|
|
|
9
9
|
| --cpath | Specify path to config file | TEST-FOLDER/config.yaml |
|
|
10
10
|
| --cname | Specify name to config file | config.yaml |
|
|
11
11
|
|
|
12
|
-
Usage:
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
teuton check PATH-TO-TEST-FOLDER
|
|
16
|
-
```
|
|
12
|
+
Usage: `teuton check PATH-TO-TEST-FOLDER`
|
|
17
13
|
|
|
18
14
|
Example:
|
|
19
15
|
|
|
20
16
|
```bash
|
|
21
|
-
|
|
17
|
+
$ teuton check examples/02-target
|
|
22
18
|
|
|
23
19
|
+----------------------------+
|
|
24
20
|
| GROUP: Learn about targets |
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
|
|
2
2
|
[<< back](README.md)
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
# Run test
|
|
5
|
+
|
|
6
|
+
Run test located into DIRPATH folder.
|
|
7
|
+
|
|
8
|
+
Usage: `teuton run DIRPATH`
|
|
9
|
+
|
|
10
|
+
Alias: `teuton foo`
|
|
11
|
+
|
|
12
|
+
1. [Example](#1-example)
|
|
13
|
+
2. [Options](#2-options)
|
|
6
14
|
3. [Choosing config file](#3-choosing-config-file)
|
|
7
15
|
|
|
8
|
-
# 1.
|
|
16
|
+
# 1. Example
|
|
9
17
|
|
|
10
18
|
Running Teuton test located into `example/01-target` folder.
|
|
11
19
|
|
|
12
20
|
```bash
|
|
13
|
-
teuton run example/01-target
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
Example:
|
|
21
|
+
$ teuton run example/01-target
|
|
17
22
|
|
|
18
|
-
```bash
|
|
19
23
|
------------------------------------
|
|
20
24
|
Started at 2023-01-21 13:32:24 +0000
|
|
21
25
|
F
|
|
@@ -29,10 +33,12 @@ CASE RESULTS
|
|
|
29
33
|
+------+-----------+-------+-------+
|
|
30
34
|
```
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
> Output files are saved into `var/01-target` folder.
|
|
37
|
+
|
|
38
|
+
# 2. Options
|
|
33
39
|
|
|
34
40
|
```
|
|
35
|
-
|
|
41
|
+
$ teuton help run
|
|
36
42
|
|
|
37
43
|
Usage:
|
|
38
44
|
teuton [run] [OPTIONS] DIRECTORY
|
data/docs/install/README.md
CHANGED
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
# Installation
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Teuton installation**
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
| **S-node** | [SSH server installation](s-node.md) | S-NODE hosts are monitorized by T-NODE host |
|
|
7
|
+
We call a device with Teuton installed as t-node. [T-NODE](t-node.md) host monitors one or severals S-NODE hosts.
|
|
8
|
+
1. Install Ruby on your system.
|
|
9
|
+
2. `gem install teuton`
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
**SSH server installation**
|
|
12
|
+
|
|
13
|
+
We call e device with SSH/Telnet service as s-node. [S-NODE](s-node.md) hosts are monitorized by T-NODE host.
|
|
14
|
+
1. Install SSH service.
|
|
15
|
+
|
|
16
|
+
Read [modes of use](modes_of_use.md) to know more about differents T-NODE/S-NODE schemes.
|
|
13
17
|
|
|
14
18
|
## Tested OS list
|
|
15
19
|
|
data/docs/install/s-node.md
CHANGED
|
@@ -6,7 +6,7 @@ Install SSH server on every machine with S-NODE role.
|
|
|
6
6
|
|
|
7
7
|
**S-node**: Host where SSH server is installed. This hosts are monitorized by T-NODE host.
|
|
8
8
|
|
|
9
|
-
**
|
|
9
|
+
**GNU/Linux installation**
|
|
10
10
|
|
|
11
11
|
Run this command as `root` user:
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ Run this command as `root` user:
|
|
|
14
14
|
wget -qO- https://raw.githubusercontent.com/teuton-software/teuton/master/install/linux/s-node_install.sh | bash
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
**
|
|
17
|
+
**Windows installation**
|
|
18
18
|
|
|
19
19
|
Requirements:
|
|
20
20
|
* Windows 7+ / Windows Server 2003+
|
|
@@ -26,7 +26,7 @@ Run this command on **PowerShell (PS)** as `Administrator` user:
|
|
|
26
26
|
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/teuton-software/teuton/master/install/windows/s-node_install.ps1'))
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
**
|
|
29
|
+
**Mac OS X installation**
|
|
30
30
|
|
|
31
31
|
Run this command as `root` user:
|
|
32
32
|
|
data/docs/install/t-node.md
CHANGED
|
@@ -30,7 +30,7 @@ Option B:
|
|
|
30
30
|
|
|
31
31
|
If you don't know how to install Ruby on your system, execute this script to run automatical installation for your OS.
|
|
32
32
|
|
|
33
|
-
**
|
|
33
|
+
**GNU/Linux installation**
|
|
34
34
|
|
|
35
35
|
Run this command as `root` user:
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ Run this command as `root` user:
|
|
|
38
38
|
wget -qO- https://raw.githubusercontent.com/teuton-software/teuton/master/install/linux/t-node_install.sh | bash
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
**
|
|
41
|
+
**Windows installation**
|
|
42
42
|
|
|
43
43
|
Requirements:
|
|
44
44
|
* Windows 7+ / Windows Server 2003+
|
|
@@ -50,7 +50,7 @@ Run this command on **PowerShell (PS)** as `Administrator` user:
|
|
|
50
50
|
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/teuton-software/teuton/master/install/windows/t-node_install.ps1'))
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
**
|
|
53
|
+
**Mac OS X installation**
|
|
54
54
|
|
|
55
55
|
Run this command as admin user (member of `admin` group):
|
|
56
56
|
|
|
@@ -58,14 +58,83 @@ Run this command as admin user (member of `admin` group):
|
|
|
58
58
|
curl -sL https://raw.githubusercontent.com/teuton-software/teuton/master/install/mac/t-node_install.sh | bash
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
# 4. Vagrant
|
|
61
|
+
# 4. Vagrant and Docker installation
|
|
62
62
|
|
|
63
63
|
Choose this way if you plan to install Teuton into virtual machines or containers, and you are familiar with Vagrant and Docker technologies.
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
## 4.1 Install using Vagrant
|
|
66
|
+
|
|
67
|
+
* First, install `Vagrant` and `VirtualBox` on your host.
|
|
68
|
+
* Create directory for vagrant project. For example, `mkdir teuton-vagrant`.
|
|
69
|
+
* Move into that directory: `cd teuton-vagrant`.
|
|
70
|
+
* Choose and download [Vagrantfile](../../install/vagrant).
|
|
71
|
+
* Run `vagrant up` to create your Virtual Machine.
|
|
72
|
+
|
|
73
|
+
## 4.2 Install using Docker
|
|
74
|
+
|
|
75
|
+
First:
|
|
76
|
+
* Install `docker` on your host.
|
|
77
|
+
|
|
78
|
+
Second, choose:
|
|
79
|
+
* Pulling docker image from remote or
|
|
80
|
+
* Rebuild local docker image.
|
|
81
|
+
|
|
82
|
+
## 4.2 Pulling docker images from remote
|
|
83
|
+
|
|
84
|
+
Run this command to pull **dvarrui/teuton** image from Docker Hub and create "teuton" container:
|
|
85
|
+
|
|
86
|
+
`docker run --name teuton -v /home/teuton -i -t dvarrui/teuton /bin/bash`
|
|
87
|
+
|
|
88
|
+
## 4.2 Rebuild local docker image
|
|
89
|
+
|
|
90
|
+
1. Create Dockerfile like this:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
FROM debian:latest
|
|
94
|
+
|
|
95
|
+
MAINTAINER teuton 2.1
|
|
96
|
+
|
|
97
|
+
RUN apt-get update
|
|
98
|
+
RUN apt-get install -y apt-utils
|
|
99
|
+
RUN apt-get install -y vim tree
|
|
100
|
+
RUN apt-get install -y ruby
|
|
101
|
+
RUN gem install teuton
|
|
102
|
+
RUN mkdir /home/teuton
|
|
103
|
+
|
|
104
|
+
EXPOSE 80
|
|
105
|
+
|
|
106
|
+
WORKDIR /home/teuton
|
|
107
|
+
CMD ["/bin/bash"]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
1. Build local docker image **dvarrui/teuton** with `docker build -t dvarrui/teuton .`
|
|
111
|
+
1. Create **teuton** container with `docker run --name teuton -v /home/teuton -i -t dvarrui/teuton /bin/bash`.
|
|
112
|
+
|
|
113
|
+
> Notice `/home/teuton` folder is persistent volume.
|
|
66
114
|
|
|
67
115
|
# 5. Source code
|
|
68
116
|
|
|
69
117
|
If you want to install Teuton by your own, or there are not installation scripts for your OS, and you don't want to use Vagrant then... here you have information how to install all the required packages for Teuton.
|
|
70
118
|
|
|
71
|
-
|
|
119
|
+
Manual installation:
|
|
120
|
+
1. Git installation
|
|
121
|
+
* Install Git.
|
|
122
|
+
* Run `git --version` to show current version
|
|
123
|
+
1. Ruby installation
|
|
124
|
+
* Install ruby.
|
|
125
|
+
* Run `ruby -v` to show current version (2.1.3p242+)
|
|
126
|
+
1. Rake installation
|
|
127
|
+
* Run `gem install rake`, then
|
|
128
|
+
* `rake --version` to show current version (10.4.2+).
|
|
129
|
+
1. Download this project
|
|
130
|
+
* (a) `git clone https://github.com/dvarrui/teuton.git` or
|
|
131
|
+
* (b) Download and unzip [file](https://github.com/dvarrui/teuton-panel/archive/master.zip).
|
|
132
|
+
1. Move into Teuton folder
|
|
133
|
+
* Run `cd teuton`
|
|
134
|
+
1. Gems installation.
|
|
135
|
+
* `rake install:gems`, to install required gems.
|
|
136
|
+
1. Only for developers
|
|
137
|
+
* Run `rake install:debian` or
|
|
138
|
+
* `rake install:opensuse`, install gem for developers.
|
|
139
|
+
1. Final check
|
|
140
|
+
* `rake`
|
data/docs/learn/13-feedback.md
CHANGED
|
@@ -37,12 +37,13 @@ Executing `teuton run examples/13-feedback`, we get this output:
|
|
|
37
37
|
|
|
38
38
|
```
|
|
39
39
|
GROUPS
|
|
40
|
-
-
|
|
40
|
+
- Hide feedback messages from output
|
|
41
41
|
01 (1.0/1.0)
|
|
42
|
-
Description :
|
|
43
|
-
Command :
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
Description : Service SSH disabled
|
|
43
|
+
Command : *********************
|
|
44
|
+
Output : *********
|
|
45
|
+
Duration : 0.011 (local)
|
|
46
|
+
Alterations : **********************
|
|
47
|
+
Expected : **************
|
|
48
|
+
Result : ********
|
|
48
49
|
```
|
data/lib/teuton/case/case.rb
CHANGED
|
@@ -15,15 +15,11 @@ class Case
|
|
|
15
15
|
include DSL
|
|
16
16
|
include Verbose
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
attr_accessor :result
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
attr_reader :id
|
|
24
|
-
attr_reader :config # Readed by ExecuteManager
|
|
25
|
-
attr_reader :uniques
|
|
26
|
-
attr_reader :skip
|
|
18
|
+
# Updated by ExecuteManager
|
|
19
|
+
attr_accessor :action, :result, :sessions, :conn_status
|
|
20
|
+
# Readed by ExecuteManager
|
|
21
|
+
attr_reader :id, :config, :uniques, :skip
|
|
22
|
+
|
|
27
23
|
@@id = "01" # First case ID value
|
|
28
24
|
|
|
29
25
|
def initialize(config)
|
|
@@ -38,8 +38,8 @@ class ExpectSequence
|
|
|
38
38
|
|
|
39
39
|
def find_best_state
|
|
40
40
|
@states.each do |state|
|
|
41
|
-
state[:score] =
|
|
42
|
-
state[:fails] =
|
|
41
|
+
state[:score] = state[:steps].select { it }.size
|
|
42
|
+
state[:fails] = state[:steps].select { !it }.size
|
|
43
43
|
state[:ok] = (state[:fails] == 0)
|
|
44
44
|
end
|
|
45
45
|
best = @states[0]
|
data/lib/teuton/case/dsl/send.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module DSL
|
|
4
4
|
# * send, tempfile, tempdir, remote_tempdir, remote_tempfile
|
|
5
|
-
def send(args = {})
|
|
5
|
+
def send(logfile, args = {})
|
|
6
6
|
return if skip?
|
|
7
7
|
|
|
8
8
|
return unless args[:copy_to]
|
|
@@ -10,10 +10,10 @@ module DSL
|
|
|
10
10
|
host = args[:copy_to].to_s
|
|
11
11
|
return unless @conn_status[host].nil?
|
|
12
12
|
|
|
13
|
-
ip = get(
|
|
14
|
-
username = get(
|
|
15
|
-
password = get(
|
|
16
|
-
port = get(
|
|
13
|
+
ip = get(:"#{host}_ip")
|
|
14
|
+
username = get(:"#{host}_username").to_s
|
|
15
|
+
password = get(:"#{host}_password").to_s
|
|
16
|
+
port = get(:"#{host}_port").to_i
|
|
17
17
|
port = 22 if port.zero?
|
|
18
18
|
|
|
19
19
|
filename = "#{@report.filename}.#{@report.format}"
|
|
@@ -32,11 +32,16 @@ module DSL
|
|
|
32
32
|
Net::SFTP.start(ip, username, password: password, port: port) do |sftp|
|
|
33
33
|
sftp.upload!(localfilepath, remotefilepath)
|
|
34
34
|
end
|
|
35
|
-
msg = Rainbow("==> Case #{get(:tt_members)}: report (#{remotefilepath}) copy to (#{ip})").green
|
|
35
|
+
msg = Rainbow("==> [ OK ] Case #{get(:tt_members)}: report (#{remotefilepath}) copy to (#{ip})").green
|
|
36
36
|
verboseln(msg)
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
logfile.write "#{msg}\n"
|
|
38
|
+
logfile.flush
|
|
39
|
+
rescue => e
|
|
40
|
+
msg = Rainbow("==> [FAIL] Case #{get(:tt_members)}: 'scp #{localfilepath}' to #{remotefilepath}").red
|
|
41
|
+
msg += "\n--> [ERROR] #{e}"
|
|
39
42
|
verboseln(msg)
|
|
43
|
+
logfile.write "#{msg}\n"
|
|
44
|
+
logfile.flush
|
|
40
45
|
end
|
|
41
46
|
end
|
|
42
47
|
|
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
require_relative "../utils/project"
|
|
2
2
|
require_relative "case_manager"
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
begin
|
|
11
|
-
require_relative findfiles.first
|
|
12
|
-
Project.value[:uses] << File.basename(findfiles.first)
|
|
13
|
-
rescue
|
|
14
|
-
puts "[ERROR] Unknown file : #{filename}"
|
|
15
|
-
puts " Check line : use '#{filename}'"
|
|
16
|
-
exit 1
|
|
17
|
-
end
|
|
18
|
-
end
|
|
4
|
+
# DSL instructions that apply equally to all cases.
|
|
5
|
+
# Therefore, they are stored globally in the case manager.
|
|
6
|
+
# * define_macro
|
|
7
|
+
# * group
|
|
8
|
+
# * play
|
|
9
|
+
# * use
|
|
19
10
|
|
|
20
11
|
def define_macro(name, *args, &block)
|
|
21
|
-
Project.value[:macros][name] = {args: args, block: block}
|
|
12
|
+
Project.value[:macros][name] = { args: args, block: block }
|
|
22
13
|
end
|
|
23
14
|
alias def_macro define_macro
|
|
24
15
|
alias defmacro define_macro
|
|
@@ -27,7 +18,7 @@ alias defmacro define_macro
|
|
|
27
18
|
# @param name (String) Group name
|
|
28
19
|
# @param block (Block) Tests code
|
|
29
20
|
def group(name, &block)
|
|
30
|
-
Project.value[:groups] << {name: name, block: block}
|
|
21
|
+
Project.value[:groups] << { name: name, block: block }
|
|
31
22
|
end
|
|
32
23
|
alias task group
|
|
33
24
|
|
|
@@ -36,3 +27,19 @@ def play(&block)
|
|
|
36
27
|
CaseManager.new.play(&block)
|
|
37
28
|
end
|
|
38
29
|
alias start play
|
|
30
|
+
|
|
31
|
+
def use(filename)
|
|
32
|
+
filename += ".rb"
|
|
33
|
+
rbfiles = File.join(Project.value[:project_path], "**", filename)
|
|
34
|
+
files = Dir.glob(rbfiles)
|
|
35
|
+
findfiles = []
|
|
36
|
+
files.sort.each { |f| findfiles << f if f.include?(filename) }
|
|
37
|
+
begin
|
|
38
|
+
require_relative findfiles.first
|
|
39
|
+
Project.value[:uses] << File.basename(findfiles.first)
|
|
40
|
+
rescue StandardError
|
|
41
|
+
puts "[ERROR] Unknown file : #{filename}"
|
|
42
|
+
puts " Check line : use '#{filename}'"
|
|
43
|
+
exit 1
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "rainbow"
|
|
4
|
+
require_relative "../utils/project"
|
|
4
5
|
|
|
5
6
|
##
|
|
6
7
|
# Execute "export" order: Export every case report
|
|
@@ -21,9 +22,7 @@ class ExportManager
|
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
options = strings2symbols(args)
|
|
24
|
-
if options[:format].nil?
|
|
25
|
-
options[:format] = default_format
|
|
26
|
-
end
|
|
25
|
+
options[:format] = default_format if options[:format].nil?
|
|
27
26
|
|
|
28
27
|
# Step 1: Export case reports
|
|
29
28
|
threads = []
|
|
@@ -57,13 +56,20 @@ class ExportManager
|
|
|
57
56
|
##
|
|
58
57
|
# Preserve output files for current project execution
|
|
59
58
|
def preserve_files
|
|
60
|
-
|
|
59
|
+
srcdir = File.join(
|
|
60
|
+
Project.value[:output_basedir],
|
|
61
|
+
Project.value[:test_name]
|
|
62
|
+
)
|
|
63
|
+
|
|
61
64
|
t = Time.now
|
|
62
|
-
data = {
|
|
65
|
+
data = {
|
|
66
|
+
year: t.year, month: t.month, day: t.day,
|
|
67
|
+
hour: t.hour, min: t.min, sec: t.sec
|
|
68
|
+
}
|
|
63
69
|
subdir = format("%<year>s%<month>02d%<day>02d-" \
|
|
64
70
|
"%<hour>02d%<min>02d%<sec>02d", data)
|
|
65
|
-
logdir = File.join(
|
|
66
|
-
|
|
71
|
+
logdir = File.join(srcdir, subdir)
|
|
72
|
+
|
|
67
73
|
puts "[INFO] Preserving files => #{logdir}"
|
|
68
74
|
FileUtils.mkdir(logdir)
|
|
69
75
|
Dir.glob(File.join(srcdir, "**.*")).each { |file| FileUtils.cp(file, logdir) }
|
|
@@ -26,7 +26,7 @@ class CaseManager
|
|
|
26
26
|
@report.tail[:finish_time] = finish_time
|
|
27
27
|
@report.tail[:duration] = finish_time - start_time
|
|
28
28
|
|
|
29
|
-
duration = format("%3.3f",
|
|
29
|
+
duration = format("%3.3f", finish_time - start_time)
|
|
30
30
|
verboseln Rainbow("\nFinished in #{duration} seconds").green
|
|
31
31
|
verboseln Rainbow("-" * 36).green
|
|
32
32
|
verboseln " "
|