-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests(conformance): run conformance against expressions and tradition…
…al_compatible router flavors (#314) * tests(conformance): run conformance against expressions and traditional_compatible router flavors * tests(conformance): do not skip HTTPRouteHeaderMatching for expressions router * Apply suggestions from code review
- Loading branch information
Showing
3 changed files
with
147 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package conformance | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
) | ||
|
||
// RouterFlavor represents the flavor of the Kong router. | ||
// ref: https://docs.konghq.com/gateway/latest/reference/configuration/#router_flavor | ||
type RouterFlavor string | ||
|
||
const ( | ||
// RouterFlavorTraditionalCompatible is the traditional compatible router flavor. | ||
RouterFlavorTraditionalCompatible RouterFlavor = "traditional_compatible" | ||
// RouterFlavorExpressions is the expressions router flavor. | ||
RouterFlavorExpressions RouterFlavor = "expressions" | ||
) | ||
|
||
// KongRouterFlavor returns router mode of Kong in tests. Currently supports: | ||
// - `traditional_compatible` | ||
// - `expressions` | ||
func KongRouterFlavor(t *testing.T) RouterFlavor { | ||
rf := os.Getenv("TEST_KONG_ROUTER_FLAVOR") | ||
switch { | ||
case rf == "": | ||
return RouterFlavorTraditionalCompatible | ||
case rf == string(RouterFlavorTraditionalCompatible): | ||
return RouterFlavorTraditionalCompatible | ||
case rf == string(RouterFlavorExpressions): | ||
return RouterFlavorExpressions | ||
case rf == "traditional": | ||
t.Logf("Kong router flavor 'traditional' is deprecated, please use 'traditional_compatible' instead") | ||
t.FailNow() | ||
return "" | ||
default: | ||
t.Errorf("unsupported Kong router flavor: %s", rf) | ||
t.FailNow() | ||
return "" | ||
} | ||
} |