Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Testing "Hardware" Cookbooks with Kitchen

Testing "Hardware" Cookbooks with Kitchen

Slides from my Chef Conf Online 2021 presentation

Joe Nuspl

August 12, 2021
Tweet

More Decks by Joe Nuspl

Other Decks in Technology

Transcript

  1. Testing “hardware”
    cookbooks with
    kitchen
    Joe Nuspl
    Principal Engineer, Workday

    View Slide

  2. 2

    Based in Portland, OR

    DevOpsDays Portland organizer

    Started with chef-0.8.2 on CentOS 5.3

    https://supermarket.chef.io/cookbooks/zap

    http://nvwls.github.io/

    @JoeNuspl
    Who am I?

    View Slide

  3. 3
    http://fredrikdesigns.com/portfolio/growly-bear-metal/

    View Slide

  4. 4
    https://www.easytechjunkie.com/what-is-a-rack-server.htm

    View Slide

  5. 5
    All software should be tested

    View Slide

  6. 6
    “I need hardware to test the cookbook”

    View Slide

  7. 7
    Wrong!
    “I need hardware to test the cookbook”

    View Slide

  8. 8
    What are you trying to test?

    View Slide

  9. 9

    View Slide

  10. 10
    Trust the lower layers, test your layer

    View Slide

  11. 11
    Correct code can fail

    View Slide

  12. 12

    Client does not have access to server

    Server does not export the volume to that client

    Server is down for maintenance
    Why could this fail?

    View Slide

  13. 13

    There is nothing the recipe could do to fix the failure

    Focus on the real purpose of the code

    Avoid the failure
    The recipe is correct

    View Slide

  14. 14
    What to test?

    View Slide

  15. 15

    /etc/fstab ●
    /proc/mounts
    Persistent Point in time State

    View Slide

  16. 16

    Did the cookbook
    configure things?

    /etc/fstab

    Focus on persistent
    What type of testing?

    Does this server fulfill its
    purpose?

    /proc/mounts

    Focus on state
    Integration Compliance

    View Slide

  17. 17
    Special case kitchen?

    View Slide

  18. 18
    Use a handler to override behavior

    View Slide

  19. 19

    https://www.merriam-webster.com/dictionary/feign

    to give a false appearance of : induce as a false
    impression
    feign

    View Slide

  20. 20
    feign::nfs-mount

    View Slide

  21. 21
    Converges!

    View Slide

  22. 22

    Usually means only applicable on a particular hardware
    platform

    Not that it CAN only run on that platform
    Hardware specific recipes

    View Slide

  23. 23
    hw::dell

    View Slide

  24. 24
    Verifies under dokken

    View Slide

  25. 25
    Hardware logic

    View Slide

  26. 26
    Nothing is converged

    View Slide

  27. 27
    feign::dell

    View Slide

  28. 28
    feign::hp

    View Slide

  29. 29

    ProLiant_DL380_Gen9 vs ProLiant_DL380_Gen10

    PowerEdge_R640 vs PowerEdge_R740xd
    Model based logic

    View Slide

  30. 30
    Location specific recipes

    View Slide

  31. 31

    View Slide

  32. 32

    Docker4Mac lacks autofs support

    Need to mock the autofs service
    Test environment limitations

    View Slide

  33. 33

    View Slide

  34. 34
    Include (some) test support in utility cookbooks

    View Slide

  35. 35

    https://github.com/bblimke/webmock
    webmock

    View Slide

  36. 36

    View Slide

  37. 37

    View Slide

  38. 38
    https://www.homelectrical.com/sites/default/files/styles/original_image/public/images/product/blg/blg-
    woke_up_late.jpg
    Flawed design?

    View Slide

  39. 39
    ● https://github.com/nvwls/feign
    ● https://github.com/nvwls/hw
    ● https://github.com/nvwls/chefconf21
    ● https://nvwls.github.io/
    Thank you!

    View Slide