Skip to content

Commit

Permalink
test: Integration tests for streams instance logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jarjee committed Mar 14, 2024
1 parent 5d444b2 commit 4d9a025
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/README.md
Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions test/e2e/atlas/streams_test.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 4d9a025

Please sign in to comment.