Skip to content

Commit

Permalink
Add mgmt manifest to API tests
Browse files Browse the repository at this point in the history
  • Loading branch information
satterly committed Apr 9, 2024
1 parent 2a246f8 commit 012f063
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 34 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ contrib/kubernetes/helm/alerta/charts
.idea/*

/.bundle/

/venv/
74 changes: 40 additions & 34 deletions tests/spec/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,44 +26,50 @@
expect(JSON.parse(result.body)['provider']).to eq("basic")
end
end
context "/management" do
context "get properties" do
result = Client.get "#{GATEWAY_BASE_URL}/management/properties", {'x-api-key' => 'demo-key'}
it "return 200" do
expect(result.code).to eq(200)
end
it "X-Forwarded-For header is set" do
expect(result.body).to include("X-Forwarded-For")
end
end
context "/management" do
context "get manifest" do
result = Client.get "#{GATEWAY_BASE_URL}/management/manifest", {'x-api-key' => 'demo-key'}
it "return 200" do
expect(result.code).to eq(200)
end
end
context "get properties" do
result = Client.get "#{GATEWAY_BASE_URL}/management/properties", {'x-api-key' => 'demo-key'}
it "return 200" do
expect(result.code).to eq(200)
end
it "X-Forwarded-For header is set" do
expect(result.body).to include("X-Forwarded-For")
end
end
context "get healthcheck" do
result = Client.get "#{GATEWAY_BASE_URL}/management/gtg"
it "return 200" do
expect(result.code).to eq(200)
end
it "good-to-go is OK" do
expect(result.body).to eq("OK")
end
it "response header does not contain nginx version" do
expect(result.headers[:server]).to eq("nginx")
end
context "get healthcheck" do
result = Client.get "#{GATEWAY_BASE_URL}/management/gtg"
it "return 200" do
expect(result.code).to eq(200)
end
it "good-to-go is OK" do
expect(result.body).to eq("OK")
end
it "response header does not contain nginx version" do
expect(result.headers[:server]).to eq("nginx")
end
end
end
context "/alerts" do
context "get without auth" do
result = Client.get "#{GATEWAY_BASE_URL}/alerts"
it "return 401" do
expect(result.code).to eq(401)
end
end
context "/alerts" do
context "get without auth" do
result = Client.get "#{GATEWAY_BASE_URL}/alerts"
it "return 401" do
expect(result.code).to eq(401)
end
context "get" do
result = Client.get "#{GATEWAY_BASE_URL}/alerts?api-key=demo-key"
it "return 200" do
expect(result.code).to eq(200)
end
context "get" do
result = Client.get "#{GATEWAY_BASE_URL}/alerts?api-key=demo-key"
it "return 200" do
expect(result.code).to eq(200)
end
it "total is 0" do
expect(JSON.parse(result.body)['total']).to eq(0)
end
it "total is 0" do
expect(JSON.parse(result.body)['total']).to eq(0)
end
end
end
Expand Down

0 comments on commit 012f063

Please sign in to comment.