/tests/beaker_tests/tacacs_server/test_tacacs_server.rb

https://github.com/cisco/cisco-network-puppet-module · Ruby · 83 lines · 41 code · 8 blank · 34 comment · 0 complexity · 7ed7143fcc38ee6735566619d956ac33 MD5 · raw file

  1. ###############################################################################
  2. # Copyright (c) 2017-2018 Cisco and/or its affiliates.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ###############################################################################
  16. #
  17. # See README-develop-beaker-scripts.md (Section: Test Script Variable Reference)
  18. # for information regarding:
  19. # - test script general prequisites
  20. # - command return codes
  21. # - A description of the 'tests' hash and its usage
  22. #
  23. ###############################################################################
  24. require File.expand_path('../../lib/utilitylib.rb', __FILE__)
  25. # Test hash top-level keys
  26. tests = {
  27. agent: agent,
  28. master: master,
  29. resource_name: 'tacacs_server',
  30. }
  31. # Skip -ALL- tests if a top-level platform/os key exludes this platform
  32. skip_unless_supported(tests)
  33. # Test hash test cases
  34. tests[:default] = {
  35. desc: '1.1 Default Properties',
  36. title_pattern: '8.8.8.8',
  37. manifest_props: {
  38. port: 46,
  39. timeout: 5,
  40. key_format: 7,
  41. key: '6666',
  42. },
  43. code: [0, 2],
  44. }
  45. #
  46. # non_default_properties
  47. #
  48. tests[:ipv6] = {
  49. desc: '2.1 IPV6 Properties',
  50. title_pattern: '2020::20',
  51. manifest_props: {
  52. port: 48,
  53. timeout: 5,
  54. key_format: 7,
  55. key: '6666',
  56. },
  57. }
  58. def cleanup(agent)
  59. test_set(agent, 'no feature tacacs+')
  60. resource_absent_cleanup(agent, 'tacacs_server')
  61. end
  62. #################################################################
  63. # TEST CASE EXECUTION
  64. #################################################################
  65. test_name "TestCase :: #{tests[:resource_name]}" do
  66. teardown { cleanup(agent) }
  67. cleanup(agent)
  68. # -------------------------------------------------------------------
  69. logger.info("\n#{'-' * 60}\nSection 1. Default Property Testing")
  70. test_harness_run(tests, :default)
  71. # -------------------------------------------------------------------
  72. logger.info("\n#{'-' * 60}\nSection 2. IPV6 Property Testing")
  73. test_harness_run(tests, :ipv6)
  74. end
  75. logger.info("TestCase :: #{tests[:resource_name]} :: End")