Node SDK: add unit tests for the cluster node and metadata deserialisers

Abierto Apto para principiantes
#5,033 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
85/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
nodejs, typescript
Área
testing

Línea de trabajo

Lee deserializeNode y deserializeMetadata en foreign/node/src/wire/cluster/cluster.utils.ts, y los valores de rol y estado en cluster.type.ts. Crea cluster.utils.test.ts junto a ellos, siguiendo el patrón de delete-topic.command.test.ts, con una función auxiliar que construya un buffer de nodo a partir de valores simples. Está terminado cuando los casos listados pasan con npm run test:unit y npm run lint pasa en foreign/node.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

good first issue javascript test
Description

deserializeNode and deserializeMetadata in foreign/node/src/wire/cluster/cluster.utils.ts have no unit test. deserializeNode reads a replica id, a length-prefixed name and IP, four uint16 ports, a role byte and a status byte, and throws when the buffer is too short at any step. deserializeMetadata reads a cluster name and a list of nodes. This is separate from #4968 and #4969, which add bounds checks to the client and consumer group deserialisers.

Affected area / component

Node SDK

Proposed solution

Add foreign/node/src/wire/cluster/cluster.utils.test.ts, modelled on foreign/node/src/wire/topic/delete-topic.command.test.ts. cluster.type.ts has the role and status values. A small helper in the test file that builds a node buffer from plain values lets each test change one field.

  • Decode one hand-built node and check every field of the result, including length.
  • Check the role and status names for each valid byte.
  • Check that a buffer shorter than 19 bytes throws, and that a name length running past the end throws.
  • Check that an unknown role byte throws Invalid ClusterNodeRole.
  • Decode a metadata buffer with two nodes.

How to test: npm run test:unit and npm run lint pass in foreign/node.

Good first issue
  • I think this could be a good first issue for a new contributor
Lenguaje dominante
Rust
Estrellas
5.3k
Forks
548
Merge medio
2 d 20 h
PR fusionados (30 d)
194

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/iggy

Todos los issues de apache/iggy

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.