Skip to content

Stop testing unspecced POST /send#850

Open
tulir wants to merge 8 commits intomatrix-org:mainfrom
tulir:tulir/delete-unspecced-send
Open

Stop testing unspecced POST /send#850
tulir wants to merge 8 commits intomatrix-org:mainfrom
tulir:tulir/delete-unspecced-send

Conversation

@tulir
Copy link
Member

@tulir tulir commented Mar 13, 2026

Signed-off-by: Tulir Asokan <tulir@maunium.net>
@tulir
Copy link
Member Author

tulir commented Mar 14, 2026

Not sure what that test failure is 🤔

@anoadragon453
Copy link
Member

Not sure what that test failure is 🤔

panic: BUG: Empty package name encountered. will occur when gotestfmt receives an error and isn't able to parse the output. Try temporarily removing | .ci/scripts/gotestfmt from the following line in CI:

${{ matrix.env }} go test -v -json -tags "${{ matrix.tags }}" -timeout "${{ matrix.timeout }}" ./tests ./tests/csapi ${{ matrix.packages }} | .ci/scripts/gotestfmt

(I fixed this in a repo somewhere to prevent this obtuse error from shadowing the real one, but currently failing to find it or the solution...)

- run: |
set -o pipefail &&
${{ matrix.env }} go test -v -json -tags "${{ matrix.tags }}" -timeout "${{ matrix.timeout }}" ./tests ./tests/csapi ${{ matrix.packages }} | .ci/scripts/gotestfmt
${{ matrix.env }} go test -v -json -tags "${{ matrix.tags }}" -timeout "${{ matrix.timeout }}" ./tests ./tests/csapi ${{ matrix.packages }} # | .ci/scripts/gotestfmt
Copy link
Collaborator

Choose a reason for hiding this comment

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

panic: BUG: Empty package name encountered. will occur when gotestfmt receives an error and isn't able to parse the output. Try temporarily removing | .ci/scripts/gotestfmt from the following line in CI:

-- @anoadragon453, #850 (comment)

We did this in Synapse for example, element-hq/synapse#19326

@tulir
Copy link
Member Author

tulir commented Mar 17, 2026

It was just a compile error, tests should pass now

for _, testCase := range testCases {
res := alice.Do(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "send", "complement.dummy"}, client.WithJSONBody(t, testCase))
for i, testCase := range testCases {
res := alice.Do(t, "PUT", []string{"_matrix", "client", "v3", "rooms", roomID, "send", "complement.dummy", fmt.Sprintf("invalidnum-%d", i)}, client.WithJSONBody(t, testCase))
Copy link
Collaborator

Choose a reason for hiding this comment

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

for _, testCase := range testCases {
res := alice.Do(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "send", "complement.dummy"}, client.WithJSONBody(t, testCase))
for i, testCase := range testCases {
res := alice.Do(t, "PUT", []string{"_matrix", "client", "v3", "rooms", roomID, "send", "complement.dummy", fmt.Sprintf("invalidnum-%d", i)}, client.WithJSONBody(t, testCase))
Copy link
Collaborator

Choose a reason for hiding this comment

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

The "invalidnum" makes me think this a particular detail that matters. But it's actually the invalid number testCases above that matter.

Can we just use txn-xxx instead? I'm guessing we're just trying to namespace them to avoid tests colliding with each other. Perhaps we can just do this like we have in other tests:

var txnCounter int64 = 0
func getTxnID(prefix string) (txnID string) {
txnId := fmt.Sprintf("%s-%d", prefix, atomic.LoadInt64(&txnCounter))
atomic.AddInt64(&txnCounter, 1)
return txnId
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Extracted all the transaction ids (this one, the comment below and the old getTxnID) into a new method in the helpers package

)

// sytest: POST /rooms/:room_id/send/:event_type sends a message
// sytest: PUT /rooms/:room_id/send/:event_type/:txn_id sends a message
Copy link
Collaborator

Choose a reason for hiding this comment

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

The xxx part of sytest: xxx part might matter and need to match the name in Sytest?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Given this test is being removed in matrix-org/sytest#1419, I think we can just remove this comment entirely

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh right, there's already another test below for the transaction ID version

@tulir tulir requested a review from MadLittleMods March 17, 2026 22:15
Copy link
Collaborator

@MadLittleMods MadLittleMods left a comment

Choose a reason for hiding this comment

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

Looks good, just a few clean-up items

var txnCounter atomic.Int64
var start = time.Now().Unix()

func GetTxnID(prefix string) (txnID string) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should add a doc comment for what this does and is useful for

tulir added 2 commits March 18, 2026 17:33
The txn send endpoint is tested below, so TestSendAndFetchMessage is only
relevant for testing /messages
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.

3 participants