Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .daily_canary
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Just want to be making daily records
Just want to be making daily records.
7 changes: 5 additions & 2 deletions tests/infra/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,14 +695,17 @@ def find_primary(self, timeout=3, log_capture=None):
try:
logs = []
res = c.get("/node/network", log_capture=logs)
if res.status_code != 200:
continue
assert res.status_code == http.HTTPStatus.OK.value, res

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The /node/network endpoint isn't guaranteed to return 200 but at this stage, we only loop through nodes that have joined the service so this assert is actually safe.


body = res.body.json()
view = body["current_view"]
if "primary_id" not in body:
continue

view_change_in_progress = body["view_change_in_progress"]
primary_id = body["primary_id"]
if primary_id is not None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this if necessary? It looks like line 702 has already checked that "primary_id" is present, and then we've assigned it here. Or is it possible to have a "primary_id": null in the response object?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not now, but when @jumaffre and I talked about it, I suggested we should always have a primary_id and it should be set to null when it's unknown, rather than not have the key at all when we don't know which node is primary.

There's a more general point here about what do for optional fields in our JSON responses, we can talk about it.

@jumaffre jumaffre Mar 9, 2021

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's discuss (and agree on) this separately. I'll merge this PR as it is as it is blocking other PRs and will address further changes in a follow-up PR.

break

except CCFConnectionException:
LOG.warning(
Expand Down