address comments

This commit is contained in:
Shreyas Goenka 2025-01-07 15:35:46 +05:30
parent fc8b5e7576
commit ed59500c1e
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
3 changed files with 8 additions and 8 deletions

View File

@ -18,7 +18,7 @@ type captureSchemaDependency struct{}
// //
// This mutator translates any implicit schema references in DLT pipelines or UC Volumes // This mutator translates any implicit schema references in DLT pipelines or UC Volumes
// to the explicit syntax. // to the explicit syntax.
func ResolveSchemaDependency() bundle.Mutator { func CaptureSchemaDependency() bundle.Mutator {
return &captureSchemaDependency{} return &captureSchemaDependency{}
} }

View File

@ -13,7 +13,7 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
func TestResolveSchemaDependencyForVolume(t *testing.T) { func TestCaptureSchemaDependencyForVolume(t *testing.T) {
b := &bundle.Bundle{ b := &bundle.Bundle{
Config: config.Root{ Config: config.Root{
Resources: config.Resources{ Resources: config.Resources{
@ -77,7 +77,7 @@ func TestResolveSchemaDependencyForVolume(t *testing.T) {
}, },
} }
d := bundle.Apply(context.Background(), b, ResolveSchemaDependency()) d := bundle.Apply(context.Background(), b, CaptureSchemaDependency())
require.Nil(t, d) require.Nil(t, d)
assert.Equal(t, b.Config.Resources.Volumes["volume1"].CreateVolumeRequestContent.SchemaName, "${resources.schemas.schema1.name}") assert.Equal(t, b.Config.Resources.Volumes["volume1"].CreateVolumeRequestContent.SchemaName, "${resources.schemas.schema1.name}")
assert.Equal(t, b.Config.Resources.Volumes["volume2"].CreateVolumeRequestContent.SchemaName, "${resources.schemas.schema2.name}") assert.Equal(t, b.Config.Resources.Volumes["volume2"].CreateVolumeRequestContent.SchemaName, "${resources.schemas.schema2.name}")
@ -86,7 +86,7 @@ func TestResolveSchemaDependencyForVolume(t *testing.T) {
assert.Equal(t, b.Config.Resources.Volumes["volume5"].CreateVolumeRequestContent.SchemaName, "schemaX") assert.Equal(t, b.Config.Resources.Volumes["volume5"].CreateVolumeRequestContent.SchemaName, "schemaX")
} }
func TestResolveSchemaDependencyForPipelinesWithTarget(t *testing.T) { func TestCaptureSchemaDependencyForPipelinesWithTarget(t *testing.T) {
b := &bundle.Bundle{ b := &bundle.Bundle{
Config: config.Root{ Config: config.Root{
Resources: config.Resources{ Resources: config.Resources{
@ -159,7 +159,7 @@ func TestResolveSchemaDependencyForPipelinesWithTarget(t *testing.T) {
}, },
} }
d := bundle.Apply(context.Background(), b, ResolveSchemaDependency()) d := bundle.Apply(context.Background(), b, CaptureSchemaDependency())
require.Nil(t, d) require.Nil(t, d)
assert.Equal(t, b.Config.Resources.Pipelines["pipeline1"].Schema, "${resources.schemas.schema1.name}") assert.Equal(t, b.Config.Resources.Pipelines["pipeline1"].Schema, "${resources.schemas.schema1.name}")
assert.Equal(t, b.Config.Resources.Pipelines["pipeline2"].Schema, "${resources.schemas.schema2.name}") assert.Equal(t, b.Config.Resources.Pipelines["pipeline2"].Schema, "${resources.schemas.schema2.name}")
@ -174,7 +174,7 @@ func TestResolveSchemaDependencyForPipelinesWithTarget(t *testing.T) {
} }
} }
func TestResolveSchemaDependencyForPipelinesWithSchema(t *testing.T) { func TestCaptureSchemaDependencyForPipelinesWithSchema(t *testing.T) {
b := &bundle.Bundle{ b := &bundle.Bundle{
Config: config.Root{ Config: config.Root{
Resources: config.Resources{ Resources: config.Resources{
@ -247,7 +247,7 @@ func TestResolveSchemaDependencyForPipelinesWithSchema(t *testing.T) {
}, },
} }
d := bundle.Apply(context.Background(), b, ResolveSchemaDependency()) d := bundle.Apply(context.Background(), b, CaptureSchemaDependency())
require.Nil(t, d) require.Nil(t, d)
assert.Equal(t, b.Config.Resources.Pipelines["pipeline1"].Target, "${resources.schemas.schema1.name}") assert.Equal(t, b.Config.Resources.Pipelines["pipeline1"].Target, "${resources.schemas.schema1.name}")
assert.Equal(t, b.Config.Resources.Pipelines["pipeline2"].Target, "${resources.schemas.schema2.name}") assert.Equal(t, b.Config.Resources.Pipelines["pipeline2"].Target, "${resources.schemas.schema2.name}")

View File

@ -63,7 +63,7 @@ func Initialize() bundle.Mutator {
"workspace", "workspace",
"variables", "variables",
), ),
mutator.ResolveSchemaDependency(), mutator.CaptureSchemaDependency(),
// Provide permission config errors & warnings after initializing all variables // Provide permission config errors & warnings after initializing all variables
permissions.PermissionDiagnostics(), permissions.PermissionDiagnostics(),
mutator.SetRunAs(), mutator.SetRunAs(),