Skip to content

Commit

Permalink
fix display_state for lantern resource on failover
Browse files Browse the repository at this point in the history
  • Loading branch information
var77 committed Jun 19, 2024
1 parent ee6305f commit fc10de8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion model/lantern/lantern_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def label
end

def display_state
return "failover" if servers.find { _1.strand.label == "take_over" }
return "failover" if servers.find { _1.display_state == "failover" }
super || representative_server&.display_state || "unavailable"
end

Expand Down
2 changes: 1 addition & 1 deletion spec/model/lantern/lantern_resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
end

it "returns failover" do
expect(lantern_resource).to receive(:servers).and_return([instance_double(LanternServer, strand: instance_double(Strand, label: "take_over"))])
expect(lantern_resource).to receive(:servers).and_return([instance_double(LanternServer, display_state: "running", strand: instance_double(Strand, label: "wait")), instance_double(LanternServer, display_state: "failover", strand: instance_double(Strand, label: "take_over"))])
expect(lantern_resource.display_state).to eq("failover")
end

Expand Down

0 comments on commit fc10de8

Please sign in to comment.