Skip to content

Commit a2554c4

Browse files
committed
test(conformance): migrate workspace lifecycle tests to workspace stories
Move the workspace lifecycle tests from the legacy e2e crate into a new `workspaces` conformance area. Workspace create, inspect, scope and delete behavior is not driver-specific, so it belongs with the other conformance stories and runs against any prepared gateway. The original `workspace_full_crud_lifecycle` checked seven behaviors in one test. Split it so a failure points at one behavior: - workspace_full_crud_lifecycle: create, get, list as Active, delete when empty, gone afterwards (name kept so filters keep working) - template_is_scoped_to_its_workspace (new name): a resource is listed in its own workspace and in the all-workspaces view with its owner, and not in the default workspace - workspace_terminating_rejects_creates: name kept. It now also covers the deletion guard, because a refused delete is what moves the workspace to Terminating, which is a public phase The scoped resource is a sandbox template, not a provider. The original used a provider of type `openai`, which needs a provider profile that only the wrapper lanes import. A freshly provisioned tmachine gateway has none, so those stories failed there. A template is workspace-scoped, is covered by the same delete guard, and needs no profile, credential or image. This drops the `provider list --all-workspaces` check; the all-workspaces view is still checked, for templates. Assertions check exit status and listed state from `--output json` instead of matching message text. The CLI exposes no structured error and no structured `workspace get`, so those limits are documented in the area. The paginated listings are searched, so a busy gateway does not hide an entry, and a missing collection in the output is an error. A passing story removes what it created. Cleanup runs only after a failure and reports anything other than "not found". The shared runner does not track workspaces, so this stays in the area helpers. Remove the old test file, its Cargo target and its Podman archive exclusion, and list the area in the conformance README. Contributes to NVIDIA#3954 Signed-off-by: politerealism <[email protected]>
1 parent 092c9bb commit a2554c4

9 files changed

Lines changed: 468 additions & 286 deletions

File tree

‎e2e/rust/Cargo.toml‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,6 @@ name = "forward_proxy_jsonrpc_l7"
209209
path = "tests/forward_proxy_jsonrpc_l7.rs"
210210
required-features = ["e2e-host-gateway"]
211211

212-
[[test]]
213-
name = "workspace_lifecycle"
214-
path = "tests/workspace_lifecycle.rs"
215-
required-features = ["e2e"]
216-
217212
[[test]]
218213
name = "sandbox_templates"
219214
path = "tests/sandbox_templates.rs"

‎e2e/rust/tests/workspace_lifecycle.rs‎

Lines changed: 0 additions & 278 deletions
This file was deleted.

‎e2e/suites/conformance/README.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ conformance area and user story. The CLI is the current client interface; lifecy
1010
- `cli/tests/<area>/<story>.rs`: test functions, steps, and assertions for a story.
1111
- `cli/tests/<area>/helpers.rs`: setup and assertions shared by that area's stories.
1212

13-
The current areas are `file_transfer`, `lifecycle`, `policy_advisor`, and `smoke`.
13+
The current areas are `file_transfer`, `lifecycle`, `policy_advisor`, `smoke`, and
14+
`workspaces`.
1415
Each area compiles into one test binary; individual stories remain selectable by
1516
their module prefix. `main.rs` contains only module declarations.
1617

@@ -66,7 +67,8 @@ must supply the workload image and tools used by the selected scenarios. Missing
6667
CLI or gateway prerequisites fail the run rather than silently passing.
6768

6869
Run one group with `--test file_transfer`, `--test lifecycle`,
69-
`--test policy_advisor`, or `--test smoke`, before the `--` separator. A group or
70+
`--test policy_advisor`, `--test smoke`, or `--test workspaces`, before the `--`
71+
separator. A group or
7072
individual-test filter exercises only part of the suite.
7173

7274
The tmachine conformance testsuite runs these same entry points from the
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
use super::helpers::{fails, finish, require_status, succeeds};
5+
use openshell_e2e_support::OpenShellRunner;
6+
7+
/// Verify a workspace can be created, inspected, listed as Active, deleted when
8+
/// empty, and is gone afterwards.
9+
#[tokio::test]
10+
async fn workspace_full_crud_lifecycle() {
11+
let mut runner =
12+
OpenShellRunner::from_env("workspaces/crud").expect("candidate openshell CLI is available");
13+
let workspace = format!("ws-{}-cr", runner.id());
14+
let result = async {
15+
runner.check_gateway_status().await?;
16+
let r = &runner;
17+
let name = workspace.as_str();
18+
succeeds(
19+
r,
20+
"create",
21+
"workspace is created",
22+
&["workspace", "create", "--name", name],
23+
)
24+
.await?;
25+
succeeds(
26+
r,
27+
"get",
28+
"workspace can be retrieved",
29+
&["workspace", "get", name],
30+
)
31+
.await?;
32+
require_status(r, "list-active", name, Some("Active")).await?;
33+
succeeds(
34+
r,
35+
"delete",
36+
"empty workspace is deleted",
37+
&["workspace", "delete", name],
38+
)
39+
.await?;
40+
fails(
41+
r,
42+
"get-after-delete",
43+
"deleted workspace is gone",
44+
&["workspace", "get", name],
45+
)
46+
.await?;
47+
require_status(r, "list-absent", name, None).await
48+
}
49+
.await;
50+
if let Err(error) = finish(runner, result, &workspace, &[]).await {
51+
panic!("workspaces/crud conformance story failed:\n{error}");
52+
}
53+
}

0 commit comments

Comments
 (0)