Skip to content

Commit

Permalink
add test for multiple resources
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyas-goenka committed Sep 27, 2024
1 parent 4373e7b commit 65ad2f0
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 0 deletions.
46 changes: 46 additions & 0 deletions bundle/config/loader/process_include_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func TestProcessIncludeFormatPass(t *testing.T) {
"one_pipeline.pipeline.yaml",
"two_job.yml",
"job_and_pipeline.yml",
"multiple_resources.yml",
} {
t.Run(fileName, func(t *testing.T) {
b := &bundle.Bundle{
Expand Down Expand Up @@ -152,6 +153,51 @@ func TestProcessIncludeFormatFail(t *testing.T) {
},
},
},
"multiple_resources.model_serving_endpoint.yml": {
{
Severity: diag.Recommendation,
Summary: "We recommend only defining a single model_serving_endpoint in a file with the .model_serving_endpoint.yml extension.",
Detail: `The following resources are defined or configured in this file:
- experiment1 (experiment)
- job1 (job)
- job2 (job)
- job3 (job)
- model1 (model)
- model_serving_endpoint1 (model_serving_endpoint)
- pipeline1 (pipeline)
- pipeline2 (pipeline)
- quality_monitor1 (quality_monitor)
- registered_model1 (registered_model)
- schema1 (schema)
`,
Locations: []dyn.Location{
{File: filepath.FromSlash("testdata/format_fail/multiple_resources.model_serving_endpoint.yml"), Line: 12, Column: 7},
{File: filepath.FromSlash("testdata/format_fail/multiple_resources.model_serving_endpoint.yml"), Line: 14, Column: 7},
{File: filepath.FromSlash("testdata/format_fail/multiple_resources.model_serving_endpoint.yml"), Line: 18, Column: 7},
{File: filepath.FromSlash("testdata/format_fail/multiple_resources.model_serving_endpoint.yml"), Line: 22, Column: 7},
{File: filepath.FromSlash("testdata/format_fail/multiple_resources.model_serving_endpoint.yml"), Line: 24, Column: 7},
{File: filepath.FromSlash("testdata/format_fail/multiple_resources.model_serving_endpoint.yml"), Line: 28, Column: 7},
{File: filepath.FromSlash("testdata/format_fail/multiple_resources.model_serving_endpoint.yml"), Line: 35, Column: 11},
{File: filepath.FromSlash("testdata/format_fail/multiple_resources.model_serving_endpoint.yml"), Line: 39, Column: 11},
{File: filepath.FromSlash("testdata/format_fail/multiple_resources.model_serving_endpoint.yml"), Line: 43, Column: 11},
{File: filepath.FromSlash("testdata/format_fail/multiple_resources.model_serving_endpoint.yml"), Line: 4, Column: 7},
{File: filepath.FromSlash("testdata/format_fail/multiple_resources.model_serving_endpoint.yml"), Line: 8, Column: 7},
},
Paths: []dyn.Path{
dyn.MustPathFromString("resources.experiments.experiment1"),
dyn.MustPathFromString("resources.jobs.job1"),
dyn.MustPathFromString("resources.jobs.job2"),
dyn.MustPathFromString("resources.model_serving_endpoints.model_serving_endpoint1"),
dyn.MustPathFromString("resources.models.model1"),
dyn.MustPathFromString("resources.pipelines.pipeline1"),
dyn.MustPathFromString("resources.pipelines.pipeline2"),
dyn.MustPathFromString("resources.schemas.schema1"),
dyn.MustPathFromString("targets.target1.resources.jobs.job3"),
dyn.MustPathFromString("targets.target1.resources.quality_monitors.quality_monitor1"),
dyn.MustPathFromString("targets.target1.resources.registered_models.registered_model1"),
},
},
},
} {
t.Run(fileName, func(t *testing.T) {
b := &bundle.Bundle{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
resources:
experiments:
experiment1:
name: experiment1

model_serving_endpoints:
model_serving_endpoint1:
name: model_serving_endpoint1

jobs:
job1:
name: job1
job2:
name: job2

models:
model1:
name: model1

pipelines:
pipeline1:
name: pipeline1
pipeline2:
name: pipeline2

schemas:
schema1:
name: schema1

targets:
target1:
resources:
quality_monitors:
quality_monitor1:
baseline_table_name: quality_monitor1

jobs:
job3:
name: job3

registered_models:
registered_model1:
name: registered_model1
43 changes: 43 additions & 0 deletions bundle/config/loader/testdata/format_pass/multiple_resources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
resources:
experiments:
experiment1:
name: experiment1

model_serving_endpoints:
model_serving_endpoint1:
name: model_serving_endpoint1

jobs:
job1:
name: job1
job2:
name: job2

models:
model1:
name: model1

pipelines:
pipeline1:
name: pipeline1
pipeline2:
name: pipeline2

schemas:
schema1:
name: schema1

targets:
target1:
resources:
quality_monitors:
quality_monitor1:
baseline_table_name: quality_monitor1

jobs:
job3:
name: job3

registered_models:
registered_model1:
name: registered_model1

0 comments on commit 65ad2f0

Please sign in to comment.