mirror of https://github.com/dapr/cli.git
* fix shutdown hang when enable socket Signed-off-by: Loong <loong.dai@intel.com> * feedback Signed-off-by: Loong <loong.dai@intel.com> Co-authored-by: Loong <loong.dai@intel.com> Co-authored-by: Mukundan Sundararajan <musundar@microsoft.com> Co-authored-by: Long Dai <long.dai@intel.com> Co-authored-by: Loong <loong.dai@intel.com> Co-authored-by: Mukundan Sundararajan <musundar@microsoft.com>
This commit is contained in:
parent
de0d2a4c95
commit
3287fa264c
|
@ -78,6 +78,10 @@ func Put(httpPort int, key, value, appID, socket string) error {
|
|||
}
|
||||
|
||||
defer r.Body.Close()
|
||||
if socket != "" {
|
||||
// Retryablehttp does not close idle socket connections.
|
||||
defer client.HTTPClient.CloseIdleConnections()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -37,9 +37,7 @@ const (
|
|||
daprDashboardVersion = "0.9.0"
|
||||
)
|
||||
|
||||
// Removing unix domain socket tests till shutdown API with unix domain sockets is fixed.
|
||||
// https://github.com/dapr/dapr/issues/3894
|
||||
var socketCases = []string{""}
|
||||
var socketCases = []string{"", "/tmp"}
|
||||
|
||||
func TestStandaloneInstall(t *testing.T) {
|
||||
// Ensure a clean environment.
|
||||
|
@ -382,14 +380,13 @@ func testRun(t *testing.T) {
|
|||
assert.Contains(t, output, "Exited Dapr successfully")
|
||||
})
|
||||
|
||||
// t.Run("API shutdown with socket", func(t *testing.T) {
|
||||
// // Test that the CLI exits on a daprd shutdown.
|
||||
// output, err := spawn.Command(daprPath, "run", "--app-id", "testapp", "--unix-domain-socket", "/tmp", "--", "bash", "-c", "curl --unix-socket /tmp/dapr-testapp-http.socket -v -X POST http://unix/v1.0/shutdown; sleep 10; exit 1")
|
||||
// t.Log(output)
|
||||
// require.NoError(t, err, "run failed")
|
||||
// assert.Contains(t, output, "Exited App successfully", "App should be shutdown before it has a chance to return non-zero")
|
||||
// assert.Contains(t, output, "Exited Dapr successfully")
|
||||
// })
|
||||
t.Run("API shutdown with socket", func(t *testing.T) {
|
||||
// Test that the CLI exits on a daprd shutdown.
|
||||
output, err := spawn.Command(daprPath, "run", "--app-id", "testapp", "--unix-domain-socket", "/tmp", "--", "bash", "-c", "curl --unix-socket /tmp/dapr-testapp-http.socket -v -X POST http://unix/v1.0/shutdown; sleep 10; exit 1")
|
||||
t.Log(output)
|
||||
require.NoError(t, err, "run failed")
|
||||
assert.Contains(t, output, "Exited Dapr successfully")
|
||||
})
|
||||
}
|
||||
|
||||
func executeAgainstRunningDapr(t *testing.T, f func(), daprArgs ...string) {
|
||||
|
|
Loading…
Reference in New Issue