cortex 1.14.0
* cortex 1.14.0 * cortex: update build * cortex: fix test It turned out 3 seconds was too short for `cortex` to finish initialization. * cortex: fix test This should do it. The sample config uses S3, which is not good. Let's try extracting a minimal working config from that. And with that, we may be able to reduce the sleep time as well. * cortex: refactor test This ensures that we do not finish the test too early, in which case errors may be shadowed. This must have happened in previous CI runs because the config was erroneous. Closes #117669. Signed-off-by: Rui Chen <rui@chenrui.dev> Co-authored-by: Rui Chen <rui@chenrui.dev> Signed-off-by: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>master
parent
3c89f36773
commit
58b7d8dd07
|
@ -1,8 +1,8 @@
|
|||
class Cortex < Formula
|
||||
desc "Long term storage for Prometheus"
|
||||
homepage "https://cortexmetrics.io/"
|
||||
url "https://github.com/cortexproject/cortex/archive/v1.13.1.tar.gz"
|
||||
sha256 "aa742a608c8201fcca41061cd2264d1b8eebe61c22259a5289de3a226aeee7e3"
|
||||
url "https://github.com/cortexproject/cortex/archive/v1.14.0.tar.gz"
|
||||
sha256 "cb858658144679145ae8433f3c732ff7363e4ac1819c6fca373e2b9dd81f297a"
|
||||
license "Apache-2.0"
|
||||
|
||||
livecheck do
|
||||
|
@ -24,10 +24,10 @@ class Cortex < Formula
|
|||
depends_on "go" => :build
|
||||
|
||||
def install
|
||||
system "go", "build", *std_go_args, "./cmd/cortex"
|
||||
cd "docs/chunks-storage" do
|
||||
inreplace "single-process-config.yaml", "/tmp", var
|
||||
etc.install "single-process-config.yaml" => "cortex.yaml"
|
||||
system "go", "build", *std_go_args(ldflags: "-s -w"), "./cmd/cortex"
|
||||
cd "docs/configuration" do
|
||||
inreplace "single-process-config-blocks.yaml", "/tmp", var
|
||||
etc.install "single-process-config-blocks.yaml" => "cortex.yaml"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -40,18 +40,45 @@ class Cortex < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
require "open3"
|
||||
require "timeout"
|
||||
|
||||
port = free_port
|
||||
|
||||
cp etc/"cortex.yaml", testpath
|
||||
inreplace "cortex.yaml" do |s|
|
||||
s.gsub! "9009", port.to_s
|
||||
s.gsub! var, testpath
|
||||
# A minimal working config modified from
|
||||
# https://github.com/cortexproject/cortex/blob/master/docs/configuration/single-process-config-blocks.yaml
|
||||
(testpath/"cortex.yaml").write <<~EOS
|
||||
server:
|
||||
http_listen_port: #{port}
|
||||
ingester:
|
||||
lifecycler:
|
||||
ring:
|
||||
kvstore:
|
||||
store: inmemory
|
||||
replication_factor: 1
|
||||
blocks_storage:
|
||||
backend: filesystem
|
||||
filesystem:
|
||||
dir: #{testpath}/data/tsdb
|
||||
EOS
|
||||
|
||||
Open3.popen3(
|
||||
bin/"cortex", "-config.file=cortex.yaml",
|
||||
"-server.grpc-listen-port=#{free_port}"
|
||||
) do |_, _, stderr, wait_thr|
|
||||
Timeout.timeout(5) do
|
||||
stderr.each do |line|
|
||||
refute line.start_with? "level=error"
|
||||
# It is important to wait for this line. Finishing the test too early
|
||||
# may shadow errors that only occur when modules are fully loaded.
|
||||
break if line.include? "Cortex started"
|
||||
end
|
||||
output = shell_output("curl -s http://localhost:#{port}/services")
|
||||
assert_match "Running", output
|
||||
end
|
||||
ensure
|
||||
Process.kill "TERM", wait_thr.pid
|
||||
Process.wait wait_thr.pid
|
||||
end
|
||||
|
||||
fork { exec bin/"cortex", "-config.file=cortex.yaml", "-server.grpc-listen-port=#{free_port}" }
|
||||
sleep 3
|
||||
|
||||
output = shell_output("curl -s localhost:#{port}/services")
|
||||
assert_match "Running", output
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue