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

オープン 初心者向け
#5,033 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
85/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
nodejs, typescript
領域
testing

調査の方向性

foreign/node/src/wire/cluster/cluster.utils.ts の deserializeNode と deserializeMetadata、および cluster.type.ts のロールとステータスの値を読みます。delete-topic.command.test.ts のパターンに従い、単純な値からノードのバッファを作成するヘルパーを用意して、cluster.utils.test.ts を同じディレクトリに作成します。列挙したケースが npm run test:unit で通り、foreign/node で npm run lint が成功すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
Rust
スター
5.3k
フォーク
548
平均マージ
2日 20時間
マージ済み PR(30日)
194

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/iggy のほかの issue

apache/iggy の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。