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

Make spec tests pass #165

Open
EmersonPrado opened this issue Oct 6, 2017 · 4 comments
Open

Make spec tests pass #165

EmersonPrado opened this issue Oct 6, 2017 · 4 comments

Comments

@EmersonPrado
Copy link

Currently, running rake spec in branch 'develop' yields an enormous amount of errors:

$ rake spec | grep failures
...
74 examples, 73 failures

It seems many of them are caused by missing facts and variables and misformed resources in the spec tests themselves, rather than errors in the classes and defined types.

@EmersonPrado
Copy link
Author

I started with varnish::acl spec test, which had the least failures (2) and didn't include other classes/defines. So far, this made this define pass spec test, preserving all tests.

@EmersonPrado
Copy link
Author

varnish::ncsa spec tests corrected too

@EmersonPrado
Copy link
Author

varnish::vcl tests corrected and varnish::selector and varnish::service tests partially corrected. Now failure count is 54.

@EmersonPrado
Copy link
Author

EmersonPrado commented Oct 9, 2017

Went thru all tests I could improve without losing any test functionality or changing module logic. Well, there were two changes: I had to add a include varnish::service in class varnish::shmlog and changing a variable interpolation for the variable itself in template varnish-conf.erb (I chose to correct the template instead of the spec test because this made the template coherent with the Varnish defaults).

Now there are 25 failures, so distributed:

  • Class varnish => 2 failures
  • Class varnish::repo => 8 failures
  • Defined type varnish::selector => 6 failures
  • Class varnish::service => 6 failures
  • Class varnish::shmlog => 3 failures

All of them are repetitions of:

  1. Classes varnish::shmlog, varnish::service and varnish::repo => Unknown variable: 'varnish::real_version' at ...modules/varnish/manifests/repo.pp:59:15
  2. Defined type varnish::selector => Repo version 50 not supported at ...modules/varnish/manifests/repo.pp:59:15
  3. Class varnish => ...expected that the catalogue would contain File[varnish-conf] with notify set to "Service[varnish]" but it is set to Exec[restart-varnish]{:command=>"restart-varnish"}

The first one can be fixed by including class varnish in affected classes, but this causes a duplicate resource declaration for the class itself. There should be a better way of passing this variable to the dependent classes.
For the repo version not supported, the spec test asks for version 5.0, but class varnish::repo doesn't provide a key_id for this. In my understanding, the fix depends on the module intention: if it should configure Debian with Varnish 5.0, then the key should be included in class varnish::repo, otherwise the spec test should test for a supported repo version.
For the file resource notify parameter for the third failure, I have no idea if this is a real failure in varnish class - File['varnish-conf'] should notify Service[varnish] - or a false positive - File['varnish-conf'] should notify Exec['restart-varnish'].

@maxchk , would you mind shedding me some light about failures 2 and 3? I guess the first one is bigger than the intent of this issue, but the other two should be rather simple - once I know what they should be.

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

1 participant