@@ -62,15 +62,16 @@ func TestCreateProfessionalInstance(t *testing.T) {
6262 "cloud_provider": "gcp",
6363 "region": "europe-west1",
6464 "type": "professional-db",
65- "name": "Instance01"
65+ "name": "Instance01",
66+ "vector_optimized": false
6667 }
6768 }` )
6869
6970 helper .ExecuteCommand ("instance create --region europe-west1 --name Instance01 --type professional-db --tenant-id YOUR_TENANT_ID --cloud-provider gcp --memory 4GB" )
7071
7172 mockHandler .AssertCalledTimes (1 )
7273 mockHandler .AssertCalledWithMethod (http .MethodPost )
73- mockHandler .AssertCalledWithBody (`{"cloud_provider":"gcp","memory":"4GB","name":"Instance01","region":"europe-west1","tenant_id":"YOUR_TENANT_ID","type":"professional-db","version":"5"}` )
74+ mockHandler .AssertCalledWithBody (`{"cloud_provider":"gcp","memory":"4GB","name":"Instance01","region":"europe-west1","tenant_id":"YOUR_TENANT_ID","type":"professional-db","version":"5","vector_optimized":false,"graph_analytics_plugin":false }` )
7475
7576 helper .AssertOutJson (`{
7677 "data": {
@@ -82,7 +83,49 @@ func TestCreateProfessionalInstance(t *testing.T) {
8283 "region": "europe-west1",
8384 "tenant_id": "YOUR_TENANT_ID",
8485 "type": "professional-db",
85- "username": "neo4j"
86+ "username": "neo4j",
87+ "vector_optimized": false
88+ }
89+ }` )
90+ }
91+
92+ func TestCreateProfessionalInstanceVectorOptimizedGraphAnalyticsPlugin (t * testing.T ) {
93+ helper := testutils .NewAuraTestHelper (t )
94+ defer helper .Close ()
95+
96+ mockHandler := helper .NewRequestHandlerMock ("/v1/instances" , http .StatusAccepted , `{
97+ "data": {
98+ "id": "db1d1234",
99+ "connection_url": "YOUR_CONNECTION_URL",
100+ "username": "neo4j",
101+ "password": "letMeIn123!",
102+ "tenant_id": "YOUR_TENANT_ID",
103+ "cloud_provider": "gcp",
104+ "region": "europe-west1",
105+ "type": "professional-db",
106+ "name": "Instance01",
107+ "vector_optimized": true
108+ }
109+ }` )
110+
111+ helper .ExecuteCommand ("instance create --region europe-west1 --name Instance01 --type professional-db --tenant-id YOUR_TENANT_ID --cloud-provider gcp --memory 4GB --vector-optimized --graph-analytics-plugin" )
112+
113+ mockHandler .AssertCalledTimes (1 )
114+ mockHandler .AssertCalledWithMethod (http .MethodPost )
115+ mockHandler .AssertCalledWithBody (`{"cloud_provider":"gcp","memory":"4GB","name":"Instance01","region":"europe-west1","tenant_id":"YOUR_TENANT_ID","type":"professional-db","version":"5","vector_optimized":true,"graph_analytics_plugin":true}` )
116+
117+ helper .AssertOutJson (`{
118+ "data": {
119+ "cloud_provider": "gcp",
120+ "connection_url": "YOUR_CONNECTION_URL",
121+ "id": "db1d1234",
122+ "name": "Instance01",
123+ "password": "letMeIn123!",
124+ "region": "europe-west1",
125+ "tenant_id": "YOUR_TENANT_ID",
126+ "type": "professional-db",
127+ "username": "neo4j",
128+ "vector_optimized": true
86129 }
87130 }` )
88131}
@@ -157,6 +200,20 @@ func TestCreateProfessionalInstanceInvalidInstanceType(t *testing.T) {
157200` )
158201}
159202
203+ func TestCreateProfessionalInstanceInvalidVersion (t * testing.T ) {
204+ helper := testutils .NewAuraTestHelper (t )
205+ defer helper .Close ()
206+
207+ mockHandler := helper .NewRequestHandlerMock ("/v1/instances" , http .StatusOK , "" )
208+
209+ helper .ExecuteCommand ("instance create --region europe-west1 --name Instance01 --type professional-db --memory 1GB --cloud-provider gcp --tenant-id YOUR_TENANT_ID --version 6" )
210+
211+ mockHandler .AssertCalledTimes (0 )
212+
213+ helper .AssertErr (`Error: invalid argument "6" for "--version" flag: must be one of "4" or "5"
214+ ` )
215+ }
216+
160217func TestCreateFreeInstanceWithMemory (t * testing.T ) {
161218 helper := testutils .NewAuraTestHelper (t )
162219 defer helper .Close ()
@@ -199,6 +256,20 @@ func TestCreateFreeInstanceWithCloudProvider(t *testing.T) {
199256` )
200257}
201258
259+ func TestCreateFreeInstanceWithGraphAnalyticsPlugin (t * testing.T ) {
260+ helper := testutils .NewAuraTestHelper (t )
261+ defer helper .Close ()
262+
263+ mockHandler := helper .NewRequestHandlerMock ("/v1/instances" , http .StatusOK , "" )
264+
265+ helper .ExecuteCommand ("instance create --name Instance01 --type free-db --graph-analytics-plugin --tenant-id YOUR_TENANT_ID" )
266+
267+ mockHandler .AssertCalledTimes (0 )
268+
269+ helper .AssertErr (`Error: "--graph-analytics-plugin" flag can only be set when "--type" flag is set to "professional-db"
270+ ` )
271+ }
272+
202273func TestCreateInstanceError (t * testing.T ) {
203274 testCases := []struct {
204275 statusCode int
@@ -272,7 +343,7 @@ func TestInstanceWithCmkId(t *testing.T) {
272343
273344 mockHandler .AssertCalledTimes (1 )
274345 mockHandler .AssertCalledWithMethod (http .MethodPost )
275- mockHandler .AssertCalledWithBody (`{"cloud_provider":"gcp","memory":"16GB","name":"Instance01","region":"europe-west1","tenant_id":"YOUR_TENANT_ID","type":"enterprise-db","version":"5","customer_managed_key_id":"UUID_OF_YOUR_KEY"}` )
346+ mockHandler .AssertCalledWithBody (`{"cloud_provider":"gcp","memory":"16GB","name":"Instance01","region":"europe-west1","tenant_id":"YOUR_TENANT_ID","type":"enterprise-db","version":"5","customer_managed_key_id":"UUID_OF_YOUR_KEY","vector_optimized":false }` )
276347
277348 helper .AssertOutJson (`{
278349 "data": {
0 commit comments