Can't unit test own usage of InClusterFactory
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- go
調査の方向性
Start with conditions/factory.go at readNamespace, then trace InClusterFactory.GetNamespacedName through internal/utils/utils.go and review the override used in conditions/conditions_test.go. Determine an externally usable way to supply or override the namespace for unit tests, with tests that exercise wrapper code using a fake runtime client without requiring the current environment namespace.
索引モデルが issue の本文から書いたものです。
説明
Bug Report
What did you do?
Created a wrapper function in our operator code that finds the name of the associated OLM OperatorCondition and then uses the InClusterFactory API to set the upgradeable condition. Then we started writing tests to test this function.
What did you expect to see?
Tests to pass or fail depending on the correct writing of the wrapper function and calling the correct InClusterFactory and Condition code.
What did you see instead? Under which circumstances?
The error: get operator condition namespace: namespace not found for current environment.
Since the unit tests are using a fake runtime client and running locally, this was to be expected since InClusterFactory.GetNamespacedName() calls utils.GetOperatorNamespace(). However, what was unexpected was in our tests there is no way to override this since:
- utils package is internal so private
- readNamespace is private
- the library's own tests can override since they share the same package as
readNamespace.
Environment
- operator-lib version: 0.9.x
- github.com/operator-framework/operator-lib v0.9.0
Possible Solutions
- make
readNamespacepublic - provide an interface to allow
GetNamespacedNameto be overridden - allow the namespace to be injected into InClusterFactory (since the operator provides the namespace through
request.namespace, it might be a nice alternative?)
Additional context
Add any other context about the problem here.
- 主要言語
- Go
- スター
- 40
- フォーク
- 42
- 平均マージ
- 4日 46分
- マージ済み PR(30日)
- 7
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
operator-framework/operator-lib のほかの issue
-
Prune package?オープン
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
lifecycle/frozen
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
operator-framework/operator-lib#48 · コメント 4 件 ·
operator-framework/operator-lib の issue をすべて見る
似ている issue
-
Idle compaction monitors LIST the replica every tick when the newest destination file spans more than one TXID対応中かも @pishuv が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
benbjohnson/litestream#1563 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
agent-research agent-review-finding chore
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
jordansmall/spindrift#4922 ·
メンテナーはふだん 1 日以内に返信
-
gcsartifact: deleting a missing version returns an error対応中かも @ktsoator が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
govulncheck
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信