-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ThrowsException-variables'
- Loading branch information
Showing
4 changed files
with
77 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package require -exact testcl 1.0.10 | ||
namespace import ::testcl::* | ||
|
||
## | ||
# Example demonstrating how to use TesTcl | ||
# This is how you should write your tests | ||
# | ||
# To run example | ||
# | ||
# export TCLLIBPATH=/parent/dir/of/this/file | ||
# | ||
# and run the following command from /parent/dir/of/this/file | ||
# | ||
# jtcl examples/example_irule_variables.tcl | ||
# | ||
## | ||
|
||
# Comment out to suppress logging | ||
#log::lvSuppressLE info 0 | ||
|
||
before { | ||
event HTTP_REQUEST | ||
} | ||
|
||
it "should set pool to foo when status is 1" { | ||
endstate pool foo | ||
array set variables { status 1 } | ||
run irules/variables_irule.tcl simple variables | ||
} | ||
|
||
it "should set pool to bar when status is 0" { | ||
endstate pool bar | ||
array set variables { status 0 } | ||
run irules/variables_irule.tcl simple variables | ||
} | ||
|
||
|
||
stats |
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,11 @@ | ||
rule simple { | ||
|
||
when HTTP_REQUEST priority 100 { | ||
# set variable outside irule | ||
if { $status eq 1 } { | ||
pool foo | ||
} else { | ||
pool bar | ||
} | ||
} | ||
} |
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,16 @@ | ||
source src/on.tcl | ||
source src/assert.tcl | ||
source src/onirule.tcl | ||
namespace import ::testcl::* | ||
|
||
# Comment out to suppress logging | ||
#log::lvSuppressLE info 0 | ||
|
||
event HTTP_REQUEST | ||
|
||
on pool bar return "" | ||
|
||
endstate pool foo | ||
|
||
array set variables { status 1 } | ||
run irules/variables_irule.tcl simple variables |
a5c289d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!