@@ -26,6 +26,7 @@ import (
2626 "github.com/mongodb/mongodb-atlas-cli/test/e2e"
2727 "github.com/stretchr/testify/assert"
2828 "github.com/stretchr/testify/require"
29+ atlasv2 "go.mongodb.org/atlas-sdk/admin"
2930 "go.mongodb.org/atlas/mongodbatlas"
3031)
3132
@@ -43,6 +44,9 @@ func TestSetup(t *testing.T) {
4344 dbUserUsername , err := RandUsername ()
4445 req .NoError (err )
4546
47+ tagKey := "env"
48+ tagValue := "e2etest"
49+
4650 t .Run ("Run" , func (t * testing.T ) {
4751 cmd := exec .Command (cliPath ,
4852 "setup" ,
@@ -51,6 +55,7 @@ func TestSetup(t *testing.T) {
5155 "--skipMongosh" ,
5256 "--skipSampleData" ,
5357 "--projectId" , g .projectID ,
58+ "--tag" , tagKey + "=" + tagValue ,
5459 "--force" )
5560 cmd .Env = os .Environ ()
5661 resp , err := cmd .CombinedOutput ()
@@ -88,6 +93,27 @@ func TestSetup(t *testing.T) {
8893 assert .Equal (t , dbUserUsername , user .Username )
8994 })
9095
96+ t .Run ("Describe Cluster" , func (t * testing.T ) {
97+ cmd := exec .Command (cliPath ,
98+ clustersEntity ,
99+ "describe" ,
100+ clusterName ,
101+ "-o=json" ,
102+ "--projectId" , g .projectID ,
103+ )
104+ cmd .Env = os .Environ ()
105+ resp , err := cmd .CombinedOutput ()
106+ require .NoError (t , err , string (resp ))
107+
108+ var cluster atlasv2.AdvancedClusterDescription
109+ require .NoError (t , json .Unmarshal (resp , & cluster ), string (resp ))
110+ assert .Equal (t , clusterName , * cluster .Name )
111+
112+ assert .Len (t , cluster .Tags , 1 )
113+ assert .Equal (t , tagKey , * cluster .Tags [0 ].Key )
114+ assert .Equal (t , tagValue , * cluster .Tags [0 ].Value )
115+ })
116+
91117 t .Run ("Delete Cluster" , func (t * testing.T ) {
92118 cmd := exec .Command (cliPath ,
93119 clustersEntity ,
0 commit comments