-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: HttpSink with cannot assign requested address issue (#16)
Signed-off-by: Saravanan Balasubramanian <[email protected]>
- Loading branch information
1 parent
cbe2eec
commit 1d49640
Showing
4 changed files
with
56 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/numaproj/numaflow/pkg/shared/logging" | ||
"github.com/stretchr/testify/assert" | ||
"net/http" | ||
"net/http/httptest" | ||
"testing" | ||
) | ||
|
||
func TestHttp_client(t *testing.T) { | ||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | ||
w.WriteHeader(http.StatusNoContent) | ||
|
||
})) | ||
hs := httpSink{} | ||
hs.url = server.URL | ||
hs.method = http.MethodPost | ||
hs.logger = logging.NewLogger().Named("http-sink") | ||
err := hs.sendHTTPRequest(nil) | ||
assert.Error(t, err) | ||
|
||
hs.createHTTPClient() | ||
err = hs.sendHTTPRequest(nil) | ||
assert.NoError(t, err) | ||
} |