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

Adopting Test Driven Development in Operations

Ranjib Dey
August 11, 2015

Adopting Test Driven Development in Operations

Experience report on adopting test driven development in operations. Originally presented at Agile2014, Washington DC.

Ranjib Dey

August 11, 2015
Tweet

More Decks by Ranjib Dey

Other Decks in Programming

Transcript

  1. Strategies for adopting TDD in
    Operations
    @RanjibDey
    Based on the Experience Report: http://goo.gl/GIwn1v

    View Slide

  2. Agenda
    @RanjibDey
    1.Introduction
    2.TDD in brief
    3.Why TDD is compelling in Operations
    4.Strategies
    5.Key learnings
    6.Q/A

    View Slide

  3. Introduction
    @RanjibDey

    View Slide

  4. TDD in brief
    @RanjibDey
    1.Unit test first
    2.Part of XP
    3.Has evolved a lot

    View Slide

  5. Why TDD in Operations?
    @RanjibDey
    Operations integrates services

    View Slide

  6. Why TDD in Operations?
    @RanjibDey
    Tactical workloads are difficult to predict

    View Slide

  7. Why TDD in Operations?
    @RanjibDey
    Legacy components

    View Slide

  8. Strategies
    @RanjibDey
    1.Layered tests
    2.Code reviews
    3.Extend CI to operations
    4.Continuous learning

    View Slide

  9. Layered testing strategy
    @RanjibDey
    1.Unit tests for fast feedback
    2.Functional tests for feature validation
    3.Integration tests for end to end testing

    View Slide

  10. Unit tests
    @RanjibDey
    directory "/var/go/.ssh" do
    owner 'go'
    group 'go'
    mode 0700
    end
    it 'creates the go user ssh directory' do
    expect(runner).to create_directory('/var/go/.ssh').with(
    owner: 'go',
    group: 'go',
    mode: 0700
    )
    end

    View Slide

  11. Unit tests
    @RanjibDey
    pagerduty/infra[master]$rake spec
    Finished in 1 minute 15.16 seconds
    5629 examples, 0 failures, 4 pending

    View Slide

  12. Functional tests
    @RanjibDey
    it 'creates a standalone zk node' do
    ct = helper.container('pd-zk')
    out = ct.execute do
    h= 'localhost'
    p = 2181
    telnet = Net::Telnet::new('Host' => h, 'Port' => p)
    state = telnet.cmd('String' => 'ruok')
    telnet.close
    state
    end
    expect(out).to eq('imok')
    end

    View Slide

  13. Integration tests
    @RanjibDey

    View Slide

  14. Code reviews
    @RanjibDey

    View Slide

  15. Continuous Integration
    @RanjibDey
    Extend CI in operations

    View Slide

  16. Continuous Integration
    @RanjibDey
    Make courtesy artifacts

    View Slide

  17. Continuous Learning
    @RanjibDey
    1.Invest on learning resources
    2.Conferences
    3.Engage in OpenSource projects

    View Slide

  18. Continuous Learning
    @RanjibDey
    Invest on learning resources

    View Slide

  19. Continuous Learning
    @RanjibDey
    Conferences, meetups

    View Slide

  20. Continuous Learning
    @RanjibDey
    Contribute and learn from OpenSource
    projects

    View Slide

  21. Key Learnings
    @RanjibDey
    1.Be patient
    2.Capture patterns, test patterns
    3.Embrace diversity

    View Slide

  22. Key Learnings
    @RanjibDey
    Be patient

    View Slide

  23. Key Learnings
    @RanjibDey
    Capture patterns

    View Slide

  24. Key Learnings
    @RanjibDey
    Capture patterns

    View Slide

  25. Key Learnings
    @RanjibDey
    Embrace diversity, ease deduction

    View Slide

  26. @RanjibDey
    Thank You
    Based on the Experience Report: http://goo.gl/GIwn1v

    View Slide