15
Test driven development for sysadmins 2018-10-07 Michal Halenka

Test driven development for sysadmins - LinuxDays · he test fails The test fails. Iterate focus Completion of the contract as defined by the test RE-FACTORING Refactor some code

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Test driven development for sysadmins - LinuxDays · he test fails The test fails. Iterate focus Completion of the contract as defined by the test RE-FACTORING Refactor some code

Test driven developmentfor sysadmins

2018-10-07 Michal Halenka

Page 2: Test driven development for sysadmins - LinuxDays · he test fails The test fails. Iterate focus Completion of the contract as defined by the test RE-FACTORING Refactor some code

Code

● version control● code review● automated testing● CI/CD

Page 3: Test driven development for sysadmins - LinuxDays · he test fails The test fails. Iterate focus Completion of the contract as defined by the test RE-FACTORING Refactor some code

Code

● version control● code review● automated testing● CI/CD

● version control● code review● automated testing● CI/CD if a b e n u

In as c e s code

Page 4: Test driven development for sysadmins - LinuxDays · he test fails The test fails. Iterate focus Completion of the contract as defined by the test RE-FACTORING Refactor some code
Page 5: Test driven development for sysadmins - LinuxDays · he test fails The test fails. Iterate focus Completion of the contract as defined by the test RE-FACTORING Refactor some code

● “Are you testing your role?”● “Yes, of course.”● “How?”● “I run my code on the target machine, and then I hope

it doesn’t fail.”

Different approaches ...

Page 6: Test driven development for sysadmins - LinuxDays · he test fails The test fails. Iterate focus Completion of the contract as defined by the test RE-FACTORING Refactor some code
Page 7: Test driven development for sysadmins - LinuxDays · he test fails The test fails. Iterate focus Completion of the contract as defined by the test RE-FACTORING Refactor some code
Page 8: Test driven development for sysadmins - LinuxDays · he test fails The test fails. Iterate focus Completion of the contract as defined by the test RE-FACTORING Refactor some code
Page 9: Test driven development for sysadmins - LinuxDays · he test fails The test fails. Iterate focus Completion of the contract as defined by the test RE-FACTORING Refactor some code

Ansible is not Java

● “Are you aware of the concept of Test-Driven Development?”

● “Yeah, I used to work that way all the time when I was doing dev with the team.”

● “Why don’t you test your code that way instead?”● “Because it is not Java, it’s Ansible.”● “So?”

Page 10: Test driven development for sysadmins - LinuxDays · he test fails The test fails. Iterate focus Completion of the contract as defined by the test RE-FACTORING Refactor some code

Infrastructure tests frameworks

● Bats● Goss● Serverspec● InSpec● TestInfra

Page 11: Test driven development for sysadmins - LinuxDays · he test fails The test fails. Iterate focus Completion of the contract as defined by the test RE-FACTORING Refactor some code

“I don’t have any infrastructure for running tests”

Page 12: Test driven development for sysadmins - LinuxDays · he test fails The test fails. Iterate focus Completion of the contract as defined by the test RE-FACTORING Refactor some code

“I don’t have any infrastructure for running tests”

Page 13: Test driven development for sysadmins - LinuxDays · he test fails The test fails. Iterate focus Completion of the contract as defined by the test RE-FACTORING Refactor some code
Page 14: Test driven development for sysadmins - LinuxDays · he test fails The test fails. Iterate focus Completion of the contract as defined by the test RE-FACTORING Refactor some code
Page 15: Test driven development for sysadmins - LinuxDays · he test fails The test fails. Iterate focus Completion of the contract as defined by the test RE-FACTORING Refactor some code