Skip to content

Commit c415743

Browse files
committed
Fixed some of the operations payloads, Updated integration test
1 parent 0708c3e commit c415743

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

servers/mcp-neo4j-cloud-aura-api/src/mcp_neo4j_aura_manager/server.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,10 @@ def create_instance(self, tenant_id: str, name: str, memory: int = 1, region: st
190190

191191
# Add optional parameters only if they're provided and applicable
192192
if graph_analytics_plugin and type in ["professional-db", "enterprise-db", "business-critical"]:
193-
payload["graph_analytics_plugin"] = graph_analytics_plugin
193+
payload["graph_analytics_plugin"] = lower(str(graph_analytics_plugin))
194194

195195
if vector_optimized and type in ["professional-db", "enterprise-db", "business-critical"]:
196-
payload["vector_optimized"] = vector_optimized
196+
payload["vector_optimized"] = lower(str(vector_optimized))
197197

198198
if source_instance_id and type in ["professional-db", "enterprise-db", "business-critical"]:
199199
payload["source_instance_id"] = source_instance_id
@@ -212,11 +212,15 @@ def update_instance(self, instance_id: str, name: Optional[str] = None,
212212
if name is not None:
213213
payload["name"] = name
214214
if memory is not None:
215-
payload["memory"] = memory
215+
payload["memory"] = f"{memory}GB"
216216
if vector_optimized is not None:
217-
payload["vector_optimized"] = vector_optimized
217+
payload["vector_optimized"] = lower(str(vector_optimized))
218218

219+
print("Update instance payload:")
220+
print(payload)
219221
response = requests.patch(url, headers=self._get_headers(), json=payload)
222+
print("Update instance response: "+str(response.status_code))
223+
print(response.json())
220224
return self._handle_response(response)
221225

222226
def pause_instance(self, instance_id: str) -> Dict[str, Any]:

servers/mcp-neo4j-cloud-aura-api/tests/test_aura_integration.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def test_integration_flow(aura_client, test_type):
125125
# Only run this if explicitly enabled and you understand the implications
126126
if test_type == "create_instance" and os.environ.get("ENABLE_INSTANCE_CREATION") == "true":
127127
# Create a test instance
128-
test_instance_name = f"pytest-integration-{os.urandom(4).hex()}"
128+
test_instance_name = f"Pro Test Instance {uuid.uuid4().hex[:8]}"
129129

130130
try:
131131
# Create a small instance for testing
@@ -143,26 +143,40 @@ def test_integration_flow(aura_client, test_type):
143143
assert instance["name"] == test_instance_name
144144

145145
# Update the instance name
146-
updated_name = f"{test_instance_name}-updated"
146+
print("Updating instance name")
147+
updated_name = f"{test_instance_name}-U"
147148
updated = aura_client.update_instance(instance_id=instance_id, name=updated_name)
148149
assert updated["name"] == updated_name
149150

151+
print("Getting instance details")
150152
instance_details = aura_client.get_instance_details([instance_id])[0]
151153
assert instance_details["name"] == updated_name
154+
155+
instance_details = wait_for_instance_status(aura_client, instance_id,"running")
156+
assert instance_details["status"] == "running"
157+
152158
# Pause the instance
159+
print("Pausing instance")
153160
paused = aura_client.pause_instance(instance_id)
154161
assert paused["status"] in ["paused", "pausing"]
155162

163+
print("Waiting for instance to be paused")
156164
instance_details = wait_for_instance_status(aura_client, instance_id,"paused")
157165
assert instance_details["status"] == "paused"
158166

159-
# Resume the instance
167+
print("Resuming instance")
160168
resumed = aura_client.resume_instance(instance_id)
161-
assert resumed["status"] in ["running", "starting"]
169+
assert resumed["status"] in ["resuming", "running"]
162170

171+
print("Waiting for instance to be running")
163172
instance_details = wait_for_instance_status(aura_client, instance_id,"running")
164173
assert instance_details["status"] == "running"
165-
174+
175+
print("Updating instance memory")
176+
updated = aura_client.update_instance(instance_id=instance_id, memory=2)
177+
instance_details = wait_for_instance_status(aura_client, instance_id,"running")
178+
assert instance_details["memory"] == "2GB"
179+
166180
except Exception as e:
167181
logger.error(f"Error during instance creation test: {str(e)}")
168182
raise

0 commit comments

Comments
 (0)