Skip to content

Rewrite test issue #62

Open
Open
@ianrenUipath

Description

@ianrenUipath

Hi,
For a VS rewrite rule, VS would rewrite the path (or the prefix) portion of the URI with the uri value provided.

If the original URI was matched based on prefix, the value provided in this field will replace the corresponding matched prefix. (https://istio.io/latest/docs/reference/config/networking/virtual-service/#HTTPRewrite)

But, in the validator, it does not support compare the test request uri after rewriting with the uri we provided in the test case.

For example, we have a VS rule:

name: example_rule
match:
  uri:
    prefix: /examplePrefix
rewrite:
  uri: /
route:
  destination:
    host: example_destination_host
    port:
      number: 80

and a test:

description:  example_rule_test
wantMatch: true
request:
  authority: ["example"]
  method: ["GET"]
  uri: ["/examplePrefix", "/examplePrefix/somePrefix"]
route:
  destination:
    host: example_destination_host
    port:
      number: 80
rewrite:
  uri: /

it should work as the test case has same rewrite section as "example_rule".

Is there any way we can compare the test request uri after rewriting with the uri we provided in the test case?

like:

description:  example_rule_test
wantMatch: true
request:
  authority: ["example"]
  method: ["GET"]
  uri: ["/examplePrefix/somePrefix"]
route:
  destination:
    host: example_destination_host
    port:
      number: 80
uriAfterRewrite:
  uri: /somePrefix

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions