Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

@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.

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