cucumber-varnishtest 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +15 -34
- data/features/support/env.rb +1 -0
- data/lib/cucumber/varnishtest/version.rb +1 -1
- metadata +1 -3
- data/features/step_definitions/varnish_steps.rb +0 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91eddbb4bda1ee81575b91844f4397a012ce7d5a
|
4
|
+
data.tar.gz: 31323dc882e618c79621b74775114177f8a0a4f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a43ce239ff222507417576f7a32a691503e5b7e608369f36b4248a5981af57140123474ba4338e6ce16e47ad3e627fa895a96fab1793f1f25d747503713359a1
|
7
|
+
data.tar.gz: a752773dc176607f327be16f58c6d03ba6ab5234318bc49bebf007b8f5a4636c402e8d3b2694636f0544fc70228f31a7a048e8165953a1e619b25876b47c4a35
|
data/README.md
CHANGED
@@ -1,22 +1,25 @@
|
|
1
|
-
# Varnishtest
|
1
|
+
# Cucumber Varnishtest
|
2
2
|
|
3
3
|
This let's you use Gherkin, the language of BDD, to write behavior-level
|
4
4
|
checks for your VCL.
|
5
5
|
|
6
6
|
## Project status
|
7
|
-
This is currently a Proof of Concept.
|
8
7
|
|
9
|
-
|
10
|
-
testing your Varnish config, but it might take a bit of extended as
|
11
|
-
you test out your use-cases.
|
8
|
+
This project is now legit!
|
12
9
|
|
13
|
-
|
10
|
+
Install the [Gem] (https://rubygems.org/gems/cucumber-varnishtest)
|
11
|
+
and check out [this example](https://github.com/nstielau/cucumber-varnishtest-example)
|
12
|
+
to get started.
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
This is probably the easiest/best way to get started with testing your
|
15
|
+
Varnish config. However, the step definitions are not sufficient for
|
16
|
+
complicated VCL use-cases. PRs welcome ;)
|
18
17
|
|
19
|
-
|
18
|
+
If you do need to iterate on the steps, working directly out of a clone is
|
19
|
+
likely easiest. If you want to get started testing your VCL in CI like travis /
|
20
|
+
jenkins / CircleCI, using the steps packaged in the gem is probably easiest.
|
21
|
+
|
22
|
+
## Examples
|
20
23
|
|
21
24
|
To run, simply run `cucumber` from this directory.
|
22
25
|
|
@@ -64,33 +67,11 @@ Feature: Static Server Headers
|
|
64
67
|
0m7.467s
|
65
68
|
```
|
66
69
|
|
67
|
-
##
|
70
|
+
## Usage
|
68
71
|
|
69
72
|
Check out [this example](https://github.com/nstielau/cucumber-varnishtest-example).
|
70
73
|
|
71
|
-
|
72
|
-
|
73
|
-
```
|
74
|
-
gem 'cucumber-varnishtest', :require => false
|
75
|
-
```
|
76
|
-
|
77
|
-
Then add the following line to your env.rb to make the step definitions available in your features:
|
78
|
-
|
79
|
-
```
|
80
|
-
require 'cucumber/varnishtest'
|
81
|
-
```
|
82
|
-
|
83
|
-
## How to use your own VCL
|
84
|
-
|
85
|
-
Simply put the .vcl file in this directory, and specify in your
|
86
|
-
`Given` clause of your Scenario:
|
87
|
-
|
88
|
-
```
|
89
|
-
Scenario: Multiple Requests without warming
|
90
|
-
Given varnish running with MyCustomConfig.vcl <==== YOUR VCL FILE
|
91
|
-
When we request /images.png
|
92
|
-
Then it should pass varnishtest
|
93
|
-
```
|
74
|
+
Or simply clone this repo and run `cucumber`
|
94
75
|
|
95
76
|
## Dependencies
|
96
77
|
|
data/features/support/env.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
require './lib/cucumber/varnishtest'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-varnishtest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Stielau
|
@@ -38,7 +38,6 @@ files:
|
|
38
38
|
- Rakefile
|
39
39
|
- cucumber-varnishtest.gemspec
|
40
40
|
- example.vcl
|
41
|
-
- features/step_definitions/varnish_steps.rb
|
42
41
|
- features/support/env.rb
|
43
42
|
- features/varnishtest.feature
|
44
43
|
- lib/cucumber/varnishtest.rb
|
@@ -70,6 +69,5 @@ signing_key:
|
|
70
69
|
specification_version: 4
|
71
70
|
summary: Cucumber steps to easily create and execute varnishtest tests.
|
72
71
|
test_files:
|
73
|
-
- features/step_definitions/varnish_steps.rb
|
74
72
|
- features/support/env.rb
|
75
73
|
- features/varnishtest.feature
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require './lib/cucumber/varnishtest/context_manager'
|
2
|
-
require './lib/cucumber/varnishtest/request'
|
3
|
-
|
4
|
-
Given(/^varnish running with (.*)$/) do |vcl_file|
|
5
|
-
# Load a particular varnish VCL file
|
6
|
-
ContextManager.instance.vcl_file = vcl_file
|
7
|
-
end
|
8
|
-
|
9
|
-
When(/^we (GET|PATCH|POST|PUT|DELETE) (.*)$/) do |method, path|
|
10
|
-
ContextManager.instance.request path, method
|
11
|
-
end
|
12
|
-
|
13
|
-
Then(/^the response should be 200$/) do
|
14
|
-
ContextManager.instance.client_expect 'resp.status', 200
|
15
|
-
end
|
16
|
-
|
17
|
-
Then(/^the response length should be (\d+)$/) do |bytes|
|
18
|
-
ContextManager.instance.client_expect 'resp.bodylen', bytes.to_i
|
19
|
-
end
|
20
|
-
|
21
|
-
Then(/^the response header (.*) should be (.*)$/) do |header, value|
|
22
|
-
ContextManager.instance.client_expect "resp.http.#{header}", "#{value}"
|
23
|
-
end
|
24
|
-
|
25
|
-
Then(/^it should pass varnishtest$/) do
|
26
|
-
ContextManager.instance.test!
|
27
|
-
end
|
28
|
-
|
29
|
-
Then(/^the response code should be (\d+)$/) do |code|
|
30
|
-
ContextManager.instance.client_expect "resp.status", 200
|
31
|
-
end
|
32
|
-
|
33
|
-
Then(/^the server should receive (\d+) requests$/) do |count|
|
34
|
-
ContextManager.instance.expected_request_count = count
|
35
|
-
end
|
36
|
-
|
37
|
-
Then(/^there should be (\d+) cache hit[s]*$/) do |count|
|
38
|
-
ContextManager.instance.expected_cache_hits = count
|
39
|
-
end
|
40
|
-
|
41
|
-
Then(/^there should be (\d+) cache misses$/) do |count|
|
42
|
-
ContextManager.instance.expected_cache_misses = count
|
43
|
-
end
|
44
|
-
|
45
|
-
Then(/^there should be (\d+) piped request[s]*$/) do |count|
|
46
|
-
ContextManager.instance.expected_piped_requests = count
|
47
|
-
end
|
48
|
-
|
49
|
-
Then(/^there should be (\d+) passed request[s]*$/) do |count|
|
50
|
-
ContextManager.instance.expected_passed_requests = count
|
51
|
-
end
|
52
|
-
|
53
|
-
After do |scenario|
|
54
|
-
# Reset the context manager for a fresh scenario
|
55
|
-
ContextManager.reset!
|
56
|
-
end
|