norad_spec_runner 0.3.5 → 0.4.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
  SHA1:
3
- metadata.gz: a6e227a6333689055aa8d270fb0f923161cd3d0a
4
- data.tar.gz: ffbf59f5ad6873432f2b31053561bc5cdcdb52d9
3
+ metadata.gz: ce841d83e425d3af5434769e162b8ae280ed627d
4
+ data.tar.gz: 7c6548fdf09a8269e60110eb8028e07a55263f78
5
5
  SHA512:
6
- metadata.gz: c6596f7443c41ead0a3b84bc3d220982dad40219f9dd604835346863211aa05a1a5509ef02257e7c77d66d24ba2bd47cdc0f9615e5815c5dbb495ef0ed03f2fd
7
- data.tar.gz: 41f606e39bf13ee04144990b059a7c453269f04941d09094d888dea02c57e737970bdfd724d9cc43a7a513008473c04a85899a7ec39c46c448c49bc17709c24d
6
+ metadata.gz: 8cec437dbb4a1de0267bd5b6845bb0d2d634f42424a2b7cb3f7ad86f0037db8f8effe2b9cf51b38912b0e0d841801c538ea259e6ffde61f3c752e0c171e85189
7
+ data.tar.gz: dc635602ce19918b069396abc11202e677980978d0341a9b2abfbfd3d82cc4f415b8c0db7405e3cd7a82d952029b011be499096c506e9bafb99624d6fa9fc6d5
@@ -7,8 +7,9 @@ module NoradSpecRunner
7
7
  # Class to run Rspec tests over SSH
8
8
  class RemoteTask < Task
9
9
  SSH_TIMEOUT = 10
10
+ DEFAULT_LINUX_SPEC = 'default_linux_spec.rb'
10
11
 
11
- attr_reader :host, :username, :sshkey, :ssh_port, :obj, :platform, :results_file, :cisco_enable_pw
12
+ attr_reader :host, :username, :sshkey, :ssh_port, :obj, :platform, :results_file, :cisco_enable_pw, :tests_parent_dir
12
13
 
13
14
  def initialize(encoded_key, options)
14
15
  @host = options.fetch(:host)
@@ -20,6 +21,7 @@ module NoradSpecRunner
20
21
  end
21
22
  @ssh_port = options.fetch(:port, nil)
22
23
  @username = options.fetch(:username, nil)
24
+ @tests_parent_dir = ENV.fetch('TESTS_PARENT_DIR', '/')
23
25
  tests = options.fetch(:tests)
24
26
  sub_tests = options.fetch(:sub_tests)
25
27
  detect_os = options.fetch(:detect_os, false)
@@ -78,15 +80,19 @@ module NoradSpecRunner
78
80
  end
79
81
 
80
82
  def autodetect_test_pattern(tests)
83
+ pattern = select_spec_for_os(tests)
84
+ pattern = "#{tests}/#{DEFAULT_LINUX_SPEC}" unless File.exist?("#{tests_parent_dir}/#{pattern}")
85
+ puts "Trying to run #{pattern}"
86
+ pattern
87
+ end
88
+
89
+ def select_spec_for_os(tests)
81
90
  if target_is_ios_device?(start_ssh_session) || target_is_linux?(start_ssh_session)
82
- x = "#{tests}/#{platform}_spec.rb"
83
- puts "Platform detected!"
84
- puts "Trying to run #{x}"
85
- x
91
+ puts "Platform #{platform} detected!"
92
+ "#{tests}/#{platform}_spec.rb"
86
93
  else
87
- puts "COULD NOT DETECT OS!"
88
- ""
89
- # we need to do something to signify OS could not be detected
94
+ puts 'COULD NOT DETECT OS!'
95
+ "#{File.expand_path(File.dirname(__FILE__))}/support/os_not_supported_spec.rb"
90
96
  end
91
97
  end
92
98
 
@@ -0,0 +1,7 @@
1
+ require 'rspec'
2
+
3
+ RSpec.describe 'Operating System Detection:' do
4
+ it "OS Not Supported" do
5
+ expect(0).to eq(1), "Your operating system could not be detected. Please contact Norad Support."
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module NoradSpecRunner
2
- VERSION = "0.3.5"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: norad_spec_runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Manifold
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-03-24 00:00:00.000000000 Z
13
+ date: 2017-05-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: serverspec
@@ -131,6 +131,7 @@ files:
131
131
  - lib/norad_spec_runner.rb
132
132
  - lib/norad_spec_runner/cli.rb
133
133
  - lib/norad_spec_runner/remote_task.rb
134
+ - lib/norad_spec_runner/support/os_not_supported_spec.rb
134
135
  - lib/norad_spec_runner/task.rb
135
136
  - lib/norad_spec_runner/version.rb
136
137
  - norad_spec_runner.gemspec