-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add Splunk basic e2e tests (#73)
*Description of changes:* The test is not perfect but can be used for basic validation because the containerd task is ran successfully with the Splunk shim logger. It is nice to validate the logs in Splunk after it. It is not straightforward to do that so opened issue to track it. #74 By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. Signed-off-by: Ziwen Ning <[email protected]>
- Loading branch information
Showing
5 changed files
with
99 additions
and
3 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
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,37 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package e2e | ||
|
||
import ( | ||
"github.com/containerd/containerd/cio" | ||
"github.com/onsi/ginkgo/v2" | ||
"github.com/onsi/gomega" | ||
) | ||
|
||
const ( | ||
splunkTokenKey = "--splunk-token" | ||
splunkUrlkey = "--splunk-url" | ||
splunkInsecureskipverifyKey = "--splunk-insecureskipverify" | ||
testSplunkUrl = "https://localhost:8089" | ||
) | ||
|
||
var testSplunk = func(token string) { | ||
// These tests are run in serial because we only define one log driver instance. | ||
ginkgo.Describe("splunk shim logger", ginkgo.Serial, func() { | ||
gomega.Expect(token).ShouldNot(gomega.BeEmpty()) | ||
ginkgo.It("should send logs to splunk log driver", func() { | ||
args := map[string]string{ | ||
logDriverTypeKey: splunkDriverName, | ||
containerIdKey: testContainerId, | ||
containerNameKey: testContainerName, | ||
splunkTokenKey: token, | ||
splunkUrlkey: testSplunkUrl, | ||
splunkInsecureskipverifyKey: "true", | ||
} | ||
creator := cio.BinaryIO(*Binary, args) | ||
sendTestLogByContainerd(creator, testLog) | ||
// TODO: Validate logs in Splunk local. https://github.com/aws/shim-loggers-for-containerd/issues/74 | ||
}) | ||
}) | ||
} |