SlideShare uma empresa Scribd logo
1 de 26
Baixar para ler offline
Functional and scale performance tests
using zopkio
{‘Event’: ‘PyCON HK 2015’,
‘Name’: ‘Marcelo Araujo’,
‘Email’: ‘marcelo@gandi.net’
Agenda
● About me.
● Why we test software?
● Zopkio test framework.
● Q&A.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
About me
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
● Name: Marcelo Araujo.
● Bachelor in Computer System Networking and Telecommunications.
● Post-Degree in Quality on Software Engineering.
● Python consumer since 2007.
● FreeBSD Developer since 2007 (ports and *kernel).
● DevOps at Gandi since 2015.
From To
Why we test software?
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
● Assure what we created does what it supposed to do.
● The behavior with one user could be different with thousand users.
● Users could do something unexpected or not planned.
● Many different devices, browsers, operating systems and so forth.
● We want assure a good software quality.
● Validation: Are we doing the right job?
● Verification: Are we doing the job right?
A typical application infra.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
App Server Database
Your application starts like this!
Then, becomes like this.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
App Server Master DB
Slave DB
Cache
Storage
Balancer/Proxy
API Servers
Storage Replication
VMs
Services
A question!
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
As a DevOps, It is not only about test software anymore!
How can I test the infrastructure?
Zopkio test framework.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
● Made by Linkedin.
● It is a test framework built to support at scale performance and functional
testing.
● It can be installed via pip.
● Latest code at: https://github.com/linkedin/Zopkio
● There is documentation.
● Enough pydoc for every each class.
● They have some examples of code.
● Under Apache 2.0 License.
● They are open for pull requests.
● Active development.
Zopkio test framework.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
● Zopkio provides the ability to write tests that combine performance and
functional testing across a distributed system.
● Writing tests using Zopkio should be nearly as simple as writing tests in xUnit
or Nose.
● Zopkio strongly depends on:
○ Naarad: A system analysis tool that parses and plots time series data.
○ Paramiko: Python implementation of SSHv2 protocol.
Zopkio test framework.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
● What kind of tests can we perform with zopkio?
○ Functional.
■ Ensure every function produces its expected outcome.
○ Load.
■ Understand the behaviour under a specific and expected load.
○ Stress.
■ What is the behaviour beyond the normal expected load.
○ Performance.
■ Determine the speed or effectiveness of an software or service.
Zopkio test framework.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
● What we need from a functional and performance test framework?
○ ASSERT: Must be able to test a condition!
○ Get data vs time and compare with what we expected.
○ Plot graphs!
○ Provisioning before run any test.
○ Parallelize tests.
○ Control the sequence of tests.
○ Collect logs.
○ Parse logs.
○ Cleanup environment after tests.
○ An interface with test result.
○ Be able to debug! Our test is a software too.
My PYHK test lab.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
bare-metal machine
FreeBSD OS
Hypervisor Type 2 (bhyve)
VM1 (BSD) VM2 (BSD) VM3 (Linux) VM4 (BSD)
Zopkio
Switch
Server
What tests I will perform in this lab?
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
● VM1 and VM2: Check how many files inside /etc/ and apply an ASSERT.
● VM1 and VM2: ICMP to example.com and check the lantency.
● VM3 and VM4: TCP Server/Client and make a connection between them.
The basic of Zopkio.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
.
|-- deployment.py
|-- naarad.cfg
|-- perf.py
|-- run.py
|-- test_suites
| |-- connection.py
| |-- machine1_etc.py
| |-- machine1_ping.py
| |-- machine2_etc.py
| `-- machine2_ping.py
|-- configs
| `-- pyhk.json
|-- scripts
| |-- ping-csv.sh
| |-- run.sh
| |-- server.py
| |-- client.py
| `-- scripts.tar
● A test suite consists of:
○ A deployment file.
○ A dynamic configuration file.
○ One or more test files.
○ A config directory.
The Zopkio framework.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
● Zopkio has a main script that takes several optional arguments:
○ Run only named tests to help debug broken tests.
○ Configs overrides at execution time.
○ Log level.
○ Console log level.
● To run my test suite:
araujo@coxinha:/z/hk# zopkio run.py --nopassword --log-level DEBUG
Main run.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
1 +-- 2 lines: import os------------------------------------------------------------------
3 test = {
4 "deployment_code": os.path.join(
5 os.path.dirname(
6 os.path.abspath(__file__)), "deployment.py"),
7 "test_code": [
8 os.path.join(
9 os.path.dirname(
10 os.path.abspath(__file__)), "test_suites/machine1_etc.py"),
11 os.path.join(
12 os.path.dirname(
13 os.path.abspath(__file__)), "test_suites/machine1_ping.py"),
14 os.path.join(
15 os.path.dirname(
16 os.path.abspath(__file__)), "test_suites/connection.py"),
17 os.path.join(
18 os.path.dirname(
19 os.path.abspath(__file__)), "test_suites/machine2_ping.py"),
20 os.path.join(
21 os.path.dirname(
22 os.path.abspath(__file__)), "test_suites/machine2_etc.py")],
.
|-- run.py
23 "perf_code": os.path.join(
24 os.path.dirname(os.path.abspath(__file__)), "perf.py"),
25 "configs_directory": os.path.join(
26 os.path.dirname(os.path.abspath(__file__)), "configs/")
27 }
The config file.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
1 {
2 "comment": "This is the first test",
3 "tip": "How many files on my /etc",
4 "pyhk_install": "/tmp/pyhk/",
5 "pyhk_exec": "scripts/scripts.tar",
6 "pyhk_cmd": "sh run.sh",
7 "ping_cmd": "bash ping-csv.sh --add-timestamp example.com >/tmp/pyhk/ping-output.csv",
8 "tcp_server_cmd": "python server.py &",
9 "tcp_client_cmd": "python client.py >connection.log",
10 "show_all_interations":true,
11 "verify_after_each_test":true,
12 "pyhk_hostname1": "10.0.1.22",
13 "pyhk_hostname2": "10.0.1.12"
14 }
|-- configs
| `-- pyhk.json
The dynamic config.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
1 +-- 4 lines: !/usr/bin/env python-----------------------------------------------
5 LOGS_DIRECTORY = "/tmp/pyhk/collected_logs/"
6 OUTPUT_DIRECTORY = "/tmp/pyhk/results/"
7 +-- 2 lines: --------------------------------------------------------------------------
9 def machine_logs():
10 return {
11 "client1": [os.path.join("/tmp/pyhk/", "connection.log")],
12 "machine1": [os.path.join("/tmp/pyhk/", "run.log")],
13 "machine2": [os.path.join("/tmp/pyhk/", "run.log")],
14 }
15 +-- 2 lines: --------------------------------------------------------------------------
17 def naarad_logs():
18 return {
19 "machine1": [os.path.join("/tmp/pyhk/", "run.csv")],
20 "machine2": [os.path.join("/tmp/pyhk/", "run.csv")],
21 "machine1": [os.path.join("/tmp/pyhk/", "ping-output.csv")],
22 "machine2": [os.path.join("/tmp/pyhk/", "ping-output.csv")],
23 }
24 +-- 2 lines: -----------------------------------------------------------------------------
26 def naarad_config():
27 return os.path.join(
28 os.path.dirname(os.path.abspath(__file__)), "naarad.cfg")
.
|-- perf.py
The deployment file.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
● It is in charge of provisioning machines.
● A deployment file can contain four functions:
○ setup_suite() - Will run before any of tests.
○ setup() - Will run before each test.
○ teardown() - Will run if setup() ran successfully.
○ teardown_suite() - Will run if setup_suite() ran successfully.
The deployer.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
1 +-- 3 lines: !/usr/bin/env python-------------------------------------------------------------------------------
4 import zopkio.adhoc_deployer as adhoc_deployer
5 import zopkio.runtime as runtime
6 +-- 6 lines: pyhk_deployer = None--------------------------------------------------------------------------
12 def setup_suite():
13 +-- 2 lines: print "==> Starting tests for PYHK."---------------------------------------------------------
15 runtime.set_user('root', '')
16 +-- 4 lines: global pyhk_deployer---------------------------------------------------------------------------
20 tcp_server = adhoc_deployer.SSHDeployer(
21 "server",
22 {'executable': runtime.get_active_config('pyhk_exec'),
23 'extract': True,
24 'start_command': runtime.get_active_config('tcp_server_cmd'),
25 'stop_command': "ps ax | grep '[p]ython server' | awk '{print $1}' | xargs kill -9"})
26 runtime.set_deployer("server", tcp_server)
27
28 tcp_server.install("server1",
29 {"hostname": "10.0.1.23",
30 "install_path": runtime.get_active_config('pyhk_install')})
31
32 tcp_client = adhoc_deployer.SSHDeployer(
33 "client",
34 {'executable': runtime.get_active_config('pyhk_exec'),
35 'extract': True,
36 'start_command': runtime.get_active_config('tcp_client_cmd')})
37 runtime.set_deployer("client", tcp_client)
38
39 tcp_client.install("client1",
40 {"hostname": "10.0.1.24",
41 "install_path": runtime.get_active_config('pyhk_install')})
42 +-- 20 lines: pyhk_deployer = adhoc_deployer.SSHDeployer(--------
62 def setup():
63 for process in tcp_server.get_processes():
64 tcp_server.start(process.unique_id)
65
66 def teardown_suite():
67 for process in tcp_server.get_processes():
68 tcp_server.undeploy(process.unique_id)
.
|-- deployment.py
An test file.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
1 +-- 6 lines: !/usr/bin/env python-----------------------------------------------
7 import zopkio.runtime as runtime
8 import zopkio.test_utils as testutilities
9
10 test_phase = 3
11 +-- 2 lines: ------------------------------------------------------------------------
13 def test_ping_host1():
14 print "==> ping example.com (machine1)"
15 pyhk_deployer = runtime.get_deployer("pyhk")
16
17 pyhk_deployer.start(
18 "machine1",
19 configs={
20 "start_command": runtime.get_active_config('ping_cmd'),
21 "sync": True
22 })
23 +-- 2 lines: ------------------------------------------------------------------------
25 def validate_ping_host1():
26 '''
27 Send 10 icmp to example.com .
28 '''
29 hostname1_log_file = os.path.join(
30 perf.LOGS_DIRECTORY, "machine1-ping-output.csv")
31 hostname1_logs = testutilities.get_log_for_test(
32 "test_ping_host1", hostname1_log_file, "12:00:00")
33
34 # Number of icmp packages
35 size_p = len(hostname1_logs.split(',')) / 2
36
37 assert size_p == 10, "Less than 10 replies on host1"
|-- test_suites
| |-- machine1_ping.py
Plot graphs.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
1 [machine1-icmp]
2 infile=/tmp/pyhk/collected_logs/machine1-ping-output.csv
3 columns=sequence latency
4 sep=,
5 qps.sla=mean<500
6 latency.sla=mean<400 p50<300
7
8 [machine2-icmp]
9 infile=/tmp/pyhk/collected_logs/machine2-ping-output.csv
10 columns=sequence latency
11 sep=,
12
13 [GRAPH]
14 graphs=machine1-icmp.sequence,machine1-icmp.latency machine2-icmp.sequence,machine2-icmp.latency
.
|-- naarad.cfg
The Zopkio GUI.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
Let's take a look on my machine
The conclusion is:
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
We need to be able to test the infrastructure where I
will run my application.
References.
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
● Zopkio:
○ https://github.com/linkedin/Zopkio
● Naarad:
○ https://github.com/linkedin/naarad/
● Code for PYHK Test Lab:
○ https://github.com/araujobsd/pyhk2015
● Slides at:
○ TBD
PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
Thank you!
marcelo@gandi.net
araujo@FreeBSD.org

Mais conteúdo relacionado

Mais procurados

Code Kata: String Calculator in Flex
Code Kata: String Calculator in FlexCode Kata: String Calculator in Flex
Code Kata: String Calculator in Flex
Chris Farrell
 

Mais procurados (20)

nullcon 2010 - Intelligent debugging and in memory fuzzing
nullcon 2010 - Intelligent debugging and in memory fuzzingnullcon 2010 - Intelligent debugging and in memory fuzzing
nullcon 2010 - Intelligent debugging and in memory fuzzing
 
How to lock a Python in a cage? Managing Python environment inside an R project
How to lock a Python in a cage?  Managing Python environment inside an R projectHow to lock a Python in a cage?  Managing Python environment inside an R project
How to lock a Python in a cage? Managing Python environment inside an R project
 
OSMC 2010 | NSClient++ - what's new? And what's coming! by Michael Medin
OSMC 2010 |  NSClient++ - what's new? And what's coming! by Michael MedinOSMC 2010 |  NSClient++ - what's new? And what's coming! by Michael Medin
OSMC 2010 | NSClient++ - what's new? And what's coming! by Michael Medin
 
GCC Compiler as a Performance Testing tool for C programs
GCC Compiler as a Performance Testing tool for C programsGCC Compiler as a Performance Testing tool for C programs
GCC Compiler as a Performance Testing tool for C programs
 
Semi-Automatic Code Cleanup with Clang-Tidy
Semi-Automatic Code Cleanup with Clang-TidySemi-Automatic Code Cleanup with Clang-Tidy
Semi-Automatic Code Cleanup with Clang-Tidy
 
Build microservice with gRPC in golang
Build microservice with gRPC in golangBuild microservice with gRPC in golang
Build microservice with gRPC in golang
 
Poof
PoofPoof
Poof
 
Fuzzing softwares for bugs - OWASP Seasides
Fuzzing softwares for bugs - OWASP SeasidesFuzzing softwares for bugs - OWASP Seasides
Fuzzing softwares for bugs - OWASP Seasides
 
C++17 now
C++17 nowC++17 now
C++17 now
 
Code Kata: String Calculator in Flex
Code Kata: String Calculator in FlexCode Kata: String Calculator in Flex
Code Kata: String Calculator in Flex
 
Managing large scale projects in R with R Suite
Managing large scale projects in R with R SuiteManaging large scale projects in R with R Suite
Managing large scale projects in R with R Suite
 
Performance tests with gatling
Performance tests with gatlingPerformance tests with gatling
Performance tests with gatling
 
JavaFX8 TestFX - CDI
JavaFX8   TestFX - CDIJavaFX8   TestFX - CDI
JavaFX8 TestFX - CDI
 
Hands on clang-format
Hands on clang-formatHands on clang-format
Hands on clang-format
 
Golang Project Layout and Practice
Golang Project Layout and PracticeGolang Project Layout and Practice
Golang Project Layout and Practice
 
Analysis of merge requests in GitLab using PVS-Studio for C#
Analysis of merge requests in GitLab using PVS-Studio for C#Analysis of merge requests in GitLab using PVS-Studio for C#
Analysis of merge requests in GitLab using PVS-Studio for C#
 
Python Testing Fundamentals
Python Testing FundamentalsPython Testing Fundamentals
Python Testing Fundamentals
 
Java 9 - Part1: New Features (Not Jigsaw Modules)
Java 9 - Part1: New Features (Not Jigsaw Modules)Java 9 - Part1: New Features (Not Jigsaw Modules)
Java 9 - Part1: New Features (Not Jigsaw Modules)
 
Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1
 
Java 9/10/11 - What's new and why you should upgrade
Java 9/10/11 - What's new and why you should upgradeJava 9/10/11 - What's new and why you should upgrade
Java 9/10/11 - What's new and why you should upgrade
 

Semelhante a Functional and scale performance tests using zopkio

Briforum2012 advanced appv-sequencing
Briforum2012 advanced appv-sequencingBriforum2012 advanced appv-sequencing
Briforum2012 advanced appv-sequencing
Kevin Kaminski
 

Semelhante a Functional and scale performance tests using zopkio (20)

HPC Examples
HPC ExamplesHPC Examples
HPC Examples
 
Nagios monitoring with_python_plugin
Nagios monitoring with_python_pluginNagios monitoring with_python_plugin
Nagios monitoring with_python_plugin
 
New Jersey Red Hat Users Group Presentation: Provisioning anywhere
New Jersey Red Hat Users Group Presentation: Provisioning anywhereNew Jersey Red Hat Users Group Presentation: Provisioning anywhere
New Jersey Red Hat Users Group Presentation: Provisioning anywhere
 
2014 11 20 Drupal 7 -> 8 test migratie
2014 11 20 Drupal 7 -> 8 test migratie2014 11 20 Drupal 7 -> 8 test migratie
2014 11 20 Drupal 7 -> 8 test migratie
 
PyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web ApplicationsPyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web Applications
 
Gatling Performance Workshop
Gatling Performance WorkshopGatling Performance Workshop
Gatling Performance Workshop
 
Tutorial to setup OpenStreetMap tileserver with customized boundaries of India
Tutorial to setup OpenStreetMap tileserver with customized boundaries of IndiaTutorial to setup OpenStreetMap tileserver with customized boundaries of India
Tutorial to setup OpenStreetMap tileserver with customized boundaries of India
 
Django Architecture Introduction
Django Architecture IntroductionDjango Architecture Introduction
Django Architecture Introduction
 
Raising ux bar with offline first design
Raising ux bar with offline first designRaising ux bar with offline first design
Raising ux bar with offline first design
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
 
Introduction to clarity
Introduction to clarityIntroduction to clarity
Introduction to clarity
 
Nagios intro
Nagios intro Nagios intro
Nagios intro
 
Briforum2012 advanced appv-sequencing
Briforum2012 advanced appv-sequencingBriforum2012 advanced appv-sequencing
Briforum2012 advanced appv-sequencing
 
Monitoring as Code: Getting to Monitoring-Driven Development - DEV314 - re:In...
Monitoring as Code: Getting to Monitoring-Driven Development - DEV314 - re:In...Monitoring as Code: Getting to Monitoring-Driven Development - DEV314 - re:In...
Monitoring as Code: Getting to Monitoring-Driven Development - DEV314 - re:In...
 
Devops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShiftDevops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShift
 
3.6 modify process execution priorities v2
3.6 modify process execution priorities v23.6 modify process execution priorities v2
3.6 modify process execution priorities v2
 
Automating with NX-OS: Let's Get Started!
Automating with NX-OS: Let's Get Started!Automating with NX-OS: Let's Get Started!
Automating with NX-OS: Let's Get Started!
 
Mesa and Its Debugging, Вадим Шовкопляс
Mesa and Its Debugging, Вадим ШовкоплясMesa and Its Debugging, Вадим Шовкопляс
Mesa and Its Debugging, Вадим Шовкопляс
 
Linux Cluster Job Management Systems (SGE)
Linux Cluster Job Management Systems (SGE)Linux Cluster Job Management Systems (SGE)
Linux Cluster Job Management Systems (SGE)
 
Avoid the Vendor Lock-in Trap (with App Deployment)
Avoid the Vendor Lock-in Trap (with App Deployment)Avoid the Vendor Lock-in Trap (with App Deployment)
Avoid the Vendor Lock-in Trap (with App Deployment)
 

Último

CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
anilsa9823
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
ellan12
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
soniya singh
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
soniya singh
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
soniya singh
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
imonikaupta
 

Último (20)

CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 

Functional and scale performance tests using zopkio

  • 1. Functional and scale performance tests using zopkio {‘Event’: ‘PyCON HK 2015’, ‘Name’: ‘Marcelo Araujo’, ‘Email’: ‘marcelo@gandi.net’
  • 2. Agenda ● About me. ● Why we test software? ● Zopkio test framework. ● Q&A. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net>
  • 3. About me PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> ● Name: Marcelo Araujo. ● Bachelor in Computer System Networking and Telecommunications. ● Post-Degree in Quality on Software Engineering. ● Python consumer since 2007. ● FreeBSD Developer since 2007 (ports and *kernel). ● DevOps at Gandi since 2015. From To
  • 4. Why we test software? PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> ● Assure what we created does what it supposed to do. ● The behavior with one user could be different with thousand users. ● Users could do something unexpected or not planned. ● Many different devices, browsers, operating systems and so forth. ● We want assure a good software quality. ● Validation: Are we doing the right job? ● Verification: Are we doing the job right?
  • 5. A typical application infra. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> App Server Database Your application starts like this!
  • 6. Then, becomes like this. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> App Server Master DB Slave DB Cache Storage Balancer/Proxy API Servers Storage Replication VMs Services
  • 7. A question! PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> As a DevOps, It is not only about test software anymore! How can I test the infrastructure?
  • 8. Zopkio test framework. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> ● Made by Linkedin. ● It is a test framework built to support at scale performance and functional testing. ● It can be installed via pip. ● Latest code at: https://github.com/linkedin/Zopkio ● There is documentation. ● Enough pydoc for every each class. ● They have some examples of code. ● Under Apache 2.0 License. ● They are open for pull requests. ● Active development.
  • 9. Zopkio test framework. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> ● Zopkio provides the ability to write tests that combine performance and functional testing across a distributed system. ● Writing tests using Zopkio should be nearly as simple as writing tests in xUnit or Nose. ● Zopkio strongly depends on: ○ Naarad: A system analysis tool that parses and plots time series data. ○ Paramiko: Python implementation of SSHv2 protocol.
  • 10. Zopkio test framework. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> ● What kind of tests can we perform with zopkio? ○ Functional. ■ Ensure every function produces its expected outcome. ○ Load. ■ Understand the behaviour under a specific and expected load. ○ Stress. ■ What is the behaviour beyond the normal expected load. ○ Performance. ■ Determine the speed or effectiveness of an software or service.
  • 11. Zopkio test framework. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> ● What we need from a functional and performance test framework? ○ ASSERT: Must be able to test a condition! ○ Get data vs time and compare with what we expected. ○ Plot graphs! ○ Provisioning before run any test. ○ Parallelize tests. ○ Control the sequence of tests. ○ Collect logs. ○ Parse logs. ○ Cleanup environment after tests. ○ An interface with test result. ○ Be able to debug! Our test is a software too.
  • 12. My PYHK test lab. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> bare-metal machine FreeBSD OS Hypervisor Type 2 (bhyve) VM1 (BSD) VM2 (BSD) VM3 (Linux) VM4 (BSD) Zopkio Switch Server
  • 13. What tests I will perform in this lab? PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> ● VM1 and VM2: Check how many files inside /etc/ and apply an ASSERT. ● VM1 and VM2: ICMP to example.com and check the lantency. ● VM3 and VM4: TCP Server/Client and make a connection between them.
  • 14. The basic of Zopkio. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> . |-- deployment.py |-- naarad.cfg |-- perf.py |-- run.py |-- test_suites | |-- connection.py | |-- machine1_etc.py | |-- machine1_ping.py | |-- machine2_etc.py | `-- machine2_ping.py |-- configs | `-- pyhk.json |-- scripts | |-- ping-csv.sh | |-- run.sh | |-- server.py | |-- client.py | `-- scripts.tar ● A test suite consists of: ○ A deployment file. ○ A dynamic configuration file. ○ One or more test files. ○ A config directory.
  • 15. The Zopkio framework. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> ● Zopkio has a main script that takes several optional arguments: ○ Run only named tests to help debug broken tests. ○ Configs overrides at execution time. ○ Log level. ○ Console log level. ● To run my test suite: araujo@coxinha:/z/hk# zopkio run.py --nopassword --log-level DEBUG
  • 16. Main run. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> 1 +-- 2 lines: import os------------------------------------------------------------------ 3 test = { 4 "deployment_code": os.path.join( 5 os.path.dirname( 6 os.path.abspath(__file__)), "deployment.py"), 7 "test_code": [ 8 os.path.join( 9 os.path.dirname( 10 os.path.abspath(__file__)), "test_suites/machine1_etc.py"), 11 os.path.join( 12 os.path.dirname( 13 os.path.abspath(__file__)), "test_suites/machine1_ping.py"), 14 os.path.join( 15 os.path.dirname( 16 os.path.abspath(__file__)), "test_suites/connection.py"), 17 os.path.join( 18 os.path.dirname( 19 os.path.abspath(__file__)), "test_suites/machine2_ping.py"), 20 os.path.join( 21 os.path.dirname( 22 os.path.abspath(__file__)), "test_suites/machine2_etc.py")], . |-- run.py 23 "perf_code": os.path.join( 24 os.path.dirname(os.path.abspath(__file__)), "perf.py"), 25 "configs_directory": os.path.join( 26 os.path.dirname(os.path.abspath(__file__)), "configs/") 27 }
  • 17. The config file. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> 1 { 2 "comment": "This is the first test", 3 "tip": "How many files on my /etc", 4 "pyhk_install": "/tmp/pyhk/", 5 "pyhk_exec": "scripts/scripts.tar", 6 "pyhk_cmd": "sh run.sh", 7 "ping_cmd": "bash ping-csv.sh --add-timestamp example.com >/tmp/pyhk/ping-output.csv", 8 "tcp_server_cmd": "python server.py &", 9 "tcp_client_cmd": "python client.py >connection.log", 10 "show_all_interations":true, 11 "verify_after_each_test":true, 12 "pyhk_hostname1": "10.0.1.22", 13 "pyhk_hostname2": "10.0.1.12" 14 } |-- configs | `-- pyhk.json
  • 18. The dynamic config. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> 1 +-- 4 lines: !/usr/bin/env python----------------------------------------------- 5 LOGS_DIRECTORY = "/tmp/pyhk/collected_logs/" 6 OUTPUT_DIRECTORY = "/tmp/pyhk/results/" 7 +-- 2 lines: -------------------------------------------------------------------------- 9 def machine_logs(): 10 return { 11 "client1": [os.path.join("/tmp/pyhk/", "connection.log")], 12 "machine1": [os.path.join("/tmp/pyhk/", "run.log")], 13 "machine2": [os.path.join("/tmp/pyhk/", "run.log")], 14 } 15 +-- 2 lines: -------------------------------------------------------------------------- 17 def naarad_logs(): 18 return { 19 "machine1": [os.path.join("/tmp/pyhk/", "run.csv")], 20 "machine2": [os.path.join("/tmp/pyhk/", "run.csv")], 21 "machine1": [os.path.join("/tmp/pyhk/", "ping-output.csv")], 22 "machine2": [os.path.join("/tmp/pyhk/", "ping-output.csv")], 23 } 24 +-- 2 lines: ----------------------------------------------------------------------------- 26 def naarad_config(): 27 return os.path.join( 28 os.path.dirname(os.path.abspath(__file__)), "naarad.cfg") . |-- perf.py
  • 19. The deployment file. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> ● It is in charge of provisioning machines. ● A deployment file can contain four functions: ○ setup_suite() - Will run before any of tests. ○ setup() - Will run before each test. ○ teardown() - Will run if setup() ran successfully. ○ teardown_suite() - Will run if setup_suite() ran successfully.
  • 20. The deployer. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> 1 +-- 3 lines: !/usr/bin/env python------------------------------------------------------------------------------- 4 import zopkio.adhoc_deployer as adhoc_deployer 5 import zopkio.runtime as runtime 6 +-- 6 lines: pyhk_deployer = None-------------------------------------------------------------------------- 12 def setup_suite(): 13 +-- 2 lines: print "==> Starting tests for PYHK."--------------------------------------------------------- 15 runtime.set_user('root', '') 16 +-- 4 lines: global pyhk_deployer--------------------------------------------------------------------------- 20 tcp_server = adhoc_deployer.SSHDeployer( 21 "server", 22 {'executable': runtime.get_active_config('pyhk_exec'), 23 'extract': True, 24 'start_command': runtime.get_active_config('tcp_server_cmd'), 25 'stop_command': "ps ax | grep '[p]ython server' | awk '{print $1}' | xargs kill -9"}) 26 runtime.set_deployer("server", tcp_server) 27 28 tcp_server.install("server1", 29 {"hostname": "10.0.1.23", 30 "install_path": runtime.get_active_config('pyhk_install')}) 31 32 tcp_client = adhoc_deployer.SSHDeployer( 33 "client", 34 {'executable': runtime.get_active_config('pyhk_exec'), 35 'extract': True, 36 'start_command': runtime.get_active_config('tcp_client_cmd')}) 37 runtime.set_deployer("client", tcp_client) 38 39 tcp_client.install("client1", 40 {"hostname": "10.0.1.24", 41 "install_path": runtime.get_active_config('pyhk_install')}) 42 +-- 20 lines: pyhk_deployer = adhoc_deployer.SSHDeployer(-------- 62 def setup(): 63 for process in tcp_server.get_processes(): 64 tcp_server.start(process.unique_id) 65 66 def teardown_suite(): 67 for process in tcp_server.get_processes(): 68 tcp_server.undeploy(process.unique_id) . |-- deployment.py
  • 21. An test file. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> 1 +-- 6 lines: !/usr/bin/env python----------------------------------------------- 7 import zopkio.runtime as runtime 8 import zopkio.test_utils as testutilities 9 10 test_phase = 3 11 +-- 2 lines: ------------------------------------------------------------------------ 13 def test_ping_host1(): 14 print "==> ping example.com (machine1)" 15 pyhk_deployer = runtime.get_deployer("pyhk") 16 17 pyhk_deployer.start( 18 "machine1", 19 configs={ 20 "start_command": runtime.get_active_config('ping_cmd'), 21 "sync": True 22 }) 23 +-- 2 lines: ------------------------------------------------------------------------ 25 def validate_ping_host1(): 26 ''' 27 Send 10 icmp to example.com . 28 ''' 29 hostname1_log_file = os.path.join( 30 perf.LOGS_DIRECTORY, "machine1-ping-output.csv") 31 hostname1_logs = testutilities.get_log_for_test( 32 "test_ping_host1", hostname1_log_file, "12:00:00") 33 34 # Number of icmp packages 35 size_p = len(hostname1_logs.split(',')) / 2 36 37 assert size_p == 10, "Less than 10 replies on host1" |-- test_suites | |-- machine1_ping.py
  • 22. Plot graphs. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> 1 [machine1-icmp] 2 infile=/tmp/pyhk/collected_logs/machine1-ping-output.csv 3 columns=sequence latency 4 sep=, 5 qps.sla=mean<500 6 latency.sla=mean<400 p50<300 7 8 [machine2-icmp] 9 infile=/tmp/pyhk/collected_logs/machine2-ping-output.csv 10 columns=sequence latency 11 sep=, 12 13 [GRAPH] 14 graphs=machine1-icmp.sequence,machine1-icmp.latency machine2-icmp.sequence,machine2-icmp.latency . |-- naarad.cfg
  • 23. The Zopkio GUI. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> Let's take a look on my machine
  • 24. The conclusion is: PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> We need to be able to test the infrastructure where I will run my application.
  • 25. References. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> ● Zopkio: ○ https://github.com/linkedin/Zopkio ● Naarad: ○ https://github.com/linkedin/naarad/ ● Code for PYHK Test Lab: ○ https://github.com/araujobsd/pyhk2015 ● Slides at: ○ TBD
  • 26. PyCON HK 2015 Marcelo Araujo <marcelo@gandi.net> Thank you! marcelo@gandi.net araujo@FreeBSD.org