Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions tests/ciscotest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,16 @@ def address_match?(int_ip)
# Some NXOS hardware is not capable of supporting certain features even
# though the platform family in general includes support. In these cases
# the NU feature setter will raise a RuntimeError.
def hardware_supports_feature?(message)
# Default behavior is to skip/flunk.
def hardware_supports_feature?(message, status_only: false)
patterns = ['Hardware is not capable of supporting',
'is unsupported on this node',
'Feature NOT supported on this Platform',
]
skip('Skip test: Feature is unsupported on this device') if
message[Regexp.union(patterns)]
if message[Regexp.union(patterns)]
return true if status_only
skip('Skip test: Feature is unsupported on this device')
end
flunk(message)
end

Expand Down
6 changes: 6 additions & 0 deletions tests/test_vxlan_vtep.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,22 @@
class TestVxlanVtep < CiscoTestCase
@skip_unless_supported = 'vxlan_vtep'
@@pre_clean_needed = true # rubocop:disable Style/ClassVars
@@feature_unsupported = false # rubocop:disable Style/ClassVars

def setup
super
skip('setup: Feature is unsupported on this device') if @@feature_unsupported
skip('Platform does not support MT-full or MT-lite') unless
VxlanVtep.mt_full_support || VxlanVtep.mt_lite_support
Interface.interfaces(:nve).each { |_nve, obj| obj.destroy }
vdc_limit_f3_no_intf_needed(:set)
feature_cleanup if @@pre_clean_needed
Feature.nv_overlay_enable
@@pre_clean_needed = false # rubocop:disable Style/ClassVars
rescue RuntimeError => e
# Skip locally to shortcut the dependencies above for the next test
@@feature_unsupported = hardware_supports_feature?(e.message, status_only: true) # rubocop:disable Style/ClassVars
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so if I am reading this correctly, the first test will still go through the dependency list but then skips will go quickly after that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct

@@feature_unsupported ? skip(e.message) : raise(e.message)
end

def teardown
Expand Down
6 changes: 6 additions & 0 deletions tests/test_vxlan_vtep_vni.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,21 @@
class TestVxlanVtepVni < CiscoTestCase
@skip_unless_supported = 'vxlan_vtep_vni'
@@pre_clean_needed = true # rubocop:disable Style/ClassVars
@@feature_unsupported = false # rubocop:disable Style/ClassVars

def setup
super
skip('setup: Feature is unsupported on this device') if @@feature_unsupported
vdc_limit_f3_no_intf_needed(:set) if VxlanVtep.mt_full_support
Interface.interfaces(:nve).each { |_nve, obj| obj.destroy }
feature_cleanup if @@pre_clean_needed
Feature.nv_overlay_enable
config_no_warn('feature vn-segment-vlan-based') if VxlanVtep.mt_lite_support
@@pre_clean_needed = false # rubocop:disable Style/ClassVars
rescue RuntimeError => e
# Skip locally to shortcut the dependencies above for the next test
@@feature_unsupported = hardware_supports_feature?(e.message, status_only: true) # rubocop:disable Style/ClassVars
@@feature_unsupported ? skip(e.message) : raise(e.message)
end

def teardown
Expand Down