busser-testinfra 0.0.1.dev

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 48dc383beeb1b6cadfe26bf01165116427531952
4
+ data.tar.gz: 9eb4be405d943992a786ee98cff31f683255a0c0
5
+ SHA512:
6
+ metadata.gz: 5916864f844558b0f8097df233613ec05f3547d327b9314af41787a61e24d186c86d70eb6884683639a6e3dd800a8e32340bc321638b7620dfdf0b4c6a1c6dcb
7
+ data.tar.gz: 6b629ad9c88db8fc0d60051db92915024aafc53b36dfa509a84a48ebc3972587d70825c170f6c0ca715a339e57209787263667dc9c300f17890a35bba0c7c3bf
data/.cane ADDED
File without changes
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rubocop.yml ADDED
@@ -0,0 +1,3 @@
1
+ Style/ClassAndModuleChildren:
2
+ Exclude:
3
+ - lib/busser/runner_plugin/testinfra.rb
data/.simplecov ADDED
@@ -0,0 +1,10 @@
1
+ SimpleCov.profiles.define 'gem' do
2
+ command_name 'Specs'
3
+
4
+ add_filter '.gem/'
5
+ add_filter '/spec/'
6
+ add_filter '/lib/vendor/'
7
+
8
+ add_group 'Libraries', '/lib/'
9
+ end
10
+ SimpleCov.start 'gem'
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # -*- encoding: utf-8 -*-
2
+ source "https://rubygems.org"
3
+
4
+ gemspec
5
+
6
+ group :guard do
7
+ gem "guard-cucumber"
8
+ gem "guard-cane"
9
+ gem "guard-rubocop"
10
+ end
data/Guardfile ADDED
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ ignore %r{^\.gem/}
3
+
4
+ def rubocop_opts
5
+ { :all_on_start => false, :keep_failed => false, :cli => "-r finstyle -D" }
6
+ end
7
+
8
+ group :red_green_refactor, :halt_on_fail => true do
9
+ guard :cucumber do
10
+ watch(%r{^features/.+\.feature$})
11
+ watch(%r{^features/support/.+$}) { "features" }
12
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) do |m|
13
+ Dir[File.join("**/#{m[1]}.feature")][0] || "features"
14
+ end
15
+ end
16
+
17
+ guard :rubocop, rubocop_opts do
18
+ watch(%r{.+\.rb$})
19
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
20
+ end
21
+
22
+ guard :cane do
23
+ watch(%r{.*\.rb})
24
+ watch(".cane")
25
+ end
26
+ end
data/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # <a name="title"></a> Busser::RunnerPlugin::Testinfra
2
+
3
+ A Busser runner plugin for testing testinfra scripts
4
+
5
+ ## <a name="installation"></a> Installation and Setup
6
+
7
+ Please read the Busser [plugin usage][plugin_usage] page for more details.
8
+
9
+ ## <a name="usage"></a> Usage
10
+
11
+ Please put test files into [COOKBOOK]/test/integration/[SUITES]/testinfra/
12
+
13
+ ```cookbook
14
+ `-- test
15
+ `-- integration
16
+ `-- default
17
+ `-- testinfra
18
+ `--test_name.py
19
+ ```
20
+
21
+ The exit code of the script is used as indicator for failure or success.
22
+
23
+ ### <a name="note"></a> Note
24
+
25
+ Globbing pattern to match files is `"testinfra/test_*.py"`.
26
+
27
+ ## <a name="development"></a> Development
28
+
29
+ * Source hosted at [GitHub][repo]
30
+ * Report issues/questions/feature requests on [GitHub Issues][issues]
31
+
32
+ Pull requests are very welcome! Make sure your patches are well tested.
33
+ Ideally create a topic branch for every separate change you make. For
34
+ example:
35
+
36
+ 1. Fork the repo
37
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
38
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
39
+ 4. Push to the branch (`git push origin my-new-feature`)
40
+ 5. Create new Pull Request
41
+
42
+ ## <a name="authors"></a> Authors
43
+
44
+ Created and maintained by [Jimmy Tang][author] (<jimmy_tang@rapid7.com>)
45
+
46
+ ## <a name="license"></a> License
47
+
48
+ Apache 2.0 (see [LICENSE][license])
data/Rakefile ADDED
@@ -0,0 +1,36 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require "bundler/gem_tasks"
4
+
5
+ require "cucumber/rake/task"
6
+ Cucumber::Rake::Task.new(:features) do |t|
7
+ t.cucumber_opts = ["features", "-x", "--format progress"]
8
+ end
9
+
10
+ desc "Run all test suites"
11
+ task :test => [:features]
12
+
13
+ require "finstyle"
14
+ require "rubocop/rake_task"
15
+ RuboCop::RakeTask.new(:style) do |task|
16
+ task.options << "--display-cop-names"
17
+ end
18
+
19
+ require "cane/rake_task"
20
+ desc "Run cane to check quality metrics"
21
+ Cane::RakeTask.new do |cane|
22
+ cane.canefile = "./.cane"
23
+ end
24
+
25
+ desc "Display LOC stats"
26
+ task :stats do
27
+ puts "\n## Production Code Stats"
28
+ sh "countloc -r lib"
29
+ puts "\n## Test Code Stats"
30
+ sh "countloc -r features"
31
+ end
32
+
33
+ desc "Run all quality tasks"
34
+ task :quality => [:cane, :style, :stats]
35
+
36
+ task :default => [:test, :quality]
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "busser/testinfra/version"
5
+ require "English"
6
+
7
+ Gem::Specification.new do |gem|
8
+ gem.name = "busser-testinfra"
9
+ gem.version = Busser::Testinfra::VERSION
10
+ gem.authors = ["Jimmy Tang"]
11
+ gem.email = ["jimmy_tang@rapid7.com"]
12
+ gem.description = "A Busser runner plugin for testing testinfra"
13
+ gem.summary = gem.description
14
+ gem.homepage = "https://github.com/jcftang-r7/busser-testinfra"
15
+ gem.license = "Apache 2.0"
16
+
17
+ gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
18
+ gem.executables = []
19
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
20
+ gem.require_paths = ["lib"]
21
+
22
+ gem.add_dependency "busser", ">= 0.2.0"
23
+
24
+ gem.add_development_dependency "aruba"
25
+ gem.add_development_dependency "bundler", "~> 1.3"
26
+ gem.add_development_dependency "countloc"
27
+ gem.add_development_dependency "rake"
28
+ gem.add_development_dependency "simplecov"
29
+
30
+ # style and complexity libraries are tightly version pinned as newer releases
31
+ # may introduce new and undesireable style choices which would be immediately
32
+ # enforced in CI
33
+ gem.add_development_dependency "finstyle", "1.2.0"
34
+ gem.add_development_dependency "cane", "2.6.2"
35
+ end
@@ -0,0 +1,11 @@
1
+ Feature: Plugin install command
2
+ In order to use this plugin
3
+ As a user of Busser
4
+ I want to run the postinstall for this plugin
5
+
6
+ Background:
7
+ Given a test BUSSER_ROOT directory named "busser-testinfra-install"
8
+
9
+ Scenario: Running the postinstall generator
10
+ When I run `busser plugin install busser-testinfra --force-postinstall`
11
+ Then the exit status should be 0
@@ -0,0 +1,8 @@
1
+ Feature: Plugin list command
2
+ In order to use this plugin
3
+ As a user of Busser
4
+ I want to see this plugin in the 'busser plugin list' command
5
+
6
+ Scenario: Plugin appears in plugin list command
7
+ When I successfully run `busser plugin list`
8
+ Then the output should match /^testinfra\b/
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require "aruba/cucumber"
4
+ require "busser/cucumber"
5
+
6
+ if ENV["COVERAGE"]
7
+ require "simplecov"
8
+ SimpleCov.command_name "features"
9
+ end
10
+
11
+ Before do
12
+ @aruba_timeout_seconds = 30
13
+ end
14
+
15
+ After do |s|
16
+ # Tell Cucumber to quit after this scenario is done - if it failed.
17
+ # This is useful to inspect the 'tmp/aruba' directory before any other
18
+ # steps are executed and clear it out.
19
+ Cucumber.wants_to_quit = true if s.failed?
20
+ end
@@ -0,0 +1,33 @@
1
+ Feature: Test command
2
+ In order to run tests written with testinfra
3
+ As a user of Busser
4
+ I want my tests to run when the testinfra runner plugin is installed
5
+
6
+ Background:
7
+ Given a test BUSSER_ROOT directory named "busser-testinfra-test"
8
+ When I successfully run `busser plugin install busser-testinfra --force-postinstall`
9
+ Given a suite directory named "testinfra"
10
+
11
+ Scenario: A passing test suite
12
+ Given a file in suite "testinfra" named "test_base" with:
13
+ """
14
+ import testinfra
15
+ import pytest
16
+ def test_id(Command):
17
+ cmd = Command("id")
18
+ assert cmd.rc == 0
19
+ """
20
+ When I run `busser test testinfra`
21
+ And the exit status should be 0
22
+
23
+ Scenario: A failing test suite
24
+ Given a file in suite "testinfra" named "test_base" with:
25
+ """
26
+ import testinfra
27
+ import pytest
28
+ def test_id(Command):
29
+ cmd = Command("id 68F0700A-AA34-4963-80F7-1D5E9F7B978E")
30
+ assert cmd.rc == 0
31
+ """
32
+ When I run `busser test bash`
33
+ And the exit status should not be 0
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require "busser/runner_plugin"
4
+
5
+ # A Busser runner plugin for testinfra
6
+ #
7
+ # @author Jimmy Tang <jimmy_tang@rapid7.com>
8
+ #
9
+ class Busser::RunnerPlugin::Testinfra < Busser::RunnerPlugin::Base
10
+
11
+ def test
12
+ install_testinfra
13
+
14
+ Dir.glob("#{suite_path("testinfra")}/test_*.py").each do |file|
15
+ banner "[testinfra] #{File.basename(file)}"
16
+ run!("testinfra --verbose #{file}")
17
+ end
18
+ end
19
+
20
+ def install_testinfra
21
+ banner("Installing testinfra...")
22
+ run("pip install testinfra")
23
+ end
24
+
25
+ end
@@ -0,0 +1,8 @@
1
+ module Busser
2
+
3
+ module Testinfra
4
+
5
+ # Version string for the Testinfra Busser runner plugin
6
+ VERSION = "0.0.1.dev"
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,176 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: busser-testinfra
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.dev
5
+ platform: ruby
6
+ authors:
7
+ - Jimmy Tang
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: busser
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: aruba
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: countloc
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: finstyle
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 1.2.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 1.2.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: cane
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 2.6.2
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '='
123
+ - !ruby/object:Gem::Version
124
+ version: 2.6.2
125
+ description: A Busser runner plugin for testing testinfra
126
+ email:
127
+ - jimmy_tang@rapid7.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".cane"
133
+ - ".gitignore"
134
+ - ".rubocop.yml"
135
+ - ".simplecov"
136
+ - Gemfile
137
+ - Guardfile
138
+ - README.md
139
+ - Rakefile
140
+ - busser-testinfra.gemspec
141
+ - features/plugin_install_command.feature
142
+ - features/plugin_list_command.feature
143
+ - features/support/env.rb
144
+ - features/test_command.feature
145
+ - lib/busser/runner_plugin/testinfra.rb
146
+ - lib/busser/testinfra/version.rb
147
+ homepage: https://github.com/jcftang-r7/busser-testinfra
148
+ licenses:
149
+ - Apache 2.0
150
+ metadata: {}
151
+ post_install_message:
152
+ rdoc_options: []
153
+ require_paths:
154
+ - lib
155
+ required_ruby_version: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ required_rubygems_version: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - ">"
163
+ - !ruby/object:Gem::Version
164
+ version: 1.3.1
165
+ requirements: []
166
+ rubyforge_project:
167
+ rubygems_version: 2.4.8
168
+ signing_key:
169
+ specification_version: 4
170
+ summary: A Busser runner plugin for testing testinfra
171
+ test_files:
172
+ - features/plugin_install_command.feature
173
+ - features/plugin_list_command.feature
174
+ - features/support/env.rb
175
+ - features/test_command.feature
176
+ has_rdoc: