Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec files not generated #57

Closed
DimitriSteyaert opened this issue May 25, 2016 · 11 comments
Closed

Spec files not generated #57

DimitriSteyaert opened this issue May 25, 2016 · 11 comments

Comments

@DimitriSteyaert
Copy link

Hi, I have an issue that's somewhat similar to #51. When I run retrospec puppet from within my puppet module directory there are no spec tests generated. Nonetheless my manifests dir contains a bunch of .pp files.

du -ah manifests
4.0K    manifests/apt.pp
4.0K    manifests/proxy.pp
4.0K    manifests/keepalived.pp
4.0K    manifests/base/firewall.pp
4.0K    manifests/base/ssh.pp
4.0K    manifests/base/firewall/post.pp
4.0K    manifests/base/firewall/pre.pp
12K     manifests/base/firewall
4.0K    manifests/base/snmp.pp
4.0K    manifests/base/ntp.pp
4.0K    manifests/base/dnsclient.pp
4.0K    manifests/base/motd.pp
4.0K    manifests/base/global.pp
44K     manifests/base
4.0K    manifests/postfix.pp
4.0K    manifests/quota.pp
4.0K    manifests/mcollective/server.pp
4.0K    manifests/mcollective/broker.pp
12K     manifests/mcollective
4.0K    manifests/apache.pp
4.0K    manifests/repo.pp
4.0K    manifests/nfs/server.pp
4.0K    manifests/nfs/client.pp
12K     manifests/nfs
4.0K    manifests/facts.pp
4.0K    manifests/sudo.pp
4.0K    manifests/params.pp
4.0K    manifests/vsftpd.pp
4.0K    manifests/yum.pp
4.0K    manifests/mysql/server.pp
4.0K    manifests/mysql/client.pp
12K     manifests/mysql
148K    manifests

when I run retrospec puppet I get the following output:
Successfully ran hook: /root/.retrospec/repos/retrospec-puppet-templates/clone-hook

But nothing happens:

du -ah spec
4.0K    spec/spec.opts
4.0K    spec/defines
4.0K    spec/classes
4.0K    spec/hosts
4.0K    spec/functions
4.0K    spec/spec_helper.rb
0       spec/fixtures/manifests/site.pp
4.0K    spec/fixtures/manifests
0       spec/fixtures/modules/profiles/files
0       spec/fixtures/modules/profiles/manifests
0       spec/fixtures/modules/profiles/templates
4.0K    spec/fixtures/modules/profiles
8.0K    spec/fixtures/modules
16K     spec/fixtures
44K     spec

ruby: 2.1.8
puppet-retrospec: 0.12.1
retrospec: 0.4.0

Am I missing something?

@logicminds
Copy link
Contributor

I think a recently template contribution broke this again. I'll check it out today.

@logicminds
Copy link
Contributor

I pushed an update to the templates #58 but I don't think that was your issue. Are you using the stock templates? Also do you have the output of running retrospec?

Is this a module? Are you able to share your parent directory structure.

Do you have internet access on that machine as the clone hook needs to go fetch the templates.

@DimitriSteyaert
Copy link
Author

I am indeed using the stock templates. The only output I got was the one line "succesfully ran..."
I just did a gem install puppet-retrospec and ran the command from inside a puppet module.
The full directory path from where I ran this command is /var/git/hosting_cluster/puppet/profiles/.
This machine also has full internet access.

@logicminds
Copy link
Contributor

I just released version 0.12.2 which addressed a few minor issues (notably the test matrix) and exception handling and a few other items. Give this new version a try and see if it fixes your issue. I think the exception handling will at least pinpoint the issue.

@DimitriSteyaert
Copy link
Author

Hi, I indeed got more feedback after running the 'retrospec puppet' command, which again didn't generate anything for me.
This is the output I got:

➜  profiles git:(development) retrospec puppet
remote: Counting objects: 4, done.
remote: Total 4 (delta 3), reused 3 (delta 3), pack-reused 1
Unpacking objects: 100% (4/4), done.
From https://github.com/nwops/retrospec-templates
   488defb..6915796  master     -> origin/master
Successfully ran hook: /root/.retrospec/repos/retrospec-puppet-templates/clone-hook
Updating 488defb..6915796
Fast-forward
 providers/provider_template.rb.retrospec.erb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

undefined method `applications' for #<Puppet::Resource::TypeCollection:0x007ff344fc1a90>

@logicminds
Copy link
Contributor

Run this command in your module grep -rl 'applications'

My guess is that you are referencing the applications somewhere in your code and retrospec tries to load that code and fails. So this could mean you have an error in your code somewhere.

Moreover, retrospec should fail better and let the user know there was a problem loading the code.

Also, I assume you are running 0.12.2 now?

@DimitriSteyaert
Copy link
Author

Hi, I don't have a reference to applications in my code. The command grep -rl 'applications' doesn't return anything.

gem list puppet-retrospec

*** LOCAL GEMS ***

puppet-retrospec (0.12.2)

My version is indeed correct, I ran the command retrospec puppet again and now got the feedback:

remote: Counting objects: 10, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 10 (delta 2), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (10/10), done.
From https://github.com/nwops/retrospec-templates
   6915796..53499e7  master     -> origin/master
Successfully ran hook: /root/.retrospec/repos/retrospec-puppet-templates/clone-hook
Updating 6915796..53499e7
Fast-forward
 acceptance/acceptance_spec_test.rb.retrospec.erb | 27 ++++++++++++++++++
 classes/hostclass_spec.rb.retrospec.erb          | 34 ++++++++++++++++++++++
 defines/definition_spec.rb.retrospec.erb         | 36 ++++++++++++++++++++++++
 nodes/node_spec.rb.retrospec.erb                 | 28 ++++++++++++++++++
 4 files changed, 125 insertions(+)
 create mode 100644 acceptance/acceptance_spec_test.rb.retrospec.erb
 create mode 100644 classes/hostclass_spec.rb.retrospec.erb
 create mode 100644 defines/definition_spec.rb.retrospec.erb
 create mode 100644 nodes/node_spec.rb.retrospec.erb

undefined method `applications' for #<Puppet::Resource::TypeCollection:0x007f18dddce5b8>

But still no generated spec files.

@logicminds
Copy link
Contributor

Version 1.0.0 has been released. Give this a try now.

@DimitriSteyaert
Copy link
Author

Can you publish the gem on rubygems.org please? :)

@logicminds
Copy link
Contributor

It was pushed yesterday.

@DimitriSteyaert
Copy link
Author

Perfect, this release fixed the issue for me.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants