-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #344 from ysugimoto/feat/inject-value-for-tantitiv…
…e-in-simulator Feat/inject value for tentative in simulator
- Loading branch information
Showing
25 changed files
with
637 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// @scope: recv | ||
// @suite: Default variable via function | ||
sub test_default_server_region { | ||
testing.call_subroutine("vcl_recv"); | ||
|
||
assert.equal(req.http.Region, "US"); | ||
} | ||
|
||
// @scope: recv | ||
// @suite: Override variable via function | ||
sub test_override_server_region { | ||
testing.inject_variable("server.region", "ASIA"); | ||
testing.call_subroutine("vcl_recv"); | ||
|
||
assert.equal(req.http.Region, "ASIA"); | ||
} | ||
|
||
// @scope: deliver | ||
// @suite: Assert overridden variables via configuration | ||
sub test_override_via_configuration { | ||
testing.call_subroutine("overrides"); | ||
|
||
// bool | ||
assert.equal(req.http.Is-Cert-Bad, "1"); | ||
// integer | ||
assert.equal(req.http.Geo-Area-Code, "200"); | ||
// float | ||
assert.equal(req.http.Digest-Ratio, "0.800"); | ||
// string | ||
assert.equal(req.http.Client-As-Name, "Foobar"); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
sub vcl_recv { | ||
#Fastly recv | ||
set req.http.Region = server.region; | ||
} | ||
|
||
|
||
sub overrides { | ||
// Following variables could be overridden by configuration | ||
set req.http.Is-Cert-Bad = tls.client.certificate.is_cert_missing; | ||
set req.http.Geo-Area-Code = client.geo.area_code; | ||
set req.http.Digest-Ratio = req.digest.ratio; | ||
set req.http.Client-As-Name = client.as.name; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.