`TestRoomCreate` fails if the underlying server fails to deserialise an integer room version instead of validating it

未關閉 適合新手
#952 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 2 天內回覆

還沒有人認領這個 Issue。

評估

難度
1/5
預估耗時
1-3 小時
新手友好度
78/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
go
領域
testing-qa

研究方向

失敗的斷言位於 apidoc_room_create_test.go 中 TestRoomCreate 的子測試 POST /createRoom rejects attempts to create rooms with numeric versions 裡。請閱讀該測試如何比對 errcode 鍵,以及同一檔案中其他拒絕案例如何接受替代錯誤碼。完成標準是:當伺服器對數字型的房間版本回傳 M_NOT_JSON 或 M_BAD_JSON 時,該子測試通過,然後重新執行測試以確認。

由索引模型根據 Issue 內容生成。

描述

If a /createRoom request fails to be deserialised into a strongly typed struct because the room version parameter expects a string, but is given an integer, the server will return M_NOT_JSON. However, TestRoomCreate/Parallel/POST_/createRoom_rejects_attempts_to_create_rooms_with_numeric_versions expects M_BAD_JSON instead, which requires that the deserialiser is allowed to ignore incorrect types.

  ❌ TestRoomCreate/Parallel/POST_/createRoom_rejects_attempts_to_create_rooms_with_numeric_versions (FAIL; 230ms)
    apidoc_room_create_test.go:195: MatchResponse key 'errcode' got 'M_NOT_JSON' (type string) want 'M_BAD_JSON' (type string) - http://127.0.0.1:33163/_matrix/client/v3/createRoom => {"errcode":"M_NOT_JSON","error":"failed to parse body as JSON: json: unable to unmarshal JSON number into Go id.RoomVersion within \"/room_version\""}

Accepting M_NOT_JSON and M_BAD_JSON would fix this.

主要語言
Go
星號
102
分支
73
平均合併
3 天 10 小時
30 天內合併 PR
6

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

matrix-org/complement 的其他 Issue

查看 matrix-org/complement 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。