Spec environment fixtures duplicate skeleton data that no spec reads

未关闭 适合新手
#238 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
79/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
活跃
技术栈
ruby, yaml
领域
testing

调研方向

从 spec/lib/simp/cli/commands/files/environments/ 下的 fixtures 和提到的三个 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 仍然通过,并且 fixtures 不再重复未使用的骨架数据。

由索引模型根据 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 小时
30 天内合并 PR
4

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

simp/rubygem-simp-cli 的其他 Issue

查看 simp/rubygem-simp-cli 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。