Yesterday was our 14th anniversary, so I didn’t have time to write a blog post, but I did look into a tech debt issue: rspec tests. In addition to adding rspec-puppet-facts, I found a program called onceover that offers two concepts I want to look into.
First, there is a rake task to generate fixtures. I have a similar feature in generate-puppetfile, but it’s not as perfect as I’d like – it often requires some manual touch afterward. Onceover’s rake task does not have that issue. I hope to be able to grab the rake task without being forced to use the rest of it or affecting the existing test set up. Maybe I’ll be interested in the rest of it someday, but not right now, and it’s great when you’re not forced to make a forklift upgrade like that.
The second item is centralizing rspec-puppet tests in the controlrepo rather than inside each module itself. That will change the relevant portions of my controlrepo layout from:
. ├── dist │ ├── profile │ │ ├── files │ │ ├── lib │ │ ├── manifests │ │ ├── metadata.json │ │ ├── Rakefile │ │ ├── spec │ │ │ ├── classes │ │ │ ├── fixtures │ │ │ │ ├── hieradata │ │ │ │ ├── hiera.yaml │ │ │ └── spec_helper.rb │ │ ├── templates │ │ └── tests │ └── role │ ├── manifests │ ├── metadata.json │ ├── Rakefile │ ├── README.md │ ├── spec │ └── tests ├── environment.conf ├── Gemfile ├── hiera ├── hiera.yaml ├── manifests │ └── site.pp ├── Puppetfile └── r10k_installation.pp
To:
. ├── dist │ ├── profile │ │ ├── files │ │ ├── lib │ │ ├── manifests │ │ ├── metadata.json │ │ ├── Rakefile │ │ ├── templates │ │ └── tests │ └── role │ ├── manifests │ ├── metadata.json │ ├── Rakefile │ ├── README.md │ └── tests ├── environment.conf ├── Gemfile ├── hiera ├── hiera.yaml ├── manifests │ └── site.pp ├── Puppetfile ├── r10k_installation.pp └── spec ├── classes ├── fixtures ├── hieradata ├── hiera.yaml └── spec_helper.rb
I haven’t done this yet but did talk to some others who already do this and are benefiting from the simplified test setup. I’m looking forward to trying it out soon.
2 thoughts on “Puppet Tech Debt Day 2: Adjusting Rspec Tests”