Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/code-health.yml
Original file line number Diff line number Diff line change
Expand Up @@ -360,3 +360,28 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: mongodb/atlas:test
file: Dockerfile
e2e-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
with:
config: ${{ vars.PERMISSIONS_CONFIG }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- run: go install gotest.tools/gotestsum@latest
- run: make e2e-test-snapshots
env:
TEST_CMD: gotestsum --junitfile e2e-tests.xml --format standard-verbose --
- name: Test Summary
if: always()
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86
with:
paths: e2e-tests.xml
85 changes: 0 additions & 85 deletions .github/workflows/e2e-tests.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,6 @@ linters:
- linters:
- gocyclo
path: e2e
- linters:
- mnd
path: internal/test/fixture
paths:
- third_party$
- builtin$
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ ATLAS_INSTALL_PATH="${GOPATH}/bin/$(ATLAS_BINARY_NAME)"

LOCALDEV_IMAGE?=docker.io/mongodb/mongodb-atlas-local
LINKER_FLAGS=-s -w -X github.com/mongodb/mongodb-atlas-cli/atlascli/internal/version.GitCommit=${GIT_SHA} -X github.com/mongodb/mongodb-atlas-cli/atlascli/internal/version.Version=${ATLAS_VERSION} -X github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli/deployments/options.LocalDevImage=${LOCALDEV_IMAGE}
ATLAS_E2E_BINARY?=../../bin/${ATLAS_BINARY_NAME}
ATLAS_E2E_BINARY?=$(abspath bin/${ATLAS_BINARY_NAME})
export SNAPSHOTS_DIR?=$(abspath test/e2e/testdata/.snapshots)

DEBUG_FLAGS=all=-N -l

Expand Down Expand Up @@ -163,6 +164,10 @@ e2e-test: build-debug ## Run E2E tests
@echo "==> Running E2E tests..."
$(TEST_CMD) -v -p 1 -parallel $(E2E_PARALLEL) -v -timeout $(E2E_TIMEOUT) -tags="$(E2E_TAGS)" ./test/e2e... $(E2E_EXTRA_ARGS)

.PHONY: e2e-test-snapshots
e2e-test-snapshots: build-debug ## Run E2E tests
UPDATE_SNAPSHOTS=false E2E_SKIP_CLEANUP=true DO_NOT_TRACK=1 $(TEST_CMD) -v -timeout $(E2E_TIMEOUT) -tags="e2eSnap" ./test/e2e... $(E2E_EXTRA_ARGS)

.PHONY: unit-test
unit-test: build-debug ## Run unit-tests
@echo "==> Running unit tests..."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
// 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.
//go:build e2e || (atlas && generic)
//go:build e2e || e2eSnap || (atlas && generic)

package e2e
package accesslists

import (
"encoding/json"
Expand All @@ -29,6 +29,10 @@ import (
atlasv2 "go.mongodb.org/atlas-sdk/v20250312001/admin"
)

const (
accessListEntity = "accessList"
)

func TestAccessList(t *testing.T) {
g := internal.NewAtlasE2ETestGenerator(t, internal.WithSnapshot())
g.GenerateProject("accessList")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
// 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.
//go:build e2e || (atlas && logs)
//go:build e2e || e2eSnap || (atlas && logs)

package e2e
package accesslogs

import (
"encoding/json"
Expand All @@ -26,6 +26,10 @@ import (
atlasv2 "go.mongodb.org/atlas-sdk/v20250312001/admin"
)

const (
accessLogsEntity = "accessLogs"
)

func TestAccessLogs(t *testing.T) {
g := internal.NewAtlasE2ETestGenerator(t, internal.WithSnapshot())
req := require.New(t)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
// 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.
//go:build e2e || (atlas && generic)
//go:build e2e || e2eSnap || (atlas && generic)

package e2e
package accessroles

import (
"encoding/json"
Expand All @@ -27,6 +27,12 @@ import (
atlasv2 "go.mongodb.org/atlas-sdk/v20250312001/admin"
)

const (
awsEntity = "aws"
cloudProvidersEntity = "cloudProviders"
accessRolesEntity = "accessRoles"
)

const aws = "AWS"

func TestAccessRoles(t *testing.T) {
Expand Down
8 changes: 6 additions & 2 deletions test/e2e/alerts_test.go → test/e2e/alerts/alerts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
// 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.
//go:build e2e || (atlas && generic)
//go:build e2e || e2eSnap || (atlas && generic)

package e2e
package alerts

import (
"encoding/json"
Expand All @@ -28,6 +28,10 @@ import (
atlasv2 "go.mongodb.org/atlas-sdk/v20250312001/admin"
)

const (
alertsEntity = "alerts"
)

const (
closed = "CLOSED"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build e2e || (atlas && generic)
//go:build e2e || e2eSnap || (atlas && generic)

package e2e
package alertsettings

import (
"encoding/json"
Expand All @@ -30,6 +30,17 @@ import (
"go.mongodb.org/atlas-sdk/v20250312001/admin"
)

const (
alertsEntity = "alerts"
settingsEntity = "settings"

// AlertConfig constants.
group = "GROUP"
eventTypeName = "NO_PRIMARY"
intervalMin = 5
delayMin = 0
)

func TestAlertConfig(t *testing.T) {
g := internal.NewAtlasE2ETestGenerator(t, internal.WithSnapshot())
var alertID string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build e2e || (iam && atlas)
//go:build e2e || e2eSnap || (iam && atlas)

package e2e
package atlasorgapikeyaccesslist

import (
"encoding/json"
Expand All @@ -30,6 +30,12 @@ import (
atlasv2 "go.mongodb.org/atlas-sdk/v20250312001/admin"
)

const (
orgEntity = "org"
apiKeysEntity = "apikeys"
apiKeyAccessListEntity = "accessLists"
)

var errNoAPIKey = errors.New("the apiKey ID is empty")

func TestAtlasOrgAPIKeyAccessList(t *testing.T) {
Expand All @@ -41,7 +47,7 @@ func TestAtlasOrgAPIKeyAccessList(t *testing.T) {
require.NoError(t, e)

t.Cleanup(func() {
require.NoError(t, deleteOrgAPIKey(apiKeyID))
require.NoError(t, internal.DeleteOrgAPIKey(apiKeyID))
})

n := g.MemoryRand("rand", 255)
Expand Down Expand Up @@ -159,18 +165,3 @@ func createOrgAPIKey() (string, error) {

return "", errNoAPIKey
}

func deleteOrgAPIKey(id string) error {
cliPath, err := internal.AtlasCLIBin()
if err != nil {
return err
}
cmd := exec.Command(cliPath,
orgEntity,
apiKeysEntity,
"rm",
id,
"--force")
cmd.Env = os.Environ()
return cmd.Run()
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
// 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.
//go:build e2e || (iam && atlas)
//go:build e2e || e2eSnap || (iam && atlas)

package e2e
package atlasorgapikeys

import (
"encoding/json"
Expand All @@ -28,6 +28,11 @@ import (
atlasv2 "go.mongodb.org/atlas-sdk/v20250312001/admin"
)

const (
orgEntity = "org"
apiKeysEntity = "apikeys"
)

func TestAtlasOrgAPIKeys(t *testing.T) {
g := internal.NewAtlasE2ETestGenerator(t, internal.WithSnapshot())
cliPath, err := internal.AtlasCLIBin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
// 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.
//go:build e2e || (iam && atlas)
//go:build e2e || e2eSnap || (iam && atlas)

package e2e
package atlasorginvitations

import (
"encoding/json"
Expand All @@ -29,6 +29,14 @@ import (
"go.mongodb.org/atlas-sdk/v20250312001/admin"
)

const (
orgEntity = "org"
invitationsEntity = "invitations"
)
const (
roleNameOrg = "ORG_READ_ONLY"
)

func TestAtlasOrgInvitations(t *testing.T) {
g := internal.NewAtlasE2ETestGenerator(t, internal.WithSnapshot())
cliPath, err := internal.AtlasCLIBin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build e2e || (iam && atlas)
//go:build e2e || e2eSnap || (iam && atlas)

package e2e
package atlasorgs

import (
"encoding/json"
Expand All @@ -29,6 +29,11 @@ import (
"go.mongodb.org/atlas-sdk/v20250312001/admin"
)

const (
orgEntity = "org"
usersEntity = "users"
)

func TestAtlasOrgs(t *testing.T) {
g := internal.NewAtlasE2ETestGenerator(t, internal.WithSnapshot())
cliPath, err := internal.AtlasCLIBin()
Expand Down
Loading
Loading