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

Test-Driven Infrastructure Development

Test-Driven Infrastructure Development

Andrea Tosatto

March 10, 2017
Tweet

More Decks by Andrea Tosatto

Other Decks in Programming

Transcript

  1. POWERDNS Started in 1999 Open-Source since 2007 Part of Open-Xchange

    since 2015 Powering more than 30% of the internet hosted domains in the world 75% of the DNSSEC domains in the world 150mln of internet users A piece of blazing fast C++ code powering the Internet. Sometimes we also use Python. ;-) @PowerDNS powerdns/pdns
  2. WHY

  3. MY #ANSI-MOOD The moment in which my boss told me

    ”you have 2 weeks to deploy that things for that huuuuge customer running Oracle Linux 6, but maybe it was Debian… I don’t know!”
  4. ANSIBLE AT SCALE IT’S HARD • CODE QUALITY CAN EASILY

    BECOME REALLY BAD • IT’S HARD TO ENFORCE STANDARDS ACROSS THE TEAM • SOMETIMES IT’S TO VERIFY YOUR WORK • NO TESTS • NO WORKFLOW • NO DOC • NOT REALLY DEVOPS • SOMETIMES THINGS JUST DON’T GO AS EXPECTED
  5. TEST-DRIVEN DEVOPS • BUSINESS REQUIREMENTS AS TESTS • ENCODE OPS

    KNOWLEDGE AS TEST • VALIDATE YOUR ASSUMPTIONS • EASILY DEAL WITH DIFFERENT OS PLATFORMS • BE SURE TO CATCH ALL THE EDGE CASES • PREDICTABLE AUTOMATION • IDEMPOTENCY • NO SIDE EFFECTS
  6. TESTINFRA (2) • PYTEST FOR THE INFRASTRUCTURE • NO SERVERSPEC

    • NO KITCHEN-CI • NO RUBY • PURE PYTHON • EASY CI
  7. MODULES Command LocalCommand TestinfraBackend Sudo File User Group Interface Package

    PipPackage Process Service Supervisor Socket SystemInfo Salt Ansible PuppetResource Facter Sysctl MountPoint
  8. MOLECULE (2) • ANSIBLE ROLES DEVELOPMENT WORKFLOW TOOL • DEVELOPED

    BY SOME CISCO’S PYTHON NINJAS TO HELP CISCO DEVOPS TO DEVELOP OPENSTACK ROLES https://www.youtube.com/watch?v=5vKblNaD3fI&t=81s • OUT OF THE BOX • BOILERPLATING molecule init • LINTING molecule verify • VALIDATION molecule converge • TESTING molecule test
  9. MOLECULE V2 • SCENARIO BASED TESTING • ANSIBLE-BASED PROVIDERS •

    DOCKER • VAGRANT • OPENSTACK • AWS • … • NO BACK-WARD COMPATIBLE :-( • BUT, IT WILL NOT IMPACT YOUR ANSIBLE CODE, SO EASY UPGRADE! ;-)