diff --git a/Formula/h/heartbeat.rb b/Formula/h/heartbeat.rb index 9bde5c12f6403..9cdc7680ca776 100644 --- a/Formula/h/heartbeat.rb +++ b/Formula/h/heartbeat.rb @@ -2,18 +2,18 @@ class Heartbeat < Formula desc "Lightweight Shipper for Uptime Monitoring" homepage "https://www.elastic.co/beats/heartbeat" url "https://github.com/elastic/beats.git", - tag: "v8.16.1", - revision: "f17e0828f1de9f1a256d3f520324fa6da53daee5" + tag: "v8.17.0", + revision: "092f0eae4d0d343cc3a142f671c2a0428df67840" license "Apache-2.0" head "https://github.com/elastic/beats.git", branch: "master" bottle do - sha256 cellar: :any_skip_relocation, arm64_sequoia: "93e49e150068211d119d50cbdb2e3255577baab17aca54dc5d90a3d09d4a2a44" - sha256 cellar: :any_skip_relocation, arm64_sonoma: "9d525150a84d361b47e95bce1e1b500369123d3308dd7afdc3e2b65159efac62" - sha256 cellar: :any_skip_relocation, arm64_ventura: "3c5a05d73598c196ea751f4deddd2516c4aabed14817d3f2dc3f5f5194cb7a2e" - sha256 cellar: :any_skip_relocation, sonoma: "547a9c35882c778f90064e17503aabbbd2505659fa977e48e6944e0c93771b2c" - sha256 cellar: :any_skip_relocation, ventura: "0dc43ab97b35d318e45dba69da2da09227ce859ddd812d08bb451fd81f5406e0" - sha256 cellar: :any_skip_relocation, x86_64_linux: "babda51cefce2ae2039118dd801c9b457f634163a548bd2d8be6c4afead07cfe" + sha256 cellar: :any_skip_relocation, arm64_sequoia: "b8e753ec2d5880405874e61abb16bf6e5e87487f3a258221c1970958b4505e8e" + sha256 cellar: :any_skip_relocation, arm64_sonoma: "ef5c6cf2eab88ef9df06a4ef21a033622773509d7b7df3f41eef9661cce84d6a" + sha256 cellar: :any_skip_relocation, arm64_ventura: "c5435c9222244b883d9fce1585f92917b1f180873d6796ee1d326dab2ea538dc" + sha256 cellar: :any_skip_relocation, sonoma: "0011afb9fc0674b9228e06670797ec9dd900aff9afc7b6b8e7db00f90bdd27d5" + sha256 cellar: :any_skip_relocation, ventura: "5a7b3d88df68366869d274e04a0d402e56c3b5473d8ceaea2b457faed6fde483" + sha256 cellar: :any_skip_relocation, x86_64_linux: "5f25e3043fb84fb08e390055bdb44ed2c6efd7d0899affe519b8edcb47158e20" end depends_on "go" => :build @@ -65,35 +65,39 @@ def post_install # https://github.com/Homebrew/homebrew-core/pull/91712 return if OS.linux? && ENV["HOMEBREW_GITHUB_ACTIONS"].present? - port = free_port - - (testpath/"config/heartbeat.yml").write <<~YAML - heartbeat.monitors: - - type: tcp - schedule: '@every 5s' - hosts: ["localhost:#{port}"] - check.send: "hello\\n" - check.receive: "goodbye\\n" - output.file: - path: "#{testpath}/heartbeat" - filename: heartbeat - codec.format: - string: '%{[monitor]}' - YAML - fork do - exec bin/"heartbeat", "-path.config", testpath/"config", "-path.data", - testpath/"data" - end - sleep 5 - assert_match "hello", pipe_output("nc -l #{port}", "goodbye\n", 0) + begin + port = free_port + + (testpath/"config/heartbeat.yml").write <<~YAML + heartbeat.monitors: + - type: tcp + schedule: '@every 5s' + hosts: ["localhost:#{port}"] + check.send: "hello\\n" + check.receive: "goodbye\\n" + output.file: + path: "#{testpath}/heartbeat" + filename: heartbeat + codec.format: + string: '%{[monitor]}' + YAML + + pid = spawn bin/"heartbeat", "--path.config", testpath/"config", "--path.data", testpath/"data" + sleep 5 + sleep 5 if OS.mac? && Hardware::CPU.intel? + assert_match "hello", pipe_output("nc -l #{port}", "goodbye\n", 0) + sleep 5 - sleep 5 - output = JSON.parse((testpath/"data/meta.json").read) - assert_includes output, "first_start" + output = JSON.parse((testpath/"data/meta.json").read) + assert_includes output, "first_start" - (testpath/"data").glob("heartbeat-*.ndjson") do |file| - s = JSON.parse(file.read) - assert_match "up", s["status"] + (testpath/"data").glob("heartbeat-*.ndjson") do |file| + s = JSON.parse(file.read) + assert_match "up", s["status"] + end + ensure + Process.kill("TERM", pid) + Process.wait(pid) end end end