mirror of https://github.com/databricks/cli.git
Compare commits
3 Commits
e4d0a2da3b
...
0ac536f188
Author | SHA1 | Date |
---|---|---|
|
0ac536f188 | |
|
0142c62a5b | |
|
5752d19d3d |
|
@ -54,5 +54,5 @@ func TestGetNativeTemplateByName(t *testing.T) {
|
|||
assert.Equal(t, "The default Python template for Notebooks / Delta Live Tables / Workflows", getNativeTemplateByName("default-python").description)
|
||||
assert.Equal(t, "", getNativeTemplateByName("default-python").gitUrl)
|
||||
|
||||
assert.Nil(t, nil, getNativeTemplateByName("invalid"))
|
||||
assert.Nil(t, getNativeTemplateByName("invalid"))
|
||||
}
|
||||
|
|
|
@ -73,9 +73,9 @@ func TestBundleInitOnMlopsStacks(t *testing.T) {
|
|||
// Assert the telemetry payload is correctly logged.
|
||||
logs := telemetry.GetLogs(ctx)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, len(logs))
|
||||
require.Len(t, len(logs), 1)
|
||||
event := logs[0].Entry.DatabricksCliLog.BundleInitEvent
|
||||
assert.Equal(t, event.TemplateName, "mlops-stacks")
|
||||
assert.Equal(t, "mlops-stacks", event.TemplateName)
|
||||
|
||||
get := func(key string) string {
|
||||
for _, v := range event.TemplateEnumArgs {
|
||||
|
@ -87,11 +87,11 @@ func TestBundleInitOnMlopsStacks(t *testing.T) {
|
|||
}
|
||||
|
||||
// Enum values should be present in the telemetry payload.
|
||||
assert.Equal(t, get("input_include_models_in_unity_catalog"), "no")
|
||||
assert.Equal(t, get("input_cloud"), strings.ToLower(env))
|
||||
assert.Equal(t, "no", get("input_include_models_in_unity_catalog"))
|
||||
assert.Equal(t, strings.ToLower(env), get("input_cloud"))
|
||||
// Freeform strings should not be present in the telemetry payload.
|
||||
assert.Equal(t, get("input_project_name"), "")
|
||||
assert.Equal(t, get("input_root_dir"), "")
|
||||
assert.Equal(t, "", get("input_project_name"))
|
||||
assert.Equal(t, "", get("input_root_dir"))
|
||||
|
||||
// Assert that the README.md file was created
|
||||
contents := testutil.ReadFile(t, filepath.Join(tmpDir2, "repo_name", projectName, "README.md"))
|
||||
|
@ -200,7 +200,7 @@ func TestBundleInitTelemetryForDefaultTemplates(t *testing.T) {
|
|||
// Assert the telemetry payload is correctly logged.
|
||||
logs := telemetry.GetLogs(ctx)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, len(logs))
|
||||
require.Len(t, len(logs), 1)
|
||||
event := logs[0].Entry.DatabricksCliLog.BundleInitEvent
|
||||
assert.Equal(t, event.TemplateName, tc.name)
|
||||
|
||||
|
@ -269,9 +269,9 @@ func TestBundleInitTelemetryForCustomTemplates(t *testing.T) {
|
|||
// never set template_enum_args.
|
||||
logs := telemetry.GetLogs(ctx)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, len(logs))
|
||||
require.Len(t, len(logs), 1)
|
||||
event := logs[0].Entry.DatabricksCliLog.BundleInitEvent
|
||||
assert.Equal(t, event.TemplateName, "custom")
|
||||
assert.Equal(t, "custom", event.TemplateName)
|
||||
assert.Empty(t, event.TemplateEnumArgs)
|
||||
|
||||
// Ensure that the UUID returned by the `bundle_uuid` helper is the same UUID
|
||||
|
|
|
@ -57,7 +57,7 @@ func TestTelemetryLogger(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
assert.Equal(t, reflect.TypeOf(telemetry.DatabricksCliLog{}).NumField(), len(events),
|
||||
assert.Len(t, reflect.TypeOf(telemetry.DatabricksCliLog{}).NumField(), len(events),
|
||||
"Number of events should match the number of fields in DatabricksCliLog. Please add a new event to this test.")
|
||||
|
||||
ctx, w := acc.WorkspaceTest(t)
|
||||
|
|
|
@ -44,7 +44,7 @@ func GetLogs(ctx context.Context) []FrontendLog {
|
|||
// Maximum additional time to wait for the telemetry event to flush. We expect the flush
|
||||
// method to be called when the CLI command is about to exist, so this caps the maximum
|
||||
// additional time the user will experience because of us logging CLI telemetry.
|
||||
var MaxAdditionalWaitTime = 5 * time.Second
|
||||
var MaxAdditionalWaitTime = 3 * time.Second
|
||||
|
||||
// We make the API call to the /telemetry-ext endpoint to log the CLI telemetry events
|
||||
// right about as the CLI command is about to exit. The API endpoint can handle
|
||||
|
|
Loading…
Reference in New Issue