mirror of https://github.com/databricks/cli.git
fix tests
This commit is contained in:
parent
44d43fccb7
commit
2eb3344edb
|
@ -19,6 +19,7 @@ import (
|
|||
"github.com/databricks/cli/libs/filer"
|
||||
"github.com/databricks/cli/libs/flags"
|
||||
"github.com/databricks/cli/libs/folders"
|
||||
"github.com/databricks/cli/libs/telemetry"
|
||||
"github.com/databricks/cli/libs/template"
|
||||
"github.com/databricks/databricks-sdk-go"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -28,6 +29,7 @@ const defaultSparkVersion = "13.3.x-snapshot-scala2.12"
|
|||
|
||||
func initTestTemplate(t testutil.TestingT, ctx context.Context, templateName string, config map[string]any) string {
|
||||
bundleRoot := t.TempDir()
|
||||
ctx = telemetry.ContextWithLogger(ctx)
|
||||
return initTestTemplateWithBundleRoot(t, ctx, templateName, config, bundleRoot)
|
||||
}
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ func TestBundleInitTelemetryForCustomTemplates(t *testing.T) {
|
|||
testcli.RequireSuccessfulRun(t, ctx, "bundle", "init", tmpDir1, "--output-dir", tmpDir2, "--config-file", filepath.Join(tmpDir3, "config.json"))
|
||||
|
||||
// Assert the telemetry payload is correctly logged. For custom templates we should
|
||||
//
|
||||
// never set template_enum_args.
|
||||
logs, err := telemetry.GetLogs(ctx)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, len(logs))
|
||||
|
|
|
@ -41,8 +41,8 @@ type logger struct {
|
|||
protoLogs []string
|
||||
}
|
||||
|
||||
// Only to be used in tests to introspect the telemetry logs that are queued
|
||||
// to be flushed.
|
||||
// This function is meant to be only to be used in tests to introspect the telemetry logs
|
||||
// that have been logged so far.
|
||||
func GetLogs(ctx context.Context) ([]FrontendLog, error) {
|
||||
l := fromContext(ctx)
|
||||
res := []FrontendLog{}
|
||||
|
|
Loading…
Reference in New Issue