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 end to end tests to validate the generated JSON schema #1534

Closed
wants to merge 2 commits into from

Conversation

shreyas-goenka
Copy link
Contributor

@shreyas-goenka shreyas-goenka commented Jun 26, 2024

Changes

TODO: Also account for the case when ${resources...} is used as a run_job_task.

Tests

Copy link
Contributor

@pietern pietern left a comment

Choose a reason for hiding this comment

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

These two examples are positive tests.

Please also include 1 negative test to confirm the schema is not any.

@@ -115,3 +115,8 @@ jobs:
run: |
go run main.go bundle schema > schema.json
ajv -s schema.json -d ./bundle/tests/basic/databricks.yml

# Valid configuration should pass schema validation.
for file in ./bundle/tests/jsonschema/allowed/*.yml; do
Copy link
Contributor

Choose a reason for hiding this comment

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

Everything under bundle/tests has accompanying Go tests. I'd like to keep it that way so that you know which tests may be affected by changes. If someone reuses these YAML files for tests it introduces coupling.

Could you move this under bundle/schema/testdata?

@@ -137,7 +137,7 @@ func (m *resolveVariableReferences) Apply(ctx context.Context, b *bundle.Bundle)
normalized, _ := convert.Normalize(b.Config, root, convert.IncludeMissingFields)

// If the pattern is nil, we resolve references in the entire configuration.
root, err := dyn.MapByPattern(root, m.pattern, func(p dyn.Path, v dyn.Value) (dyn.Value, error) {
root, err := dyn.MapByPattern(root, m.pattern, func(_ dyn.Path, v dyn.Value) (dyn.Value, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated.

@shreyas-goenka
Copy link
Contributor Author

Superseded by #1726

@pietern pietern deleted the schema-test branch August 28, 2024 07:24
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