mirror of https://github.com/databricks/cli.git
lint
This commit is contained in:
parent
1912ebd8f6
commit
bb9747e1e2
|
@ -40,20 +40,22 @@ func TestTelemetryLogger(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Log some events.
|
// Log some events.
|
||||||
telemetry.Log(ctx, telemetry.FrontendLogEntry{
|
err := telemetry.Log(ctx, telemetry.FrontendLogEntry{
|
||||||
DatabricksCliLog: telemetry.DatabricksCliLog{
|
DatabricksCliLog: telemetry.DatabricksCliLog{
|
||||||
CliTestEvent: telemetry.CliTestEvent{
|
CliTestEvent: telemetry.CliTestEvent{
|
||||||
Name: telemetry.DummyCliEnumValue1,
|
Name: telemetry.DummyCliEnumValue1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
telemetry.Log(ctx, telemetry.FrontendLogEntry{
|
require.NoError(t, err)
|
||||||
|
err = telemetry.Log(ctx, telemetry.FrontendLogEntry{
|
||||||
DatabricksCliLog: telemetry.DatabricksCliLog{
|
DatabricksCliLog: telemetry.DatabricksCliLog{
|
||||||
CliTestEvent: telemetry.CliTestEvent{
|
CliTestEvent: telemetry.CliTestEvent{
|
||||||
Name: telemetry.DummyCliEnumValue2,
|
Name: telemetry.DummyCliEnumValue2,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
apiClient, err := client.New(w.W.Config)
|
apiClient, err := client.New(w.W.Config)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
|
@ -54,7 +54,8 @@ var MaxAdditionalWaitTime = 2 * time.Second
|
||||||
// batching the logs across multiple API calls.
|
// batching the logs across multiple API calls.
|
||||||
func Flush(ctx context.Context, apiClient DatabricksApiClient) {
|
func Flush(ctx context.Context, apiClient DatabricksApiClient) {
|
||||||
// Set a maximum time to wait for the telemetry event to flush.
|
// Set a maximum time to wait for the telemetry event to flush.
|
||||||
ctx, _ = context.WithTimeout(ctx, MaxAdditionalWaitTime)
|
ctx, cancel := context.WithTimeout(ctx, MaxAdditionalWaitTime)
|
||||||
|
defer cancel()
|
||||||
l := fromContext(ctx)
|
l := fromContext(ctx)
|
||||||
|
|
||||||
// We pass the API client as an arg to mock it in unit tests.
|
// We pass the API client as an arg to mock it in unit tests.
|
||||||
|
|
Loading…
Reference in New Issue