sous-chefs / jenkins

Development repository for the jenkins cookbook
https://supermarket.chef.io/cookbooks/jenkins
Apache License 2.0
424 stars 635 forks source link

Add tests for JNLP slaves #537

Open docwhat opened 7 years ago

docwhat commented 7 years ago

Cookbook version

4.0.0 4.1.0 4.1.1

Chef-client version

12.15

Request:

Given the difficulties getting the JNLP stuff working again, I would propose that some tests should be added for the JNLP (and the windows variant) resources. See #531 for the multiple fixes that didn't fix everything.

iennae commented 7 years ago

Hi,

Yes. Tests need to be added for this that are more extensive than what is there now. Rather than waiting to pull in code that fixes some of the problems until I have had tests that are functioning, I have gone ahead and checked and pulled stuff in to stem some of the problems. Considering there are a large number of issues with this cookbook from proper versioning to get a working instance to authorization and authentication issues, we are doing what we can in this case. If you want to write some tests, that would be great.

docwhat commented 7 years ago

Hah! I knew you'd ask that... :-D

Yeah, the whole Jenkins 2.0 locked-down-on-start thing makes writing cookbook tests harder. :-( I'll see if I can cobble something together to at least check the "does the resource work" POV...

I have a work-around for that, to get an old-style-unsecured Jenkins post 2.0:

echo -n "$JENKINS_VERSION" > "${JENKINS_HOME}/jenkins.install.UpgradeWizard.state"
echo -n "$JENKINS_VERSION" > "${JENKINS_HOME}/jenkins.install.InstallUtil.lastExecVersion"

That prevents the wizard from launching. The wizard gets the plugins and locks down the Jenkins instance.

What resources are available for "generic" tests? Could I use docker containers to start up a master and some slaves? Because inter-VM communication can be tricky to setup. :-/

Also, to really test these, you'd need a chef-server, which is well outside my comfort zone for automated testing.

cheesesashimi commented 7 years ago

Just a few observations from dealing with a jenkins_jnlp_slave resource problem, which I reported via Chef's support (though I'm happy to create a GitHub issue with the details of my issue as well 🙂).

It appears there are "does the resource work" tests, but I don't think they're being run regularly and almost certainly not within a CI context:

Given my aforementioned issue with the jenkins_jnlp_slave resource, just running the jenkins_slave_create test suite reproduces it. With this in mind, how feasible would it be to have all of the test suites run during a CI build?