繁体   English   中英

Puppet RSpec 测试的正确目录结构

[英]Correct directory structure for Puppet RSpec testing

我在为 Puppet 控制存储库创建单元测试时遇到了一些问题。 我主要使用具有以下目录结构的角色和配置文件:

[root@puppet]# tree site
site
├── profile
│   ├── files
│   │   └── demo-website
│   │       └── index.html
│   └── manifests
│       ├── base.pp
│       ├── ci_runner.pp
│       ├── docker.pp
│       ├── gitlab.pp
│       ├── logrotate.pp
│       └── website.pp
├── role
│   └── manifests
│       ├── gitlab_server.pp
│       └── nginx_webserver.pp

我需要在哪里放置我的规范文件以及正确的文件名是什么? 我试着把它们放在这里:

[root@puppet]# cat spec/classes/profile_ci_runner_spec.rb

require 'spec_helper'

describe 'profile::ci_runner' do
...

但我收到一个错误:

找不到类 ::profile::ci_runner

模块规范测试的常规位置是在 module 中,在模块根目录中有spec/目录。 例如, site/profile/spec/classes/ci_runner_spec.rb

您可以考虑安装PDK ,它可以帮助您设置结构和运行测试等。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM