Skip to content

Commit

Permalink
Remove new fields from v1 clusters endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
arbulu89 committed Feb 20, 2024
1 parent d030807 commit 0ea275d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/trento_web/views/v1/cluster_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ defmodule TrentoWeb.V1.ClusterView do
defp adapt_v1(%{type: type, details: %{nodes: nodes} = details} = cluster)
when type in [:hana_scale_up, :hana_scale_out] do
adapted_nodes =
Enum.map(nodes, &Map.drop(&1, [:indexserver_actual_role, :nameserver_actual_role]))
Enum.map(nodes, &Map.drop(&1, [:indexserver_actual_role, :nameserver_actual_role, :status]))

adapted_details =
details
Expand Down
2 changes: 2 additions & 0 deletions test/support/factory.ex
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ defmodule Trento.Factory do
def hana_cluster_node_factory do
%HanaClusterNode{
attributes: %{"attribute" => Faker.Beer.name()},
status: "Online",
hana_status: "Secondary",
virtual_ip: Faker.Internet.ip_v4_address(),
name: Faker.StarWars.character(),
Expand All @@ -485,6 +486,7 @@ defmodule Trento.Factory do
roles: [Enum.random(["ascs", "ers"])],
virtual_ips: [Faker.Internet.ip_v4_address()],
filesystems: [Faker.File.file_name()],
status: "Online",
attributes: %{
Faker.Pokemon.name() => Faker.Pokemon.name()
},
Expand Down
4 changes: 3 additions & 1 deletion test/trento_web/views/v1/cluster_view_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ defmodule TrentoWeb.V1.ClusterViewTest do
Enum.map(
build_list(1, :hana_cluster_node, %{
nameserver_actual_role: "master",
indexserver_actual_role: "master"
indexserver_actual_role: "master",
status: "Online"
}),
&Map.from_struct(&1)
)
Expand All @@ -38,6 +39,7 @@ defmodule TrentoWeb.V1.ClusterViewTest do
refute Access.get(details, :maintenance_mode)
refute Access.get(node, :nameserver_actual_role)
refute Access.get(node, :indexserver_actual_role)
refute Access.get(node, :status)
end
end
end

0 comments on commit 0ea275d

Please sign in to comment.