mirror of https://github.com/databricks/cli.git
add test for timeout
This commit is contained in:
parent
a652b449cb
commit
972741dcb4
|
@ -296,6 +296,10 @@ func runTest(t *testing.T, dir, coverDir string, repls testdiff.ReplacementsCont
|
|||
items := strings.Split(stub.Pattern, " ")
|
||||
require.Len(t, items, 2)
|
||||
server.Handle(items[0], items[1], func(req testserver.Request) any {
|
||||
if stub.DelaySeconds > 0 {
|
||||
time.Sleep(time.Duration(stub.DelaySeconds) * time.Second)
|
||||
}
|
||||
|
||||
return stub.Response
|
||||
})
|
||||
}
|
||||
|
|
|
@ -67,6 +67,9 @@ type ServerStub struct {
|
|||
|
||||
// The response body to return.
|
||||
Response testserver.Response
|
||||
|
||||
// Artificial delay in seconds to simulate slow responses.
|
||||
DelaySeconds int
|
||||
}
|
||||
|
||||
// FindConfigs finds all the config relevant for this test,
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
"uploadTime": "UNIX_TIME_MILLIS",
|
||||
"items": [],
|
||||
"protoLogs": [
|
||||
"{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"[OS]\",\"execution_time_ms\":1},\"cli_test_event\":{\"name\":\"VALUE1\"}}}}",
|
||||
"{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"[OS]\",\"execution_time_ms\":1},\"cli_test_event\":{\"name\":\"VALUE2\"}}}}"
|
||||
"{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"[OS]\"},\"cli_test_event\":{\"name\":\"VALUE1\"}}}}",
|
||||
"{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"[OS]\"},\"cli_test_event\":{\"name\":\"VALUE2\"}}}}"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -27,8 +27,8 @@
|
|||
"uploadTime": "UNIX_TIME_MILLIS",
|
||||
"items": [],
|
||||
"protoLogs": [
|
||||
"{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"[OS]\",\"execution_time_ms\":1},\"cli_test_event\":{\"name\":\"VALUE1\"}}}}",
|
||||
"{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"[OS]\",\"execution_time_ms\":1},\"cli_test_event\":{\"name\":\"VALUE2\"}}}}"
|
||||
"{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"[OS]\"},\"cli_test_event\":{\"name\":\"VALUE1\"}}}}",
|
||||
"{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"[OS]\"},\"cli_test_event\":{\"name\":\"VALUE2\"}}}}"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -44,8 +44,8 @@
|
|||
"uploadTime": "UNIX_TIME_MILLIS",
|
||||
"items": [],
|
||||
"protoLogs": [
|
||||
"{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"[OS]\",\"execution_time_ms\":1},\"cli_test_event\":{\"name\":\"VALUE1\"}}}}",
|
||||
"{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"[OS]\",\"execution_time_ms\":1},\"cli_test_event\":{\"name\":\"VALUE2\"}}}}"
|
||||
"{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"[OS]\"},\"cli_test_event\":{\"name\":\"VALUE1\"}}}}",
|
||||
"{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"[OS]\"},\"cli_test_event\":{\"name\":\"VALUE2\"}}}}"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@ HH:MM:SS Debug: POST /telemetry-ext
|
|||
> {
|
||||
> "items": null,
|
||||
> "protoLogs": [
|
||||
> "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"... (232 more bytes)",
|
||||
> "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"... (232 more bytes)"
|
||||
> "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"... (210 more bytes)",
|
||||
> "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"... (210 more bytes)"
|
||||
> ],
|
||||
> "uploadTime": "UNIX_TIME_MILLIS"
|
||||
> }
|
||||
|
@ -22,8 +22,8 @@ HH:MM:SS Debug: POST /telemetry-ext
|
|||
> {
|
||||
> "items": null,
|
||||
> "protoLogs": [
|
||||
> "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"... (232 more bytes)",
|
||||
> "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"... (232 more bytes)"
|
||||
> "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"... (210 more bytes)",
|
||||
> "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"... (210 more bytes)"
|
||||
> ],
|
||||
> "uploadTime": "UNIX_TIME_MILLIS"
|
||||
> }
|
||||
|
@ -38,8 +38,8 @@ HH:MM:SS Debug: POST /telemetry-ext
|
|||
> {
|
||||
> "items": null,
|
||||
> "protoLogs": [
|
||||
> "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"... (232 more bytes)",
|
||||
> "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"... (232 more bytes)"
|
||||
> "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"... (210 more bytes)",
|
||||
> "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"... (210 more bytes)"
|
||||
> ],
|
||||
> "uploadTime": "UNIX_TIME_MILLIS"
|
||||
> }
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"headers": {
|
||||
"Authorization": [
|
||||
"Bearer [DATABRICKS_TOKEN]"
|
||||
]
|
||||
},
|
||||
"method": "POST",
|
||||
"path": "/telemetry-ext",
|
||||
"body": {
|
||||
"uploadTime": "UNIX_TIME_MILLIS",
|
||||
"items": [],
|
||||
"protoLogs": [
|
||||
"{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"[OS]\",\"execution_time_ms\":1},\"cli_test_event\":{\"name\":\"VALUE1\"}}}}",
|
||||
"{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"[OS]\",\"execution_time_ms\":1},\"cli_test_event\":{\"name\":\"VALUE2\"}}}}"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
>>> [CLI] selftest send-telemetry --debug
|
||||
HH:MM:SS Info: start pid=PID version=[DEV_VERSION] args="[CLI], selftest, send-telemetry, --debug"
|
||||
HH:MM:SS Info: completed execution pid=PID exit_code=0
|
||||
HH:MM:SS Debug: POST /telemetry-ext
|
||||
> {
|
||||
> "items": null,
|
||||
> "protoLogs": [
|
||||
> "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"... (232 more bytes)",
|
||||
> "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"... (232 more bytes)"
|
||||
> ],
|
||||
> "uploadTime": "UNIX_TIME_MILLIS"
|
||||
> }
|
||||
< Error: Post "[DATABRICKS_URL]/telemetry-ext": context deadline exceeded pid=PID sdk=true
|
||||
HH:MM:SS Debug: non-retriable error: Post "[DATABRICKS_URL]/telemetry-ext": context deadline exceeded pid=PID sdk=true
|
||||
HH:MM:SS Debug: failed to upload telemetry: uploading telemetry logs timed out: context deadline exceeded pid=PID
|
|
@ -0,0 +1 @@
|
|||
trace $CLI selftest send-telemetry --debug
|
|
@ -0,0 +1,18 @@
|
|||
[[Server]]
|
||||
Pattern = "POST /telemetry-ext"
|
||||
Response.Body = '''
|
||||
{
|
||||
"errors": [],
|
||||
"numProtoSuccess": 2
|
||||
}
|
||||
'''
|
||||
DelaySeconds = 5
|
||||
|
||||
|
||||
[[Repls]]
|
||||
Old = "(?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]"
|
||||
New = "HH:MM:SS"
|
||||
|
||||
[[Repls]]
|
||||
Old = "pid=[0-9]+"
|
||||
New = "pid=PID"
|
Loading…
Reference in New Issue