mirror of https://github.com/databricks/cli.git
fixed lint
This commit is contained in:
parent
59c8254770
commit
438c19f2af
|
@ -20,7 +20,7 @@ import (
|
||||||
|
|
||||||
func TestAppUploadConfig(t *testing.T) {
|
func TestAppUploadConfig(t *testing.T) {
|
||||||
root := t.TempDir()
|
root := t.TempDir()
|
||||||
err := os.MkdirAll(filepath.Join(root, "my_app"), 0700)
|
err := os.MkdirAll(filepath.Join(root, "my_app"), 0o700)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
b := &bundle.Bundle{
|
b := &bundle.Bundle{
|
||||||
|
|
|
@ -9,8 +9,7 @@ import (
|
||||||
"github.com/databricks/cli/libs/diag"
|
"github.com/databricks/cli/libs/diag"
|
||||||
)
|
)
|
||||||
|
|
||||||
type validate struct {
|
type validate struct{}
|
||||||
}
|
|
||||||
|
|
||||||
func (v *validate) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics {
|
func (v *validate) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics {
|
||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
|
@ -29,10 +29,6 @@ func (appConverter) Convert(ctx context.Context, key string, vin dyn.Value, out
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the converted resource to the output.
|
// Add the converted resource to the output.
|
||||||
out.App[key] = vout.AsAny()
|
out.App[key] = vout.AsAny()
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestConvertApp(t *testing.T) {
|
func TestConvertApp(t *testing.T) {
|
||||||
var src = resources.App{
|
src := resources.App{
|
||||||
SourceCodePath: "./app",
|
SourceCodePath: "./app",
|
||||||
Config: map[string]any{
|
Config: map[string]any{
|
||||||
"command": []string{"python", "app.py"},
|
"command": []string{"python", "app.py"},
|
||||||
|
@ -95,5 +95,4 @@ func TestConvertApp(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, out.Permissions["app_my_app"])
|
}, out.Permissions["app_my_app"])
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,6 @@ func (a *appRunner) start(ctx context.Context) error {
|
||||||
}
|
}
|
||||||
logProgress(ctx, "App is starting...")
|
logProgress(ctx, "App is starting...")
|
||||||
}).Get()
|
}).Get()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -149,7 +148,6 @@ func (a *appRunner) deploy(ctx context.Context) error {
|
||||||
SourceCodePath: app.SourceCodePath,
|
SourceCodePath: app.SourceCodePath,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
// If deploy returns an error, then there's an active deployment in progress, wait for it to complete.
|
// If deploy returns an error, then there's an active deployment in progress, wait for it to complete.
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -161,7 +159,6 @@ func (a *appRunner) deploy(ctx context.Context) error {
|
||||||
}
|
}
|
||||||
logProgress(ctx, ad.Status.Message)
|
logProgress(ctx, ad.Status.Message)
|
||||||
}).Get()
|
}).Get()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,5 +57,4 @@ func TestAppsOverride(t *testing.T) {
|
||||||
assert.Equal(t, "key", app.Resources[2].Secret.Key)
|
assert.Equal(t, "key", app.Resources[2].Secret.Key)
|
||||||
assert.Equal(t, "scope", app.Resources[2].Secret.Scope)
|
assert.Equal(t, "scope", app.Resources[2].Secret.Scope)
|
||||||
assert.Equal(t, "CAN_USE", string(app.Resources[2].Secret.Permission))
|
assert.Equal(t, "CAN_USE", string(app.Resources[2].Secret.Permission))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ func runResource(t testutil.TestingT, ctx context.Context, path, key string) (st
|
||||||
return stdout.String(), err
|
return stdout.String(), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func runResourceWithStderr(t testutil.TestingT, ctx context.Context, path string, key string) (string, string, error) {
|
func runResourceWithStderr(t testutil.TestingT, ctx context.Context, path, key string) (string, string, error) {
|
||||||
ctx = env.Set(ctx, "BUNDLE_ROOT", path)
|
ctx = env.Set(ctx, "BUNDLE_ROOT", path)
|
||||||
ctx = cmdio.NewContext(ctx, cmdio.Default())
|
ctx = cmdio.NewContext(ctx, cmdio.Default())
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ func runResourceWithStderr(t testutil.TestingT, ctx context.Context, path string
|
||||||
return stdout.String(), stderr.String(), err
|
return stdout.String(), stderr.String(), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func runResourceWithParams(t testutil.TestingT, ctx context.Context, path string, key string, params ...string) (string, error) {
|
func runResourceWithParams(t testutil.TestingT, ctx context.Context, path, key string, params ...string) (string, error) {
|
||||||
ctx = env.Set(ctx, "BUNDLE_ROOT", path)
|
ctx = env.Set(ctx, "BUNDLE_ROOT", path)
|
||||||
ctx = cmdio.NewContext(ctx, cmdio.Default())
|
ctx = cmdio.NewContext(ctx, cmdio.Default())
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ type elementsByKey struct {
|
||||||
keyFunc func(dyn.Value) string
|
keyFunc func(dyn.Value) string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e elementsByKey) doMap(_ dyn.Path, v dyn.Value, mergeFunc func(a dyn.Value, b dyn.Value) (dyn.Value, error)) (dyn.Value, error) {
|
func (e elementsByKey) doMap(_ dyn.Path, v dyn.Value, mergeFunc func(a, b dyn.Value) (dyn.Value, error)) (dyn.Value, error) {
|
||||||
// We know the type of this value is a sequence.
|
// We know the type of this value is a sequence.
|
||||||
// For additional defence, return self if it is not.
|
// For additional defence, return self if it is not.
|
||||||
elements, ok := v.AsSequence()
|
elements, ok := v.AsSequence()
|
||||||
|
@ -60,7 +60,7 @@ func (e elementsByKey) Map(_ dyn.Path, v dyn.Value) (dyn.Value, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e elementsByKey) MapWithOverride(p dyn.Path, v dyn.Value) (dyn.Value, error) {
|
func (e elementsByKey) MapWithOverride(p dyn.Path, v dyn.Value) (dyn.Value, error) {
|
||||||
return e.doMap(nil, v, func(a dyn.Value, b dyn.Value) (dyn.Value, error) {
|
return e.doMap(nil, v, func(a, b dyn.Value) (dyn.Value, error) {
|
||||||
return Override(a, b, OverrideVisitor{
|
return Override(a, b, OverrideVisitor{
|
||||||
VisitInsert: func(_ dyn.Path, v dyn.Value) (dyn.Value, error) {
|
VisitInsert: func(_ dyn.Path, v dyn.Value) (dyn.Value, error) {
|
||||||
return v, nil
|
return v, nil
|
||||||
|
@ -68,7 +68,7 @@ func (e elementsByKey) MapWithOverride(p dyn.Path, v dyn.Value) (dyn.Value, erro
|
||||||
VisitDelete: func(valuePath dyn.Path, left dyn.Value) error {
|
VisitDelete: func(valuePath dyn.Path, left dyn.Value) error {
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
VisitUpdate: func(_ dyn.Path, a dyn.Value, b dyn.Value) (dyn.Value, error) {
|
VisitUpdate: func(_ dyn.Path, a, b dyn.Value) (dyn.Value, error) {
|
||||||
return b, nil
|
return b, nil
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue