mirror of https://github.com/databricks/cli.git
add tests for the fail case
This commit is contained in:
parent
a724a1129d
commit
9443ed68fe
|
@ -114,6 +114,11 @@ jobs:
|
|||
- name: Validate bundle schema
|
||||
run: |
|
||||
go run main.go bundle schema > schema.json
|
||||
|
||||
for file in ./bundle/tests/schema/pass/*.yml; do
|
||||
ajv -s schema.json -d $file
|
||||
ajv test -s schema.json -d $file --valid
|
||||
done
|
||||
|
||||
for file in ./bundle/tests/schema/fail/*.yml; do
|
||||
ajv test -s schema.json -d $file --invalid
|
||||
done
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
bundle:
|
||||
# expected type is 'string'
|
||||
name: 1234
|
|
@ -0,0 +1,4 @@
|
|||
resources:
|
||||
jobs:
|
||||
myjob:
|
||||
format: INVALID_VALUE
|
|
@ -0,0 +1,6 @@
|
|||
resources:
|
||||
models:
|
||||
mymodel:
|
||||
latest_versions:
|
||||
- creation_timestamp: 123
|
||||
status: INVALID_VALUE
|
|
@ -0,0 +1,8 @@
|
|||
resources:
|
||||
jobs:
|
||||
outer:
|
||||
name: outer job
|
||||
tasks:
|
||||
- task_key: run job task 1
|
||||
run_job_task:
|
||||
job_id: ${invalid.reference}
|
|
@ -0,0 +1,5 @@
|
|||
resources:
|
||||
models:
|
||||
mymodel:
|
||||
latest_versions:
|
||||
- creation_timestamp: ${invalid.reference}
|
|
@ -0,0 +1,9 @@
|
|||
resources:
|
||||
jobs:
|
||||
foo:
|
||||
name: my job
|
||||
tasks:
|
||||
# All tasks need to have a task_key.
|
||||
- notebook_task:
|
||||
notebook_path: /Users/abc/notebooks/inner
|
||||
existing_cluster_id: abcd
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,5 @@
|
|||
resources:
|
||||
jobs:
|
||||
myjob:
|
||||
# unknwon fields should cause schema failure.
|
||||
unknown_field: "value"
|
|
@ -0,0 +1,6 @@
|
|||
resources:
|
||||
models:
|
||||
mymodel:
|
||||
creation_timestamp: 123
|
||||
description: "my model"
|
||||
unknown: "value"
|
|
@ -0,0 +1 @@
|
|||
unknown: value
|
|
@ -25,12 +25,7 @@ variables:
|
|||
|
||||
# TODO: Include enums for fields that are a part of the bundle config in the generate
|
||||
# JSON schema.
|
||||
# TODO: Are all references allowed for "resources" or just ids?
|
||||
# TODO: Ideas for fails:
|
||||
# - missing required fields
|
||||
# - values of the wrong type
|
||||
# - enums with the wrong value
|
||||
# - invalid variable references, like not the right format.
|
||||
# TODO: No need for pattern overrides for string fields
|
||||
|
||||
run_as:
|
||||
service_principal_name: myserviceprincipal
|
||||
|
|
|
@ -39,7 +39,7 @@ resources:
|
|||
experiments:
|
||||
myexperiment:
|
||||
artifact_location: /dbfs/myexperiment
|
||||
last_update_time: 123
|
||||
last_update_time: ${var.complexvar.key2}
|
||||
lifecycle_stage: ${var.simplevar}
|
||||
permissions:
|
||||
- service_principal_name: myserviceprincipal
|
||||
|
|
Loading…
Reference in New Issue