datadog-sdk-testing 0.3.5 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e0957ec1ab90ffa2d0b2e4f938aed85e5563d540
4
- data.tar.gz: 3d0a1e845a3f006147da1ecef07f0193e745d100
3
+ metadata.gz: 1dbcb876f12226953cfd40552353143786fe5340
4
+ data.tar.gz: 1ad1ebf6250fa3800f6f1ef39ed8e16770066418
5
5
  SHA512:
6
- metadata.gz: 5bd2c467277e9553d778d7d9277696fcf951e6fd3900e02df8a0c1aba9da42d0d7d297e394a0b89be49fca01a2dbba5bd7bdaf23fa555a6442069f56ca5f4166
7
- data.tar.gz: e3bcfb854c2e75e5c3e4ff279e1d20438202e390c7c0cf7f2c373b4220742f6a3f3c11142eb0e13c13b7b12c77c92cc0d631dde2a8526639d3e8cba3f507d7ce
6
+ metadata.gz: 2842c7e5d3fdba3816459ab7e52ff0007d62574a31edad78cc27524179189c8c17ed55468094682b94575862641431a7d6ca7c6ff353dd49109ec9dcfd0842c3
7
+ data.tar.gz: 1f4945e8f040660bde75e5269b1c1978c568146c23686c3fa6a0fbd59a3ad6b08a3c785c6518800ba1fad9311dd9695c1b97bc9cd619487eb5bdb6a80ebb6bc7
@@ -15,11 +15,13 @@ def travis_circle_env
15
15
  abort 'You are not in a Travis/Circle CI environment, this task wont apply.' if !ENV['TRAVIS'] && !ENV['CIRCLECI']
16
16
  end
17
17
 
18
- def sed(source, a, b, mods)
18
+ def sed(source, op, a, b, mods)
19
+ cmd = "#{op}/#{a}"
20
+ cmd = "#{cmd}/#{b}" unless b.nil? || b.empty?
19
21
  if RUBY_PLATFORM.include? 'darwin'
20
- sh "sed -i '' \"s/#{a}/#{b}/#{mods}\" #{source}"
22
+ sh "sed -i '' \"#{cmd}/#{mods}\" #{source}"
21
23
  else
22
- sh "sed -i \"s/#{a}/#{b}/#{mods}\" #{source}"
24
+ sh "sed -i \"#{cmd}/#{mods}\" #{source}"
23
25
  end
24
26
  end
25
27
 
@@ -28,6 +30,25 @@ def sleep_for(secs)
28
30
  sleep(secs)
29
31
  end
30
32
 
33
+ def wait_on_docker_logs(c_name, max_wait, *include_array)
34
+ count = 0
35
+ logs = `docker logs #{c_name} 2>&1`
36
+ puts "Waiting for #{c_name} to come up"
37
+
38
+ until count == max_wait || include_array.any? { |phrase| logs.include?(phrase) }
39
+ sleep(1)
40
+ logs = `docker logs #{c_name} 2>&1`
41
+ count += 1
42
+ end
43
+
44
+ if include_array.any? { |phrase| logs.include?(phrase) }
45
+ puts "#{c_name} is up!"
46
+ else
47
+ sh %(docker logs #{c_name} 2>&1)
48
+ raise
49
+ end
50
+ end
51
+
31
52
  def section(name)
32
53
  timestamp = Time.now.utc.iso8601
33
54
  puts ''
@@ -133,8 +154,8 @@ def rename_skeleton(integration)
133
154
  capitalized = integration.capitalize
134
155
  Dir.glob("#{ENV['SDK_HOME']}/#{integration}/**/*") do |f|
135
156
  if File.file?(f)
136
- sed(f, 'skeleton', integration.to_s, 'g')
137
- sed(f, 'Skeleton', capitalized.to_s, 'g')
157
+ sed(f, 's', 'skeleton', integration.to_s, 'g')
158
+ sed(f, 's', 'Skeleton', capitalized.to_s, 'g')
138
159
  end
139
160
  end
140
161
  end
@@ -52,6 +52,29 @@ task 'clean_env' do
52
52
  end
53
53
  end
54
54
 
55
+ desc 'Wipe integration'
56
+ task 'wipe', :option do |_, args|
57
+ flavor = args[:option] || false
58
+ abort "please specify an integration to remove" if not flavor
59
+ check_env
60
+ input = ''
61
+ print "Are you sure you want to remove the #{flavor} integration (y/n)? "
62
+ input = STDIN.gets.chomp
63
+ case input.upcase
64
+ when "Y"
65
+ `rm -rf #{ENV['SDK_HOME']}/#{flavor}` if File.directory?("#{ENV['SDK_HOME']}/#{flavor}")
66
+ `rm -rf #{ENV['SDK_HOME']}/ci/#{flavor}.rake` if File.exist?("#{ENV['SDK_HOME']}/ci/#{flavor}.rake")
67
+ puts "source and CI files."
68
+ # two searches on travis.yml because of BSD sed.
69
+ sed("#{ENV['SDK_HOME']}/.travis.yml", '', "=#{flavor}\\ ", '', 'd')
70
+ sed("#{ENV['SDK_HOME']}/.travis.yml", '', "=#{flavor}$", '', 'd')
71
+ sed("#{ENV['SDK_HOME']}/circle.yml", '', "\\[#{flavor}\\]", '', 'd')
72
+ `git rm -r #{flavor}`
73
+ when "N"
74
+ puts "aborting the task..."
75
+ end
76
+ end
77
+
55
78
  desc 'Setup git hooks'
56
79
  task 'setup_hooks' do
57
80
  check_env
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datadog-sdk-testing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaime Fullaondo