Adjust attempt and wait durations

* Sleep for less time, check more often.

* Assume that 'ok on first attempt' means CDN already has origin marked
  as ok.

* Also adjust loop logic so that we aren't checking maxRetries twice.
Use 'GET /?cacheBuster=%s' for origin check req

This allows us to run the tests against a live environment, as
a 200 will be returned, but the origin will still need to be checked.
Add test for X-Cache-Hits behaviour

Slightly different to what we originally expected, the Edge appends its
own hit count to the X-Cache-Hits header.
Mock CDN in a Vagrant VM using Nginx/Varnish

I found this useful to write and debug new tests while Mike was running
tests against the real service. Some of the behaviour we want to test is
just standard Varnish behaviour. We can mimic some other features with
minimal config changes.

The variable `$::ipaddress_vmhost` contains the IP address of the VM's host
on the other end of the private network - where `go test` would be running.

We'll need to be a careful about breaking this functionality when we
introduced SSL for backends. I'll leave a note in the issue.
Make TestProtocolRedirect() work in mock

Extract the relevant parts from our Fastly config to mimic HTTP->HTTPS
redirects and set a header in Nginx where we're doing SSL termination.

We need to set `proxy_redirect` and restate the default because the argument
to `proxy_pass` doesn't have the same protocol as the `Location` header.
Make TestRestrictPurgeRequests() work in mock

Extract a simplified and slightly modified version of the PURGE handling
code from our Fastly config. We should never match the IP that's on the
whitelist.
Merge pull request #9 from alphagov/origin_check_improve

Improve confirmOriginIsEnabled
Implement test for PURGE returning 403

This test, rather excitingly, proves that the behaviour has changed since we
implemented it in: https://www.pivotaltracker.com/story/show/62136616

The CDN now returns 200 and the body of a normal GET request. I suspect that
it's something to do with the `req.request = GET` hack that they suggested
implementing.

We should merge this but separately fix the config to make this test pass.
Fix typo s/propogate/propagate/.
Use constants in configOriginIsEnabled()

To indicate that they are test parameters and immutable whilst the test is
running. We've done this with a couple of the recently added tests and it
matches how we use `let()` in rspec.

I've also taken the opportunity to replace `time.ParseDuration()` with
`time.Duration()` because:

- We can't discard the error when assigning a constant (at least I don't
  think we can).
- There's less chance that we're going to typo the value and not notice.
- I actually think it reads a little nicer.
Rename function that verifies edge is healthy

Because we're testing that the edge thinks origin is healthy, rather than
verifying that origin itself is healthy. Amend the log message to match. Add
a bit of documentation that explains why we have to do this.
Merge pull request #8 from alphagov/purge_403

Implement test for PURGE returning 403
Merge pull request #13 from alphagov/minor_changes_probe_helper

Minor changes probe helper
Merge pull request #12 from alphagov/vagrant_varnish_mock_cdn

Mock CDN in a Vagrant VM using Nginx/Varnish
Rename insecureTLS to skipVerifyTLS

Rename `insecureTLS` to `skipVerifyTLS` to make it clearer what this
flag does. Also clarify the flag description.
Fix variable alignment
Rename `insecureTLS` in README

As per the changes in 1e73e524aed3445f45a81915c3f0c44787379dc0.
Merge pull request #15 from alphagov/clarify-insecure-flag

Rename insecureTLS to skipVerifyTLS
Mock for True-Client-IP header

Implementation matches Fastly in that the reverse-proxy above Varnish adds a
header and then Varnish restates that with a different name in the request
to the backend.
Implement TestHeaderUnspoofableClientIP() test

Send a request with a `True-Client-IP` header set to an RFC5737 address and
check that origin receives a request with the header set to a different and
valid IP address (which could be IPv6).

It's important to note that this doesn't check that it's actually *our* IP
address because:

- For the real CDN we'd have to call out to a third-party service e.g.
  `canhazip.com` to get our external IP.
- For the mock CDN it would be the IP on the private network rather than the
  external IP.

I was concerned that there might be a race condition whereby
`receivedHeaderVal` didn't get set at the point we checked the value. Which
could probably be guarded against by using a channel or reflecting the value
in the response.

However after testing this, by adding some delays to Varnish, I can't
reproduce it. I'm guessing this is because `client.RoundTrip()` blocks until
we get the response (by which time originServer.handler has been called).

PS: `sentHeaderIP` is not a const because slices/arrays cannot be.