Skip to content

Commit 06a9115

Browse files
CLOUDP-229230: Search nodes e2e tests (#2654)
1 parent 90d2e62 commit 06a9115

File tree

11 files changed

+265
-7
lines changed

11 files changed

+265
-7
lines changed

build/ci/evergreen.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,24 @@ tasks:
785785
MCLI_OPS_MANAGER_URL: ${mcli_cloud_gov_ops_manager_url}
786786
MCLI_SERVICE: cloudgov
787787
E2E_TAGS: atlas,search
788+
- name: atlas_search_nodes_e2e
789+
tags: ["e2e","clusters","atlas"]
790+
must_have_test_results: true
791+
depends_on:
792+
- name: atlas_clusters_flags_e2e
793+
variant: "e2e_atlas_clusters"
794+
patch_optional: true
795+
commands:
796+
- func: "install gotestsum"
797+
- func: "e2e test"
798+
vars:
799+
MCLI_ORG_ID: ${atlas_org_id}
800+
MCLI_PROJECT_ID: ${atlas_project_id}
801+
MCLI_PRIVATE_API_KEY: ${atlas_private_api_key}
802+
MCLI_PUBLIC_API_KEY: ${atlas_public_api_key}
803+
MCLI_OPS_MANAGER_URL: ${mcli_ops_manager_url}
804+
MCLI_SERVICE: cloud
805+
E2E_TAGS: atlas,search_nodes
788806
# Private endpoints can be flaky when multiple tests run concurrently so keeping this out of the PR suite
789807
- name: atlas_private_endpoint_e2e
790808
tags: ["e2e","networking","atlas"]

docs/atlascli/command/atlas-clusters-search-nodes-delete.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ Options
4141
- string
4242
- true
4343
- Name of the cluster.
44+
* - --force
45+
-
46+
- false
47+
- Flag that indicates whether to skip the confirmation prompt before proceeding with the requested action.
4448
* - -h, --help
4549
-
4650
- false

internal/cli/atlas/search/nodes/create.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/mongodb/mongodb-atlas-cli/internal/usage"
2727
"github.com/spf13/afero"
2828
"github.com/spf13/cobra"
29+
"go.mongodb.org/atlas-sdk/v20231115007/admin"
2930
)
3031

3132
type CreateOpts struct {
@@ -64,10 +65,12 @@ func (opts *CreateOpts) Run() error {
6465
}
6566

6667
if opts.EnableWatch {
67-
if _, err := opts.Watch(opts.watcher); err != nil {
68+
watchResult, err := opts.Watch(opts.watcher)
69+
if err != nil {
6870
return err
6971
}
7072
opts.Template = createWatchTemplate
73+
r = watchResult.(*admin.ApiSearchDeploymentResponse)
7174
}
7275

7376
return opts.Print(r)
@@ -78,7 +81,7 @@ func (opts *CreateOpts) watcher() (any, bool, error) {
7881
if err != nil {
7982
return nil, false, err
8083
}
81-
return nil, *res.StateName == stateIdle, nil
84+
return res, *res.StateName == stateIdle, nil
8285
}
8386

8487
// atlas clusters search nodes create [--clusterName clusterName] [--file filePath].

internal/cli/atlas/search/nodes/delete.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ func DeleteBuilder() *cobra.Command {
113113

114114
cmd.Flags().BoolVarP(&opts.EnableWatch, flag.EnableWatch, flag.EnableWatchShort, false, usage.EnableWatchDefault)
115115
cmd.Flags().UintVar(&opts.Timeout, flag.WatchTimeout, 0, usage.WatchTimeout)
116+
cmd.Flags().BoolVar(&opts.Confirm, flag.Force, false, usage.Force)
116117

117118
// Global flags
118119
cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID)

internal/cli/atlas/search/nodes/update.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/mongodb/mongodb-atlas-cli/internal/usage"
2727
"github.com/spf13/afero"
2828
"github.com/spf13/cobra"
29+
"go.mongodb.org/atlas-sdk/v20231115007/admin"
2930
)
3031

3132
type UpdateOpts struct {
@@ -60,10 +61,12 @@ func (opts *UpdateOpts) Run() error {
6061
}
6162

6263
if opts.EnableWatch {
63-
if _, err := opts.Watch(opts.watcher); err != nil {
64+
watchResult, err := opts.Watch(opts.watcher)
65+
if err != nil {
6466
return err
6567
}
6668
opts.Template = updateWatchTemplate
69+
r = watchResult.(*admin.ApiSearchDeploymentResponse)
6770
}
6871

6972
return opts.Print(r)
@@ -74,7 +77,7 @@ func (opts *UpdateOpts) watcher() (any, bool, error) {
7477
if err != nil {
7578
return nil, false, err
7679
}
77-
return nil, *res.StateName == stateIdle, nil
80+
return res, *res.StateName == stateIdle, nil
7881
}
7982

8083
// atlas clusters search nodes update [--clusterName clusterName] [--file filePath].

test/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@
9494
| `cluster search index describe` | Y | | | Y | N | N |
9595
| `cluster search index list` | Y | | | Y | N | N |
9696
| `cluster search index update` | Y | | | Y | N | N |
97+
| `cluster search nodes list` | Y | | | Y | N | N |
98+
| `cluster search nodes create` | Y | | | Y | N | N |
99+
| `cluster search nodes update` | Y | | | Y | N | N |
100+
| `cluster search nodes delete` | Y | | | Y | N | N |
97101
| `cluster advancedSettings describe` | Y | | | Y | N | N |
98102
| `cluster advancedSettings update` | Y | | | Y | N | N |
99103
| `dbrole create` | Y | | | Y | | |

test/e2e/atlas/atlas_e2e_test_generator_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ type atlasE2ETestGenerator struct {
4646
teamUser string
4747
dbUser string
4848
tier string
49+
mDBVer string
4950
dataFedName string
5051
enableBackup bool
5152
firstProcess *atlasv2.ApiHostViewAtlas
@@ -333,7 +334,11 @@ func (g *atlasE2ETestGenerator) generateCluster() {
333334
g.tier = e2eTier()
334335
}
335336

336-
g.clusterName, g.clusterRegion, err = deployClusterForProject(g.projectID, g.tier, g.enableBackup)
337+
if g.mDBVer == "" {
338+
g.mDBVer = e2eMDBVer
339+
}
340+
341+
g.clusterName, g.clusterRegion, err = deployClusterForProject(g.projectID, g.tier, g.mDBVer, g.enableBackup)
337342
if err != nil {
338343
g.Logf("projectID=%q, clusterName=%q", g.projectID, g.clusterName)
339344
g.t.Errorf("unexpected error deploying cluster: %v", err)

test/e2e/atlas/helper_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const (
4242
metricsEntity = "metrics"
4343
searchEntity = "search"
4444
indexEntity = "index"
45+
nodesEntity = "nodes"
4546
datafederationEntity = "datafederation"
4647
datalakePipelineEntity = "datalakepipeline"
4748
alertsEntity = "alerts"
@@ -246,7 +247,7 @@ func deleteServerlessInstanceForProject(t *testing.T, cliPath, projectID, cluste
246247
_ = watchServerlessInstanceForProject(projectID, clusterName)
247248
}
248249

249-
func deployClusterForProject(projectID, tier string, enableBackup bool) (string, string, error) {
250+
func deployClusterForProject(projectID, tier, mDBVersion string, enableBackup bool) (string, string, error) {
250251
cliPath, err := e2e.AtlasCLIBin()
251252
if err != nil {
252253
return "", "", err
@@ -263,7 +264,7 @@ func deployClusterForProject(projectID, tier string, enableBackup bool) (string,
263264
clustersEntity,
264265
"create",
265266
clusterName,
266-
"--mdbVersion", e2eMDBVer,
267+
"--mdbVersion", mDBVersion,
267268
"--region", region,
268269
"--tier", tier,
269270
"--provider", e2eClusterProvider,

test/e2e/atlas/search_nodes_spec.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"specs": [
3+
{
4+
"instanceSize": "S30_LOWCPU_NVME",
5+
"nodeCount": 2
6+
}
7+
]
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"specs": [
3+
{
4+
"instanceSize": "S20_HIGHCPU_NVME",
5+
"nodeCount": 3
6+
}
7+
]
8+
}

0 commit comments

Comments
 (0)