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 AppRole response schema validation tests #18636

Merged
merged 44 commits into from
Jan 13, 2023
Merged

Conversation

averche
Copy link
Contributor

@averche averche commented Jan 9, 2023

This PR modifies every test in builtin/credentials/approle/path_role_test.go with new validation checks to ensure that approle/path_role successful responses align with the declared response schema.

It also introduces a test helper in sdk/helper/testhelpers:

func FindResponseSchema(t *testing.T, ...)

This test helper will be useful for all plugins that require similar response schema validation in tests.

Background

This PR is part of the ongoing work to add structured responses in Vault OpenAPI (VLT-234)

@averche averche marked this pull request as ready for review January 11, 2023 17:11
@averche averche requested review from dhuckins, lursu and AnPucel January 13, 2023 16:36
Copy link
Collaborator

@lursu lursu left a comment

Choose a reason for hiding this comment

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

quick question but otherwise LGTM.

sdk/helper/testhelpers/response_validation.go Outdated Show resolved Hide resolved
averche added a commit that referenced this pull request Jan 13, 2023
This pull request adds 3 functions (and corresponding tests):

`testhelpers/response_validation.go`:

  - `ValidateResponse`
  - `ValidateResponseData`
  
field_data.go:

  - `ValidateStrict` (has the "strict" validation logic)

The functions are primarily meant to be used in tests to ensure that the responses are consistent with the defined response schema. An example of how the functions can be used in tests can be found in #18636.

### Background

This PR is part of the ongoing work to add structured responses in Vault OpenAPI (VLT-234)
Base automatically changed from response-schema-validation to main January 13, 2023 19:56
@averche averche added this to the 1.13.0-rc1 milestone Jan 13, 2023
@averche averche enabled auto-merge (squash) January 13, 2023 20:02
@averche averche merged commit 9997cf5 into main Jan 13, 2023
AnPucel pushed a commit that referenced this pull request Feb 3, 2023
This pull request adds 3 functions (and corresponding tests):

`testhelpers/response_validation.go`:

  - `ValidateResponse`
  - `ValidateResponseData`
  
field_data.go:

  - `ValidateStrict` (has the "strict" validation logic)

The functions are primarily meant to be used in tests to ensure that the responses are consistent with the defined response schema. An example of how the functions can be used in tests can be found in #18636.

### Background

This PR is part of the ongoing work to add structured responses in Vault OpenAPI (VLT-234)
AnPucel pushed a commit that referenced this pull request Feb 3, 2023
This PR modifies every test in `builtin/credentials/approle/path_role_test.go` with new validation checks to ensure that approle/path_role  successful responses align with the declared response schema.

It also introduces a test helper in `sdk/helper/testhelpers`:

```go
func FindResponseSchema(t *testing.T, ...)
```

This test helper will be useful for all plugins that require similar response schema validation in tests.

### Background

This PR is part of the ongoing work to add structured responses in Vault OpenAPI (VLT-234)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants