landro / TesTcl

when you don't have the balls to test your F5 BIG-IP iRules directly in production
https://testcl.com
BSD 3-Clause "New" or "Revised" License
98 stars 30 forks source link

Add support to advanced pool verification #58

Closed gszeliga closed 5 years ago

gszeliga commented 5 years ago

I ran into an issue where endstate would not do the job to verify the last pool set by an iRule when wrapped in a catch expression.

This PR attempts to address that by enriching the available building blocks with the following new statements:

This way, you can have things like:

verify "Final pool is the expected one after a match" "go_to_bar" eq { endstate_pool }

which is super awesome to have handy!

Let me know what you think

landro commented 5 years ago

I'll try to ave a look at this PR within the next few days, @gszeliga !

landro commented 5 years ago

I'm having seeing a regression in examples/example_irule_pool_verification.tcl Could you make sure it doesn't break, @gszeliga ?

gszeliga commented 5 years ago

Hey @landro! Sorry for the buggy example. It should be fine now!

gszeliga commented 5 years ago

@landro It's been a while since I heard from you. Is there anything I can do to unblock this PR? Thanks!

landro commented 5 years ago

Guillermo, Thanks for reminding me. I’ve been very busy for the past few weeks - I’ll try to get a look at it during this week.

  1. jan. 2019 kl. 23:47 skrev Guillermo Szeliga notifications@github.com:

@landro It's been a while since I heard from you. Is there anything I can do to unblock this PR? Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

landro commented 5 years ago

@gszeliga I'm still getting errors:


➜  TesTcl git:(gszeliga-support-advanced-pool-verification) jtcl examples/example_irule_pool_verification.tcl

**************************************************************************
* it should set the right pool when available
**************************************************************************
-> Test failure!!
-> -> Verification 'Final pool is the expected one after a match' failed - expression: {go_to_bar} eq {}
error     Verification 'Final pool is the expected one after a match' failed - expression: {go_to_bar} eq {}

**************************************************************************
* it should fallback to default LB::server default pool if nothing matches
**************************************************************************
-> Test failure!!
-> -> Verification 'Final pool should be defaults' failed - expression: {fallback} eq {}
error     Verification 'Final pool should be defaults' failed - expression: {fallback} eq {}```
gszeliga commented 5 years ago

Hey @landro !

Have you checked your TCLLIBPATH? It might be pointing to the wrong version.

I ran the tests again and they look fine this time :(

❯ jtcl examples/example_irule_pool_verification.tcl

**************************************************************************
* it should set the right pool when available
**************************************************************************
verification of 'Final pool is the expected one after a match' done.
-> Test ok

**************************************************************************
* it should fallback to default LB::server default pool if nothing matches
**************************************************************************
verification of 'Final pool should be defaults' done.
-> Test ok
landro commented 5 years ago

Finally sorted out what was going on. I try to maintain compatibility with Tclsh as much as possible, and therefore had to replace not with ! and fix an issue in the classes match implementation. Thanks for your effort and contribution @gszeliga