Spec environment fixtures duplicate skeleton data that no spec reads

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

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
79/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
ruby, yaml
領域
testing

調査の方向性

まず spec/lib/simp/cli/commands/files/environments/ の下にあるフィクスチャと、名前の挙がっている3つのspec、simp_puppet_env_helper_spec.rb、set_site_scenario_action_spec.rb、cli_simp_scenario_spec.rbを確認します。どのレイアウト、hiera.yaml、manifests/site.pp、シナリオのファイル名に依存しているかを調べ、使用されていないYAML値をプレースホルダーまたはアサーション対象のキーに絞ります。specが引き続き通り、フィクスチャに未使用のスケルトンデータが重複していなければ完了です。

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

説明

The environment fixtures under spec/lib/simp/cli/commands/files/environments/ (simp/ and simp_hiera3/) are hand-copied from simp/simp-environment-skeleton. The specs that use them (simp_puppet_env_helper_spec.rb, set_site_scenario_action_spec.rb, cli_simp_scenario_spec.rb) copy the directories into a temp environment. They depend on the layout (data/ vs. hieradata/, hiera.yaml), on manifests/site.pp, and on which scenario files exist. No spec reads the Hiera values in the scenario or host files.

So every data change in the skeleton needs a matching manual edit here, even though no test can tell whether it was made. #237 changed six fixture files only to follow simp/simp-environment-skeleton#76 (haveged → rngd), and the copies have drifted anyway (#236).

Options:

  • Cut the fixtures down to what the specs need. Keep the directory layout, hiera.yaml, site.pp and the scenario file names, and replace the YAML contents with a minimal placeholder (or only the keys a spec actually asserts). Skeleton data changes then never touch this repo. This also makes #236 unnecessary.
  • Build the fixtures from the skeleton at test time, e.g. from the simp-environment-skeleton RPM or a pinned checkout. That keeps them accurate, but it adds a network or package dependency to unit tests, so it's probably not worth it.

The first option looks like the better fit. The simp_hiera3/ copy has no current skeleton to follow anyway, so it can be trimmed the same way.

主要言語
Ruby
スター
2
フォーク
12
平均マージ
1日 13時間
マージ済み PR(30日)
4

環境構築

はじめの一歩

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

simp/rubygem-simp-cli のほかの issue

simp/rubygem-simp-cli の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

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

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