mirror of https://github.com/databricks/cli.git
lint
This commit is contained in:
parent
0142c62a5b
commit
0ac536f188
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue