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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ce9e5fc4e8a37ff624e2c8dc16440236aed569cf1c6b77a49e9efbb6f2b1894
4
- data.tar.gz: e2959aef5f909f245c27bf18868ffb7cfd0e7dee376da8f9620b1306f0d8b383
3
+ metadata.gz: 7936417ce11de28acf3bddee94dcf41b4848742eae8266cce8bf70792ff4e592
4
+ data.tar.gz: bf8175c24a48e80c6257ab90898b52421157a471010ac1e730b3926962394ef9
5
5
  SHA512:
6
- metadata.gz: 60567daad6f01a946b227f5eba0c63813bcb9e2d1f466e3d0fbf5407e7e3d1efa120036df6cc29f4e63f627b0e638d3334f34f0182558fb20d66d35bedf113de
7
- data.tar.gz: ed5569263c61fa81b42c4764793fe4e917d4395c115b2f95c4456813c62b5e0d86e02a68e79354babc9e2bc471678d6566c032e475bd1944563817163b65ee54
6
+ metadata.gz: 5a042452b9f025520bce19c4254e799ae9c51e5195804bc8a7d132c63d9271e7de3f03a9c14cb85b799635174a20cddc8a002bd43c565e91395d474059f82d1e
7
+ data.tar.gz: dd3051109b8b756709e34343bed5301140b33368f4fc3efed751f805960db29495ca9b84bfcaf36251715215a649e53be350cb4cee88e294d74285676a77e837
data/README.md CHANGED
@@ -4,7 +4,7 @@
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
6
 
7
- _Create Unit Test for your machines. Test your infrastructure as code._
7
+ _Test your infrastructure as code._
8
8
 
9
9
  ![logo](./docs/images/logo.png)
10
10
 
@@ -25,7 +25,7 @@ gem install teuton
25
25
 
26
26
  # Usage
27
27
 
28
- Executing `teuton` command to run example test:
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
- * Simple DSL to define your tests: `target`, `run`,`expect` and more.
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.
@@ -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 teuton test](#4-check-teuton-test)
10
- 5. [Run teuton test](#5-run-teuton-test)
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
- ```bash
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
- Alias:
17
+ Usage:
18
+ * `teuton help`
19
+ * `teuton help FUNCTION_NAME`
33
20
 
34
- * `teuton h`
35
- * `teuton -h`
36
- * `teuton --help`
21
+ Alias: `teuton h`,`teuton -h`, `teuton --help`
37
22
 
38
23
  # 2. Show version
39
24
 
40
- ```bash
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
- Alias:
27
+ Usage: `teuton version`
52
28
 
53
- * `teuton v`
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 teuton test skeleton.
33
+ Create test skeleton.
60
34
 
61
- ```bash
62
- teuton new foo
63
- ```
35
+ Usage: `teuton new foo`
64
36
 
65
37
  Example:
66
38
 
67
39
  ```console
68
- > teuton new foo
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 Script |
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 teuton test
58
+ # 4. Check test
91
59
 
92
- ```console
93
- teuton check DIRPATH
94
- ```
60
+ Check test and config files from DIRPATH folder.
95
61
 
96
- Description: this command check teuton test and config files located into DIRPATH folder.
62
+ Usage: `teuton check DIRPATH`
97
63
 
98
- [Example](example_check.md)
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 teuton test
75
+ # 5. Run test
114
76
 
115
- ```bash
116
- teuton run DIRPATH
117
- ```
77
+ Read about [how to run tests](howto-run-tests.md)
118
78
 
119
- Description: this command run teuton test located into DIRPATH folder.
79
+ # 6. Show test info as README file
120
80
 
121
- [Example](example_run.md)
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
- Read test and config files content, and display information about
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
- The teacher could write this information or may use this command to generate automaticaly.
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
- teuton check examples/02-target
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
- 1. [Run test](#1-run-test)
5
- 2. [Command options](#2-command-options)
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. Run test
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
- # 2. Command options
36
+ > Output files are saved into `var/01-target` folder.
37
+
38
+ # 2. Options
33
39
 
34
40
  ```
35
- > teuton help run
41
+ $ teuton help run
36
42
 
37
43
  Usage:
38
44
  teuton [run] [OPTIONS] DIRECTORY
@@ -2,14 +2,18 @@
2
2
 
3
3
  # Installation
4
4
 
5
- There are 2 types of nodes (hosts), so there are 2 installations:
5
+ **Teuton installation**
6
6
 
7
- | ID | Software | Description |
8
- | -- | -------- | ----------- |
9
- | **T-node** | [Teuton installation](t-node.md) | T-NODE host monitors one or severals S-NODE hosts |
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
- > Read [modes of use](modes_of_use.md) to know more about differents T-NODE/S-NODE schemes.
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
 
@@ -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
- **S-node GNU/Linux installation**
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
- **S-node Windows installation**
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
- **S-node Mac OS X installation**
29
+ **Mac OS X installation**
30
30
 
31
31
  Run this command as `root` user:
32
32
 
@@ -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
- **T-node GNU/Linux installation**
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
- **T-node Windows installation**
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
- **T-node Mac OS X installation**
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/Docker
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
- [Installation using Vagrant or Docker](vagrant_docker.md)
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
- [Manual installation](manual.md)
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`
@@ -37,12 +37,13 @@ Executing `teuton run examples/13-feedback`, we get this output:
37
37
 
38
38
  ```
39
39
  GROUPS
40
- - Preserve output reports
40
+ - Hide feedback messages from output
41
41
  01 (1.0/1.0)
42
- Description : Exits user Obiwan
43
- Command : ********
44
- Duration : 0.002 (local)
45
- Alterations : *******************
46
- Expected : ************** (String)
47
- Result : ******** (String)
42
+ Description : Service SSH disabled
43
+ Command : *********************
44
+ Output : *********
45
+ Duration : 0.011 (local)
46
+ Alterations : **********************
47
+ Expected : **************
48
+ Result : ********
48
49
  ```
@@ -15,15 +15,11 @@ class Case
15
15
  include DSL
16
16
  include Verbose
17
17
 
18
- attr_accessor :action # Updated by ExecuteManager
19
- attr_accessor :result # Updated by ExecuteManager
20
- attr_accessor :sessions # Updated by ExecuteManager
21
- attr_accessor :conn_status # Updated by ExecuteManager
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] = (state[:steps].select { it }).size
42
- state[:fails] = (state[:steps].select { !it }).size
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]
@@ -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((host + "_ip").to_sym)
14
- username = get((host + "_username").to_sym).to_s
15
- password = get((host + "_password").to_sym).to_s
16
- port = get((host + "_port").to_sym).to_i
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
- rescue
38
- msg = Rainbow("==> [FAIL] #{get(:tt_members)}: 'scp #{localfilepath}' to #{remotefilepath}").red
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
 
@@ -20,6 +20,7 @@ require_relative "utils"
20
20
  class CaseManager
21
21
  include Utils
22
22
  include Verbose
23
+
23
24
  attr_reader :report, :cases
24
25
 
25
26
  def initialize
@@ -1,24 +1,15 @@
1
1
  require_relative "../utils/project"
2
2
  require_relative "case_manager"
3
3
 
4
- def use(filename)
5
- filename += ".rb"
6
- rbfiles = File.join(Project.value[:project_path], "**", filename)
7
- files = Dir.glob(rbfiles)
8
- findfiles = []
9
- files.sort.each { |f| findfiles << f if f.include?(filename) }
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
- app = Application.instance
59
+ srcdir = File.join(
60
+ Project.value[:output_basedir],
61
+ Project.value[:test_name]
62
+ )
63
+
61
64
  t = Time.now
62
- data = {year: t.year, month: t.month, day: t.day, hour: t.hour, min: t.min, sec: t.sec}
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(app.output_basedir, app.global[:tt_testname], subdir)
66
- srcdir = File.join(app.output_basedir, app.global[:tt_testname])
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", (finish_time - start_time))
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 " "