This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
forked from DataDog/dd-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
executable file
·123 lines (109 loc) · 3.37 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/usr/bin/env rake
# encoding: utf-8
# 3p
require 'rake/clean'
require 'rubocop/rake_task'
# Flavored Travis CI jobs
require './ci/apache'
require './ci/activemq'
require './ci/cassandra'
require './ci/checks_mock'
require './ci/core_integration'
require './ci/couchdb'
require './ci/default'
require './ci/elasticsearch'
require './ci/etcd'
require './ci/fluentd'
require './ci/gearman'
require './ci/go_expvar'
require './ci/haproxy'
require './ci/kong'
require './ci/lighttpd'
require './ci/memcache'
require './ci/mongo'
require './ci/mysql'
require './ci/network'
require './ci/nginx'
require './ci/pgbouncer'
require './ci/phpfpm'
require './ci/postgres'
require './ci/powerdns_recursor'
require './ci/rabbitmq'
require './ci/redis'
require './ci/riak'
require './ci/snmpd'
require './ci/ssh'
require './ci/supervisord'
require './ci/sysstat'
require './ci/tokumx'
require './ci/tomcat'
require './ci/varnish'
require './ci/windows'
require './ci/zookeeper'
require './ci/docker_daemon'
CLOBBER.include '**/*.pyc'
# CI-like environment for local use
unless ENV['CI']
rakefile_dir = File.dirname(__FILE__)
ENV['TRAVIS_BUILD_DIR'] = rakefile_dir
ENV['INTEGRATIONS_DIR'] = File.join(rakefile_dir, 'embedded')
ENV['PIP_CACHE'] = File.join(rakefile_dir, '.cache/pip')
ENV['VOLATILE_DIR'] = '/tmp/dd-agent-testing'
ENV['CONCURRENCY'] = ENV['CONCURRENCY'] || '2'
ENV['NOSE_FILTER'] = 'not windows'
end
desc 'Setup a development environment for the Agent'
task 'setup_env' do
`mkdir -p venv`
`wget -O venv/virtualenv.py https://raw.github.com/pypa/virtualenv/1.11.6/virtualenv.py`
`python venv/virtualenv.py -p python2 --no-site-packages --no-pip --no-setuptools venv/`
`wget -O venv/ez_setup.py https://bootstrap.pypa.io/ez_setup.py`
`venv/bin/python venv/ez_setup.py --version="20.9.0"`
`wget -O venv/get-pip.py https://bootstrap.pypa.io/get-pip.py`
`venv/bin/python venv/get-pip.py`
`venv/bin/pip install -r requirements.txt`
`venv/bin/pip install -r requirements-test.txt`
# These deps are not really needed, so we ignore failures
ENV['PIP_COMMAND'] = 'venv/bin/pip'
`./utils/pip-allow-failures.sh requirements-opt.txt`
end
namespace :test do
desc 'Run dogstatsd tests'
task 'dogstatsd' do
sh 'nosetests tests/core/test_dogstatsd.py'
end
desc 'Run performance tests'
task 'performance' do
sh 'nosetests --with-xunit --xunit-file=nosetests-performance.xml tests/core/benchmark*.py'
end
desc 'cProfile unit tests (requires \'nose-cprof\')'
task 'profile' do
sh 'nosetests --with-cprofile tests/core/benchmark*.py'
end
desc 'cProfile tests, then run pstats'
task 'profile:pstats' => ['test:profile'] do
sh 'python -m pstats stats.dat'
end
desc 'Display test coverage for checks'
task 'coverage' => 'ci:default:coverage'
end
RuboCop::RakeTask.new(:rubocop) do |t|
t.patterns = ['ci/**/*.rb', 'Gemfile', 'Rakefile']
end
desc 'Lint the code through pylint'
task 'lint' => ['ci:default:lint'] do
end
desc 'Run the Agent locally'
task 'run' do
sh('supervisord -n -c supervisord.dev.conf')
end
namespace :ci do
desc 'Run integration tests'
task :run, :flavor do |_, args|
puts 'Assuming you are running these tests locally' unless ENV['TRAVIS']
flavor = args[:flavor] || ENV['TRAVIS_FLAVOR'] || 'default'
flavors = flavor.split(',')
flavors.each { |f| Rake::Task["ci:#{f}:execute"].invoke }
end
end
task default: ['lint', 'ci:run']