This repository has been archived by the owner on Sep 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* POC for logstash output still to do: - support async go-lumber client - support bulk_max_size - support windowing - support load balancing - support backoff - determine if codecs are needed - update default config Closes #129
- Loading branch information
Showing
19 changed files
with
952 additions
and
225 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -852,6 +852,29 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/go-elasticsearc | |
limitations under the License. | ||
|
||
|
||
-------------------------------------------------------------------------------- | ||
Dependency : github.com/elastic/go-lumber | ||
Version: v0.1.1 | ||
Licence type (autodetected): Apache-2.0 | ||
-------------------------------------------------------------------------------- | ||
|
||
Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected]/LICENSE: | ||
|
||
Copyright (c) 2012–2016 Elasticsearch <http://www.elastic.co> | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
|
||
|
||
-------------------------------------------------------------------------------- | ||
Dependency : github.com/elastic/go-ucfg | ||
Version: v0.8.6 | ||
|
@@ -21739,29 +21762,6 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/go-lookslike@v0 | |
limitations under the License. | ||
|
||
|
||
-------------------------------------------------------------------------------- | ||
Dependency : github.com/elastic/go-lumber | ||
Version: v0.1.0 | ||
Licence type (autodetected): Apache-2.0 | ||
-------------------------------------------------------------------------------- | ||
|
||
Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected]/LICENSE: | ||
|
||
Copyright (c) 2012–2016 Elasticsearch <http://www.elastic.co> | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
|
||
|
||
-------------------------------------------------------------------------------- | ||
Dependency : github.com/elastic/go-perf | ||
Version: v0.0.0-20191212140718-9c656876f595 | ||
|
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
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,214 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License; | ||
// you may not use this file except in compliance with the Elastic License. | ||
//go:build integration | ||
|
||
package integration | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/elastic/elastic-agent-shipper-client/pkg/proto/messages" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestServerStarts(t *testing.T) { | ||
config := ` | ||
server: | ||
strict_mode: false | ||
port: 50052 | ||
tls: false | ||
logging: | ||
level: debug | ||
selectors: ["*"] | ||
to_stderr: true | ||
output: | ||
console: | ||
enabled: true | ||
` | ||
env := NewTestingEnvironment(t, config) | ||
t.Cleanup(func() { env.Stop() }) | ||
|
||
found := env.WaitUntil("stderr", "gRPC server is ready and is listening on") | ||
|
||
if !found { | ||
env.Fatalf("Test executable failed to start.") | ||
} | ||
} | ||
|
||
func TestServerFailsToStart(t *testing.T) { | ||
config := ` | ||
server: | ||
strict_mode: false | ||
port: 50052 | ||
tls: not_boolean | ||
logging: | ||
level: debug | ||
selectors: ["*"] | ||
to_stderr: true | ||
output: | ||
console: | ||
enabled: true | ||
` | ||
|
||
env := NewTestingEnvironment(t, config) | ||
t.Cleanup(func() { env.Stop() }) | ||
|
||
found := env.WaitUntil("stderr", "error unpacking shipper config") | ||
|
||
if !found { | ||
env.Fatalf("didn't error on bad config") | ||
} | ||
} | ||
|
||
func TestPublishMessage(t *testing.T) { | ||
config := ` | ||
server: | ||
strict_mode: false | ||
port: 50052 | ||
tls: false | ||
logging: | ||
level: debug | ||
selectors: ["*"] | ||
to_stderr: true | ||
output: | ||
console: | ||
enabled: true | ||
` | ||
|
||
env := NewTestingEnvironment(t, config) | ||
t.Cleanup(func() { env.Stop() }) | ||
|
||
found := env.WaitUntil("stderr", "gRPC server is ready and is listening on") | ||
|
||
if !found { | ||
env.Fatalf("Test executable failed to start") | ||
} | ||
|
||
found = env.Contains("stderr", "Initializing disk queue at path") | ||
if found { | ||
env.Fatalf("Memory queue configured but disk queue started") | ||
} | ||
|
||
client := env.NewClient("localhost:50052") | ||
unique := "UniqueStringToLookForInOutput" | ||
events, err := createEvents([]string{unique}) | ||
require.NoErrorf(t, err, "error creating events: %s\n", err) | ||
|
||
_, err = client.PublishEvents(env.ctx, &messages.PublishRequest{ | ||
Events: events, | ||
}) | ||
require.NoErrorf(t, err, "Error publishing event: %s", err) | ||
|
||
found = env.WaitUntil("stdout", unique) | ||
|
||
if !found { | ||
env.Fatalf("Event wasn't published") | ||
} | ||
} | ||
|
||
func TestPublishDiskQueue(t *testing.T) { | ||
queue_path := t.TempDir() | ||
|
||
config := ` | ||
server: | ||
strict_mode: false | ||
port: 50052 | ||
tls: false | ||
logging: | ||
level: debug | ||
selectors: ["*"] | ||
to_stderr: true | ||
output: | ||
console: | ||
enabled: true | ||
queue: | ||
disk: | ||
path: ` + queue_path + ` | ||
max_size: 10G | ||
` | ||
|
||
env := NewTestingEnvironment(t, config) | ||
t.Cleanup(func() { env.Stop() }) | ||
|
||
found := env.WaitUntil("stderr", "gRPC server is ready and is listening on") | ||
|
||
if !found { | ||
env.Fatalf("Test executable failed to start") | ||
} | ||
|
||
found = env.Contains("stderr", "Initializing disk queue at path") | ||
if !found { | ||
env.Fatalf("Disk queue configured but not started") | ||
} | ||
|
||
client := env.NewClient("localhost:50052") | ||
unique := "UniqueStringToLookForInOutput" | ||
events, err := createEvents([]string{unique}) | ||
require.NoErrorf(t, err, "error creating events: %s\n", err) | ||
|
||
_, err = client.PublishEvents(env.ctx, &messages.PublishRequest{ | ||
Events: events, | ||
}) | ||
require.NoErrorf(t, err, "Error publishing event: %s", err) | ||
|
||
found = env.WaitUntil("stdout", unique) | ||
|
||
if !found { | ||
env.Fatalf("Event wasn't published") | ||
} | ||
} | ||
|
||
func TestPublishCompressEncryptedDiskQueue(t *testing.T) { | ||
queue_path := t.TempDir() | ||
|
||
config := ` | ||
server: | ||
strict_mode: false | ||
port: 50052 | ||
tls: false | ||
logging: | ||
level: debug | ||
selectors: ["*"] | ||
to_stderr: true | ||
output: | ||
console: | ||
enabled: true | ||
queue: | ||
disk: | ||
path: ` + queue_path + ` | ||
max_size: 10G | ||
use_compression: true | ||
encryption_password: secret | ||
` | ||
|
||
env := NewTestingEnvironment(t, config) | ||
t.Cleanup(func() { env.Stop() }) | ||
|
||
found := env.WaitUntil("stderr", "gRPC server is ready and is listening on") | ||
|
||
if !found { | ||
env.Fatalf("Test executable failed to start") | ||
} | ||
|
||
found = env.Contains("stderr", "Initializing disk queue at path") | ||
if !found { | ||
env.Fatalf("Disk queue configured but not started") | ||
} | ||
|
||
client := env.NewClient("localhost:50052") | ||
unique := "UniqueStringToLookForInOutput" | ||
events, err := createEvents([]string{unique}) | ||
require.NoErrorf(t, err, "error creating events: %s\n", err) | ||
|
||
_, err = client.PublishEvents(env.ctx, &messages.PublishRequest{ | ||
Events: events, | ||
}) | ||
require.NoErrorf(t, err, "error publishing event: %s", err) | ||
|
||
found = env.WaitUntil("stdout", unique) | ||
|
||
if !found { | ||
env.Fatalf("Event wasn't published") | ||
} | ||
} |
Oops, something went wrong.