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

Aperta Adatta ai principianti
#952 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
testing-qa

Direzione di ricerca

L'asserzione che fallisce si trova nel subtest POST /createRoom rejects attempts to create rooms with numeric versions di TestRoomCreate, in apidoc_room_create_test.go. Leggi come quel test confronta la chiave errcode e come gli altri casi di rifiuto dello stesso file accettano codici alternativi. Il lavoro è completato quando il subtest passa con il server che restituisce M_NOT_JSON oppure M_BAD_JSON per una versione numerica della stanza, e il test viene eseguito di nuovo per confermarlo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Go
Stelle
101
Fork
73
Merge medio
1g 2h
PR unite (30g)
3

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di matrix-org/complement

Tutte le issue di matrix-org/complement

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.