-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PLAT-1243 - Add ability to query data studio by name
- Loading branch information
1 parent
cb7d054
commit 7d31056
Showing
10 changed files
with
139 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -209,7 +209,7 @@ void testList(OutputType format, MockServerClient mock) throws JsonProcessingExc | |
""", DataStudioDto.class), | ||
parseJson(""" | ||
{ | ||
"sessionId": "c779bf09", | ||
"sessionId": "3e8370e7", | ||
"workspaceId": 75887156211589, | ||
"parentCheckpoint": null, | ||
"user": { | ||
|
@@ -218,9 +218,9 @@ void testList(OutputType format, MockServerClient mock) throws JsonProcessingExc | |
"email": "[email protected]", | ||
"avatar": null | ||
}, | ||
"name": "studio-d456", | ||
"description": null, | ||
"studioUrl": "http://ac779bf09.studio.localhost:9191", | ||
"name": "studio-a66d", | ||
"description": "my first studio", | ||
"studioUrl": "http://a3e8370e7.studio.localhost:9191", | ||
"computeEnv": { | ||
"id": "61DYXYj3XQAYbJIHrI1XSg", | ||
"name": "my-local-ce", | ||
|
@@ -235,7 +235,9 @@ void testList(OutputType format, MockServerClient mock) throws JsonProcessingExc | |
"gpu": 0, | ||
"cpu": 2, | ||
"memory": 8192, | ||
"mountData": [], | ||
"mountData": [ | ||
"v1-user-1ccf131810375d303bf0402dd8423433" | ||
], | ||
"condaEnvironment": null | ||
}, | ||
"dateCreated": "2025-01-10T17:26:36.83703Z", | ||
|
@@ -327,7 +329,7 @@ void testListWithOffset(OutputType format, MockServerClient mock) throws JsonPro | |
""", DataStudioDto.class), | ||
parseJson(""" | ||
{ | ||
"sessionId": "c779bf09", | ||
"sessionId": "3e8370e7", | ||
"workspaceId": 75887156211589, | ||
"parentCheckpoint": null, | ||
"user": { | ||
|
@@ -336,9 +338,9 @@ void testListWithOffset(OutputType format, MockServerClient mock) throws JsonPro | |
"email": "[email protected]", | ||
"avatar": null | ||
}, | ||
"name": "studio-d456", | ||
"description": null, | ||
"studioUrl": "http://ac779bf09.studio.localhost:9191", | ||
"name": "studio-a66d", | ||
"description": "my first studio", | ||
"studioUrl": "http://a3e8370e7.studio.localhost:9191", | ||
"computeEnv": { | ||
"id": "61DYXYj3XQAYbJIHrI1XSg", | ||
"name": "my-local-ce", | ||
|
@@ -353,7 +355,9 @@ void testListWithOffset(OutputType format, MockServerClient mock) throws JsonPro | |
"gpu": 0, | ||
"cpu": 2, | ||
"memory": 8192, | ||
"mountData": [], | ||
"mountData": [ | ||
"v1-user-1ccf131810375d303bf0402dd8423433" | ||
], | ||
"condaEnvironment": null | ||
}, | ||
"dateCreated": "2025-01-10T17:26:36.83703Z", | ||
|
@@ -570,6 +574,62 @@ void testStart(OutputType format, MockServerClient mock) { | |
"[organization1 / workspace1]", "http://localhost:"+mock.getPort()+"/orgs/organization1/workspaces/workspace1", true)); | ||
} | ||
|
||
@ParameterizedTest | ||
@EnumSource(OutputType.class) | ||
void testStartByName(OutputType format, MockServerClient mock) { | ||
|
||
mock.when( | ||
request().withMethod("GET").withPath("/user-info"), exactly(1) | ||
).respond( | ||
response().withStatusCode(200).withBody(loadResource("user")).withContentType(MediaType.APPLICATION_JSON) | ||
); | ||
|
||
mock.when( | ||
request().withMethod("GET").withPath("/user/1264/workspaces"), exactly(1) | ||
).respond( | ||
response().withStatusCode(200).withBody(loadResource("workspaces/workspaces_list")).withContentType(MediaType.APPLICATION_JSON) | ||
); | ||
|
||
mock.when( | ||
request().withMethod("GET").withPath("/studios").withQueryStringParameter("workspaceId", "75887156211589"), exactly(1) | ||
).respond( | ||
response().withStatusCode(200).withBody(loadResource("datastudios/datastudios_list_response")).withContentType(MediaType.APPLICATION_JSON) | ||
); | ||
|
||
mock.when( | ||
request().withMethod("GET").withPath("/studios/3e8370e7").withQueryStringParameter("workspaceId", "75887156211589"), exactly(1) | ||
).respond( | ||
response().withStatusCode(200).withBody(loadResource("datastudios/datastudios_view_response_studio_stopped")).withContentType(MediaType.APPLICATION_JSON) | ||
); | ||
|
||
mock.when( | ||
request().withMethod("PUT").withPath("/studios/3e8370e7/start").withQueryStringParameter("workspaceId", "75887156211589").withBody(json(""" | ||
{ | ||
"configuration": { | ||
"gpu": 0, | ||
"cpu": 2, | ||
"memory": 8192, | ||
"mountData": [ | ||
"v1-user-1ccf131810375d303bf0402dd8423433" | ||
] | ||
}, | ||
"description": "my first studio" | ||
} | ||
""" | ||
) | ||
|
||
), exactly(1) | ||
).respond( | ||
response().withStatusCode(200).withBody(loadResource("datastudios/datastudios_start_response")).withContentType(MediaType.APPLICATION_JSON) | ||
); | ||
|
||
|
||
ExecOut out = exec(format, mock, "studios", "start", "-w", "organization1/workspace1", "-n" ,"studio-a66d"); | ||
|
||
assertOutput(format, out, new DataStudioStartSubmitted("studio-a66d", 75887156211589L, | ||
"[organization1 / workspace1]", "http://localhost:"+mock.getPort()+"/orgs/organization1/workspaces/workspace1", true)); | ||
} | ||
|
||
@ParameterizedTest | ||
@EnumSource(OutputType.class) | ||
void testStartWithConfigOverride(OutputType format, MockServerClient mock) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ | |
"progress": null | ||
}, | ||
{ | ||
"sessionId": "c779bf09", | ||
"sessionId": "3e8370e7", | ||
"workspaceId": 75887156211589, | ||
"parentCheckpoint": null, | ||
"user": { | ||
|
@@ -53,9 +53,9 @@ | |
"email": "[email protected]", | ||
"avatar": null | ||
}, | ||
"name": "studio-d456", | ||
"description": null, | ||
"studioUrl": "http://ac779bf09.studio.localhost:9191", | ||
"name": "studio-a66d", | ||
"description": "my first studio", | ||
"studioUrl": "http://a3e8370e7.studio.localhost:9191", | ||
"computeEnv": { | ||
"id": "61DYXYj3XQAYbJIHrI1XSg", | ||
"name": "my-local-ce", | ||
|
@@ -70,7 +70,9 @@ | |
"gpu": 0, | ||
"cpu": 2, | ||
"memory": 8192, | ||
"mountData": [], | ||
"mountData": [ | ||
"v1-user-1ccf131810375d303bf0402dd8423433" | ||
], | ||
"condaEnvironment": null | ||
}, | ||
"dateCreated": "2025-01-10T17:26:36.83703Z", | ||
|