File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
internal/storage/v1/elasticsearch Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -318,8 +318,15 @@ func TestESStorageFactoryWithConfig(t *testing.T) {
318318
319319func TestESStorageFactoryWithConfigError (t * testing.T ) {
320320 t .Parallel ()
321+ server := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
322+ if r .URL .Path == "/" {
323+ w .WriteHeader (http .StatusInternalServerError )
324+ return
325+ }
326+ }))
327+ defer server .Close ()
321328 cfg := escfg.Configuration {
322- Servers : []string {"http://invalid-host-name:65535" },
329+ Servers : []string {server . URL },
323330 DisableHealthCheck : true ,
324331 LogLevel : "error" ,
325332 }
Original file line number Diff line number Diff line change @@ -103,6 +103,12 @@ func TestArchiveFactory(t *testing.T) {
103103
104104func TestFactoryInitializeErr (t * testing.T ) {
105105 t .Parallel ()
106+ server := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
107+ if r .URL .Path == "/" {
108+ w .WriteHeader (http .StatusInternalServerError )
109+ }
110+ }))
111+ defer server .Close ()
106112 tests := []struct {
107113 name string
108114 factory * Factory
@@ -116,7 +122,7 @@ func TestFactoryInitializeErr(t *testing.T) {
116122 {
117123 name : "server error" ,
118124 factory : & Factory {Options : & Options {Config : namespaceConfig {Configuration : escfg.Configuration {
119- Servers : []string {"http://invalid-host-name:9200" },
125+ Servers : []string {server . URL },
120126 DisableHealthCheck : true ,
121127 }}}},
122128 expectedErr : "failed to create Elasticsearch client" ,
You can’t perform that action at this time.
0 commit comments