puppetlabs/puppet — pull request #457 by joshcooper (2012-02-03 19:50:00+00:00)
Title: (#12412) Refactor puppet acceptance tests to run on Windows

This series of commits refactors the puppet acceptance tests so that they now run on Windows agents. The changes can be summarized as follows:

1. Replace instances of tmpfile = "/tmp/mytest-#{$$}", with calls to agent.tmpfile('mytest'), and same for tmpdir. The difference is that the latter executes `mktemp` on the remote system, which generates secure tmp files, and also returns a path that is compatible with the remote platform. The reason for this change, is that many tests create a tempfile and then pass the path to puppet apply, puppet resource, etc. However, windows agents cannot accept POSIX style paths in their manifests. The path returned by agent.tmpfile/tmpdir represents a native path, e.g. /tmp/foo/bar or C:/foo/bar, depending on the agent platform, which can then be used by puppet, e.g. as the path to a file resource.

2. Many tests use the `on agents` style of command, which doesn't work when different commands need to be executed on different hosts, and the output of each command parsed differently. In other words, the `on` method takes N commands, but only one block, not N of them. This is easily fixed by switching to `agents.each do |agent|` style of test.

3. Another motivation for 2 above, is that it makes it possible to skip the test in cases where functionality is not supported on an agent, e.g. symlinks, cron.

4. There are a few tests where the tests should be run on Windows, but can't as currently written. For example, there is no `hostname -f` command on Windows (nor cygwin). When these tests are run on Windows agents, the test will warn with a "pending" message and then skip to the next agent.

As a result of these changes, all of the acceptance tests run on Windows agents (or are skipped due to 3 and 4 above).