Go SDK: add unit tests for ClusterNodeStatus

Aperta Adatta ai principianti
#5,036 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à
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
86/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
testing

Direzione di ricerca

Leggi TryFrom, MarshalBinary, UnmarshalBinary e String in foreign/go/contracts/node_status.go, poi copia la struttura di compression_algorithm_test.go nella stessa cartella. Crea foreign/go/contracts/node_status_test.go nel package iggcon con un test a tabella sui byte da 0 a 5 e 255, round trip per gli stati validi e verifiche che uno slice vuoto e il byte 5 vengano rifiutati. È completato quando go test ./contracts/... e go vet ./... passano in foreign/go.

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

Descrizione

go good first issue test
Description

TryFrom, MarshalBinary, UnmarshalBinary and String in foreign/go/contracts/node_status.go have no test of their own. TryFrom accepts 0 to 4 (healthy, starting, stopping, unreachable, maintenance) and returns ierror.ErrInvalidCommand for anything else. That includes 5, the Unknown constant, which can be used in code but is not accepted off the wire. String returns a lowercase name for each valid status and unknown otherwise.

Affected area / component

Go SDK

Proposed solution

Add foreign/go/contracts/node_status_test.go in package iggcon, modelled on compression_algorithm_test.go in the same folder.

  • A table test over bytes 0 to 5 and 255 for TryFrom, checking the value or the error.
  • A round trip for each valid status through MarshalBinary and UnmarshalBinary.
  • Check that an empty slice and byte 5 are rejected by UnmarshalBinary.
  • Check each String output, including unknown.

How to test: go test ./contracts/... and go vet ./... pass in foreign/go.

Good first issue
  • I think this could be a good first issue for a new contributor
Lingua principale
Rust
Stelle
5.3k
Fork
548
Merge medio
2g 20h
PR unite (30g)
194

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

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 apache/iggy

Tutte le issue di apache/iggy

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.