-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix display state of PostgreSQL resources
We used to just check the label of PostgresResource's own strand. However, the state of representative server is also important, especially at the time of it being unavailable. This commit fixes the display state of PostgreSQL resources by checking the state of the representative server as well. While doing so, I found another case of wrong display state, while refreshing the dns records, which is also fixed in this commit.
- Loading branch information
Showing
4 changed files
with
25 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,18 +36,18 @@ | |
expect(s).to include("[email protected]", "application_name=pgubidstandby", "sslcert=/dat/16/data/server.crt") | ||
end | ||
|
||
it "returns running as display state if the database is ready" do | ||
it "returns display state correctly" do | ||
expect(postgres_resource).to receive(:representative_server).and_return(instance_double(PostgresServer, strand: instance_double(Strand, label: "unavailable"))) | ||
expect(postgres_resource.display_state).to eq("unavailable") | ||
|
||
expect(postgres_resource).to receive(:representative_server).and_return(instance_double(PostgresServer, strand: instance_double(Strand, label: "wait"))).at_least(:once) | ||
expect(postgres_resource).to receive(:strand).and_return(instance_double(Strand, label: "wait")) | ||
expect(postgres_resource.display_state).to eq("running") | ||
end | ||
|
||
it "returns deleting as display state if the database is being destroyed" do | ||
expect(postgres_resource).to receive(:strand).and_return(instance_double(Strand, label: "destroy")).twice | ||
expect(postgres_resource).to receive(:strand).and_return(instance_double(Strand, label: "destroy")).exactly(3).times | ||
expect(postgres_resource.display_state).to eq("deleting") | ||
end | ||
|
||
it "returns creating as display state for other cases" do | ||
expect(postgres_resource).to receive(:strand).and_return(instance_double(Strand, label: "wait_server")).twice | ||
expect(postgres_resource).to receive(:strand).and_return(instance_double(Strand, label: "wait_server")).exactly(3).times | ||
expect(postgres_resource.display_state).to eq("creating") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters