Skip to content

Add tests for /make_knock and /send_knock (same as the join counterparts) for when the federation server is in the middle of a partial join#447

Merged
reivilibre merged 7 commits into
mainfrom
rei/frj_send_knock_during_partial_join
Sep 5, 2022
Merged

Add tests for /make_knock and /send_knock (same as the join counterparts) for when the federation server is in the middle of a partial join#447
reivilibre merged 7 commits into
mainfrom
rei/frj_send_knock_during_partial_join

Conversation

@reivilibre
Copy link
Copy Markdown
Contributor

@reivilibre reivilibre commented Aug 12, 2022

Fixes #445.

@reivilibre reivilibre force-pushed the rei/frj_send_knock_during_partial_join branch from ee3dc39 to 1098798 Compare August 18, 2022 16:37
@reivilibre reivilibre marked this pull request as ready for review August 18, 2022 16:38
@reivilibre reivilibre requested review from a team as code owners August 18, 2022 16:38
@reivilibre reivilibre force-pushed the rei/frj_send_knock_during_partial_join branch from 1098798 to d017259 Compare August 18, 2022 16:39
@reivilibre reivilibre force-pushed the rei/frj_send_knock_during_partial_join branch from d017259 to b196ba4 Compare August 18, 2022 16:54
@reivilibre reivilibre marked this pull request as draft August 19, 2022 11:57
@DMRobertson DMRobertson removed request for a team August 23, 2022 12:08
@DMRobertson
Copy link
Copy Markdown
Contributor

Taking this out of the review queue since it's been re-marked as draft.

@reivilibre reivilibre marked this pull request as ready for review September 1, 2022 13:46
@reivilibre reivilibre requested review from a team September 1, 2022 13:47
Copy link
Copy Markdown
Contributor

@DMRobertson DMRobertson left a comment

Choose a reason for hiding this comment

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

SGTM. (I'm guessing that other than the MakeRespMakeKnock and GMSL changes that this was largely a find-and-replace for join -> knock?

RoomVersion: room.Version,
KnockEvent: builder,
}
return
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are we implicitly returning resp, err here?

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.

yeah, I find this weird but Go supports this old-school Pascal-ish style of assigning to a result variable rather than returning, except the result variable's names are declared in the function declaration.
I nicked this from what was already there; it's 'not my choice' but it seems like this may be idiomatic


// daniel then tries to /send_knock via the homeserver under test
knockEvent, err := makeKnockResp.KnockEvent.Build(time.Now(), gomatrixserverlib.ServerName(testServer2.ServerName()), testServer2.KeyID, testServer2.Priv, makeKnockResp.RoomVersion)
must.NotError(t, "KnockEvent.Build", err)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this just shorthand for if err != nil { /* fail the test with given message */ } ?

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.

yeah, seems to be

// NotError will ensure `err` is nil else terminate the test with `msg`.
func NotError(t *testing.T, msg string, err error) {
	t.Helper()
	if err != nil {
		t.Fatalf("MustNotError: %s -> %s", msg, err)
	}
}

@reivilibre reivilibre merged commit e745939 into main Sep 5, 2022
@reivilibre reivilibre deleted the rei/frj_send_knock_during_partial_join branch September 5, 2022 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a test for /make_knock and /send_knock against a homeserver which is in the middle of a partial join.

2 participants