Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-Pick into Release 1.5 PR #835 #845

Merged
merged 1 commit into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/metadata/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
19 changes: 8 additions & 11 deletions tests/e2e/standalone/standalone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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) {
Expand Down