Skip to content

Commit

Permalink
Unit test fixes (#344)
Browse files Browse the repository at this point in the history
- include controller directory for unit tests
- fix broken unit tests in controller directory
  • Loading branch information
Boomatang authored Dec 4, 2023
1 parent f97417a commit 2acf31b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ IMG ?= $(IMAGE_TAG_BASE):$(IMAGE_TAG)
ENVTEST_K8S_VERSION = 1.22

# Directories containing unit & integration test packages
UNIT_DIRS := ./pkg/... ./api/...
UNIT_DIRS := ./pkg/... ./api/... ./controllers/...
INTEGRATION_DIRS := ./controllers...

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
Expand Down
18 changes: 9 additions & 9 deletions controllers/authpolicy_authconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ func TestAuthorinoConditionsFromHTTPRouteRule(t *testing.T) {
{
PatternExpressionOrRef: authorinoapi.PatternExpressionOrRef{
PatternExpression: authorinoapi.PatternExpression{
Selector: `request.path.@extract:{"sep":"?x-foo=","pos":1}.@extract:{"sep":"&"}`,
Selector: `request.path.@extract:{"sep":"?x-foo=","pos":1}|@extract:{"sep":"&"}`,
Operator: "eq",
Value: "a-value",
},
Expand All @@ -576,7 +576,7 @@ func TestAuthorinoConditionsFromHTTPRouteRule(t *testing.T) {
{
PatternExpressionOrRef: authorinoapi.PatternExpressionOrRef{
PatternExpression: authorinoapi.PatternExpression{
Selector: `request.path.@extract:{"sep":"&x-foo=","pos":1}.@extract:{"sep":"&"}`,
Selector: `request.path.@extract:{"sep":"&x-foo=","pos":1}|@extract:{"sep":"&"}`,
Operator: "eq",
Value: "a-value",
},
Expand Down Expand Up @@ -624,7 +624,7 @@ func TestAuthorinoConditionsFromHTTPRouteRule(t *testing.T) {
{
PatternExpressionOrRef: authorinoapi.PatternExpressionOrRef{
PatternExpression: authorinoapi.PatternExpression{
Selector: `request.path.@extract:{"sep":"?x-foo=","pos":1}.@extract:{"sep":"&"}`,
Selector: `request.path.@extract:{"sep":"?x-foo=","pos":1}|@extract:{"sep":"&"}`,
Operator: "eq",
Value: "a-value",
},
Expand All @@ -633,7 +633,7 @@ func TestAuthorinoConditionsFromHTTPRouteRule(t *testing.T) {
{
PatternExpressionOrRef: authorinoapi.PatternExpressionOrRef{
PatternExpression: authorinoapi.PatternExpression{
Selector: `request.path.@extract:{"sep":"&x-foo=","pos":1}.@extract:{"sep":"&"}`,
Selector: `request.path.@extract:{"sep":"&x-foo=","pos":1}|@extract:{"sep":"&"}`,
Operator: "eq",
Value: "a-value",
},
Expand All @@ -648,7 +648,7 @@ func TestAuthorinoConditionsFromHTTPRouteRule(t *testing.T) {
{
PatternExpressionOrRef: authorinoapi.PatternExpressionOrRef{
PatternExpression: authorinoapi.PatternExpression{
Selector: `request.path.@extract:{"sep":"?x-bar=","pos":1}.@extract:{"sep":"&"}`,
Selector: `request.path.@extract:{"sep":"?x-bar=","pos":1}|@extract:{"sep":"&"}`,
Operator: "eq",
Value: "other-value",
},
Expand All @@ -657,7 +657,7 @@ func TestAuthorinoConditionsFromHTTPRouteRule(t *testing.T) {
{
PatternExpressionOrRef: authorinoapi.PatternExpressionOrRef{
PatternExpression: authorinoapi.PatternExpression{
Selector: `request.path.@extract:{"sep":"&x-bar=","pos":1}.@extract:{"sep":"&"}`,
Selector: `request.path.@extract:{"sep":"&x-bar=","pos":1}|@extract:{"sep":"&"}`,
Operator: "eq",
Value: "other-value",
},
Expand Down Expand Up @@ -700,7 +700,7 @@ func TestAuthorinoConditionsFromHTTPRouteRule(t *testing.T) {
{
PatternExpressionOrRef: authorinoapi.PatternExpressionOrRef{
PatternExpression: authorinoapi.PatternExpression{
Selector: `request.path.@extract:{"sep":"?x-foo=","pos":1}.@extract:{"sep":"&"}`,
Selector: `request.path.@extract:{"sep":"?x-foo=","pos":1}|@extract:{"sep":"&"}`,
Operator: "matches",
Value: "^a+.*$",
},
Expand All @@ -709,7 +709,7 @@ func TestAuthorinoConditionsFromHTTPRouteRule(t *testing.T) {
{
PatternExpressionOrRef: authorinoapi.PatternExpressionOrRef{
PatternExpression: authorinoapi.PatternExpression{
Selector: `request.path.@extract:{"sep":"&x-foo=","pos":1}.@extract:{"sep":"&"}`,
Selector: `request.path.@extract:{"sep":"&x-foo=","pos":1}|@extract:{"sep":"&"}`,
Operator: "matches",
Value: "^a+.*$",
},
Expand All @@ -735,7 +735,7 @@ func TestAuthorinoConditionsFromHTTPRouteRule(t *testing.T) {
}
for i := range result {
if !reflect.DeepEqual(result[i], tc.expected[i]) {
t.Errorf("Expected rule %d to be %v, got %v", i, tc.expected[i], result[i])
t.Errorf("Expected rule %d to \nbe\t%v, \ngot\t%v", i, tc.expected[i], result[i])
}
}
})
Expand Down

0 comments on commit 2acf31b

Please sign in to comment.