Precisamos falar sobre Testes de infraestrutura
-
Upload
rafael-gomes -
Category
Technology
-
view
65 -
download
0
Transcript of Precisamos falar sobre Testes de infraestrutura
![Page 1: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/1.jpg)
Precisamos falar sobre teste de infra
Infradel Team
![Page 2: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/2.jpg)
Quem somos
Infradel:● Objetivo: Consultoria para migração de projetos
do modelo centralizado para cloud, com automação e auto-serviço.
● Membros:○ Rafael Gomes (PoA - Brasil)○ Rafael Nunes (PoA - Brasil)○ Augusto Amaral (PoA - Brasil)○ Fernando Laimer (PoA - Brasil)○ Vinicius Gama (Belo Horizonte - Brasil)○ Ronak Jain (Belo Horizonte - Brasil)○ Chris Briesemeister ( Chicago - EUA)○ Luisa Emme ( Quito - Equador)
● Principais tecnologias○ Cloud (AWS)○ Automação de infra (Ansible, Cloudformation)○ Testes de infraestrutura (ServerSpec, Testinfra)○ Container (Docker)○ Programação (Python e Ruby)
![Page 3: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/3.jpg)
Quem sou eu
Rafael Gomes:● Soteropolitano● Apaixonado por compartilhamento● Consultor na Thoughtworks● Blog: techfree.com.br● Twitter/github: @gomex● Áreas de interesse/foco:
○ Cultura DevOps○ Cloud○ Entrega contínua○ Automação de infraestrutura○ Teste de infraestrutura○ Monitoramento
![Page 4: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/4.jpg)
O que estou fazendo de relevante agora
Livro:
http://tinyurl.com/docker-devel
● Pague quanto quiser, inclusive nada
● Não precisa saber nada de Docker
● Licenciado com Creative Commons
![Page 5: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/5.jpg)
O que estou fazendo de relevante agora
Livro Impresso:
● Livro numerado
● Autografado
● Recompensa de R$ 40,00 com entrega
https://www.catarse.me/versao_impressa_do_livro_docker_para_desenvolvedores_c403?ref=project_link
![Page 6: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/6.jpg)
Pra que testar?Pergunta sincera...
![Page 7: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/7.jpg)
O que acontece quando não testo
![Page 8: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/8.jpg)
Como os testes eram feitos antigamente
![Page 9: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/9.jpg)
● Falta de padronização● Testes insuficientes● Sem rastreabilidade● Pouco interesse em reproduzir● Necessidade de conhecimento especializado
Problemas dos testes manuais
![Page 10: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/10.jpg)
Manutenção de ambientes
Dev
Necessidade de Ambientes
agent1
agent2
dev
ticket ops
devTestes
manuais
git
server app A
server app Bserver app C
teste uat prod
![Page 11: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/11.jpg)
Manutenção de ambientes
Dev
Deploy nosAmbientes
ticket ops
Testes manuais
teste
uat
prodTestes manuais
Testes manuais
Teste pós
UAT pós
Prod pós
![Page 12: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/12.jpg)
Manutenção de ambientes
AtualizaçãoNo ambiente
Testes manuais
ops
teste
uat
prodTestes manuais
Testes manuais
Teste pós
UAT pós
Prod pós
![Page 13: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/13.jpg)
Infraestrutura virou código!
![Page 14: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/14.jpg)
Imperativo vs Declarativo
![Page 15: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/15.jpg)
Automação de ambientes
ops
teste
uat
prod
Teste pós
UAT pós
Prod pós
ops
commit
no git repo
git
![Page 16: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/16.jpg)
● Não há como atender a
demanda de infra sem automação
● Automação como método de garantia de padronização
Infra virou código
Fatos:● Atualização de servidores
não se fazem de forma manual
● Até mesmo redes já tem SDN
![Page 17: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/17.jpg)
Se infra virou código, precisamos testar!
![Page 18: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/18.jpg)
Necessidade de teste
ops
teste
uat
prod
Teste pós
UAT pós
Prod pós
commit Dockerfile
no git repo
git
CDAtualiza
![Page 19: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/19.jpg)
Testes manuais?
Testes manuais
ops
teste
uat
prodTestes manuais
Testes manuais
Teste pós
UAT pós
Prod pós
![Page 20: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/20.jpg)
Necessidade de teste
ops
teste
uat
prod
Teste pós
UAT pós
Prod pós
commit Dockerfile
no git repo
git
CD
Testa
Atualiza
![Page 21: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/21.jpg)
TDD para infra?
![Page 22: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/22.jpg)
Soluções de teste
![Page 23: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/23.jpg)
● Boa documentação
● Facilidade na execução dos testes automatizados
Soluções
Fatos:● Abstração que permitem
não DEV criarem testes
● Tem boas opções escritas em ruby e python
![Page 24: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/24.jpg)
Veja como é fácil testar automaticamente
Arquivo "test_mytest.py":def test_nginx_is_installed(Package): nginx = Package("nginx") assert nginx.is_installed assert nginx.version.startswith("1.2")
Comandos para executar o teste:
# pip install testinfra# testinfra --sudo --connection=ssh --hosts=servidor_a_ser_testado test_mytest.py
![Page 25: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/25.jpg)
Soluções
Lista:● Serverspec
○ Escrita em ruby, mais popular
● Testinfra○ Escrita em python
● Inspec○ Escrita em ruby, mantida pela Chef
● Beaker○ Escrita em ruby, mantida pela Puppet
![Page 26: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/26.jpg)
Sysadmin, você sabe desenvolver?
![Page 27: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/27.jpg)
Como construir seus testes!
![Page 28: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/28.jpg)
Pirâmide de testes de infra
![Page 29: Precisamos falar sobre Testes de infraestrutura](https://reader033.fdocumentos.com/reader033/viewer/2022052514/58ed48a71a28ab267b8b4589/html5/thumbnails/29.jpg)
Dúvidas?