Top Banner
Test driven development for sysadmins 2018-10-07 Michal Halenka
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.

Aug 03, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
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.