analytics: stop sending analytics in tests
This commit is contained in:
parent
bdc22fe0c7
commit
10e3c522f7
@ -117,9 +117,8 @@ describe Utils::Analytics do
|
|||||||
ENV.delete("HOMEBREW_NO_ANALYTICS")
|
ENV.delete("HOMEBREW_NO_ANALYTICS")
|
||||||
ENV["HOMEBREW_ANALYTICS_DEBUG"] = "true"
|
ENV["HOMEBREW_ANALYTICS_DEBUG"] = "true"
|
||||||
ENV["HOMEBREW_ANALYTICS_ENABLE_INFLUX"] = "true"
|
ENV["HOMEBREW_ANALYTICS_ENABLE_INFLUX"] = "true"
|
||||||
expect do
|
expect(described_class).to receive(:defered_curl).once
|
||||||
described_class.report_influx(:install, action, true, developer: true, CI: true)
|
described_class.report_influx(:install, action, true, developer: true, CI: true)
|
||||||
end.to output(/--data-raw install,[a-zA-Z=,]*,action=formula_name\\ --head/).to_stdout
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -99,8 +99,13 @@ module Utils
|
|||||||
"--data-raw", "#{category},#{tags} count=1i #{Time.now.to_i}"
|
"--data-raw", "#{category},#{tags} count=1i #{Time.now.to_i}"
|
||||||
]
|
]
|
||||||
|
|
||||||
curl = Utils::Curl.curl_executable
|
|
||||||
url = "https://#{INFLUX_HOST}/api/v2/write?bucket=#{INFLUX_BUCKET}&precision=s"
|
url = "https://#{INFLUX_HOST}/api/v2/write?bucket=#{INFLUX_BUCKET}&precision=s"
|
||||||
|
defered_curl(url, args)
|
||||||
|
end
|
||||||
|
|
||||||
|
sig { params(url: String, args: T::Array[String]).void }
|
||||||
|
def defered_curl(url, args)
|
||||||
|
curl = Utils::Curl.curl_executable
|
||||||
if ENV["HOMEBREW_ANALYTICS_DEBUG"]
|
if ENV["HOMEBREW_ANALYTICS_DEBUG"]
|
||||||
puts "#{curl} #{args.join(" ")} \"#{url}\""
|
puts "#{curl} #{args.join(" ")} \"#{url}\""
|
||||||
puts Utils.popen_read(curl, *args, url)
|
puts Utils.popen_read(curl, *args, url)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user