From 4d9a02583f8c37f93b375a4e23dc23b22b614702 Mon Sep 17 00:00:00 2001 From: Nathan Smyth Date: Thu, 14 Mar 2024 07:26:38 +0000 Subject: [PATCH] test: Integration tests for streams instance logs --- test/README.md | 1 + test/e2e/atlas/streams_test.go | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/test/README.md b/test/README.md index d83e17a9d2..6f01f4b203 100644 --- a/test/README.md +++ b/test/README.md @@ -193,6 +193,7 @@ | `streams instance describe` | Y | Y | `streams instance list` | Y | Y | `streams instance update` | Y | Y +| `streams instance log` | Y | Y | `config` | | | `completion` | Y | Y | `config delete` | Y | Y diff --git a/test/e2e/atlas/streams_test.go b/test/e2e/atlas/streams_test.go index f57d1803cd..5d006c7573 100644 --- a/test/e2e/atlas/streams_test.go +++ b/test/e2e/atlas/streams_test.go @@ -20,7 +20,9 @@ import ( "fmt" "os" "os/exec" + "strconv" "testing" + "time" "github.com/mongodb/mongodb-atlas-cli/atlascli/test/e2e" "github.com/stretchr/testify/assert" @@ -92,6 +94,29 @@ func TestStreams(t *testing.T) { assert.Equal(t, instance.GetName(), instanceName) }) + t.Run("Downloading streams instance logs instance", func(t *testing.T) { + cmd := exec.Command(cliPath, + "streams", + "instance", + "logs", + instanceName, + "auditLogs.gz", + "--out", + "-", + "--start", + strconv.FormatInt(time.Now().Add(-10*time.Second).Unix(), 10), + "--end", + strconv.FormatInt(time.Now().Unix(), 10), + "--force", + "--projectId", + g.projectID, + ) + cmd.Env = os.Environ() + + resp, err := cmd.CombinedOutput() + require.NoError(t, err, string(resp)) + }) + t.Run("List all streams in the e2e project after creating", func(t *testing.T) { cmd := exec.Command(cliPath, "streams",