TesTcl icon indicating copy to clipboard operation
TesTcl copied to clipboard

support for event context validation

Open samstep opened this issue 10 years ago • 2 comments

Hi, I would like to request a feature to validate the commands in event context- this is something that F5 does on saving of an iRule, however TesTcl misses entirely . for example the following iRUle will fail to save on F5

rule bad_context { when HTTP_RESPONSE { log local.0 "URI is: [HTTP::uri]" }

}

the error message will be "command not valid in the current event context (HTTP_RESPONSE)[HTTP::uri]

This is a must-have feature in my opinion - the above iRule must raise an error in TesTCL (currently it doesn't!).

DevCentral lists which commands are valid in which event context so I hope this isn't a difficult feature to implement

samstep avatar Aug 13 '14 16:08 samstep

It would probably make sense to create some kind of post processing step in the run command that validates this kind of stuff. I can't see a simple solution for doing that right now since testcl is a mocking framework and doesn't consider contexts at all. In other programming environments, one would typically pass a context to a method.

landro avatar Aug 13 '14 17:08 landro

Probably the easiest would be to redefine the when command after running the standard current bahaviour, and then validate context stuff.

landro avatar Aug 13 '14 18:08 landro