Skip to content

Add unit tests for HTTP request to Envoy request conversion#3316

Draft
Pushpalanka wants to merge 4 commits intomasterfrom
input-valid
Draft

Add unit tests for HTTP request to Envoy request conversion#3316
Pushpalanka wants to merge 4 commits intomasterfrom
input-valid

Conversation

@Pushpalanka
Copy link
Collaborator

Add unit tests for HTTP request to Envoy request conversion and to test the invalid UTF-8 character validation method.

Signed-off-by: Pushpalanka Jayawardhana <pushpalanka.jayawardhana@zalando.de>
@Pushpalanka Pushpalanka marked this pull request as ready for review November 25, 2024 11:49
@Pushpalanka Pushpalanka added the minor no risk changes, for example new filters label Nov 25, 2024

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := AdaptToExtAuthRequest(tt.req, tt.metadata, tt.contextExtensions, tt.rawBody)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make more sense to change the tests to convert this as well to an AST input and validate that one. The Envoy request object itself is sth intermediate.

Looking forward we could also remove the double serialisation / deserialisation of Skipper Request -> Envoy Protobuf -> JSON -> OPA AST without changing the tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree!
Normally this should be part of some bdd style test with invalid input. If it is too complicated a unit test is fine.

@Pushpalanka Pushpalanka marked this pull request as draft December 30, 2024 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor no risk changes, for example new filters

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants