Skip to content

Commit 3f61d77

Browse files
committed
add more tests and follow up in integration tests
1 parent 40aad49 commit 3f61d77

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

libbeat/outputs/elasticsearch/client_integration_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,8 @@ func connectTestEs(t *testing.T, cfg interface{}, stats outputs.Observer) (outpu
420420
}
421421

422422
info := beat.Info{Beat: "libbeat"}
423-
im, _ := idxmgmt.DefaultSupport(nil, info, nil)
423+
// ILM must be disabled otherwise custom index settings are ignored.
424+
im, _ := idxmgmt.DefaultSupport(nil, info, disabledILMConfig())
424425
output, err := makeES(im, info, stats, config)
425426
if err != nil {
426427
t.Fatal(err)
@@ -438,6 +439,10 @@ func connectTestEs(t *testing.T, cfg interface{}, stats outputs.Observer) (outpu
438439
return client, client
439440
}
440441

442+
func disabledILMConfig() *common.Config {
443+
return common.MustNewConfigFrom(map[string]interface{}{"setup": map[string]interface{}{"ilm": map[string]interface{}{"enabled": false}}})
444+
}
445+
441446
// setupRoleMapping sets up role mapping for the Kerberos user beats@ELASTIC
442447
func setupRoleMapping(t *testing.T, host string) error {
443448
_, client := connectTestEsWithoutStats(t, map[string]interface{}{

libbeat/outputs/elasticsearch/client_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,21 @@ func TestBulkEncodeEvents(t *testing.T) {
423423
ilmConfig: common.NewConfig(),
424424
events: []common.MapStr{{"message": "test"}},
425425
},
426+
"require_alias not supported": {
427+
version: "7.9.0",
428+
docType: "",
429+
config: common.MapStr{},
430+
ilmConfig: common.NewConfig(),
431+
events: []common.MapStr{{"message": "test"}},
432+
},
433+
"require_alias is supported": {
434+
version: "7.10.0",
435+
docType: "",
436+
config: common.MapStr{},
437+
ilmConfig: common.NewConfig(),
438+
isAlias: true,
439+
events: []common.MapStr{{"message": "test"}},
440+
},
426441
"latest with ILM": {
427442
version: version.GetDefaultVersion(),
428443
docType: "",

0 commit comments

Comments
 (0)