Repository navigation
test(conformance): port sandbox lifecycle and API e2e tests to testkit - #5431
Conversation
|
/ok to test c2eceee |
|
Label |
|
/ok to test 45180d0 |
|
/ok to test e3b0f27 |
|
/ok to test 73e5bff |
|
/ok to test caff38c |
|
/ok to test 2cefa9a |
2cefa9a to
1ce77a5
Compare
|
/ok to test 1ce77a5 |
|
🌿 Preview your docs: https://nvidia-preview-pr-5431.docs.buildwithfern.com/openshell |
1ce77a5 to
f8b1ced
Compare
|
/ok to test a96df3a |
f8b1ced to
a96df3a
Compare
|
/ok to test 034814b |
|
/ok to test 1ed49ce |
|
/ok to test 163fa4d |
|
/ok to test 1cd665d |
|
/ok to test 139dc5d |
|
@matthewgrossman I pushed one commit on top of your branch (
The README rows for Please update the PR description:
Your local branch now has a new commit on top, so |
…e helpers Add SandboxBuilder::create_ready, ExecOutput::expect_stdout, Sandbox::poll_exec, Context::delete_and_expect_absent and testkit::with_deadline, and convert std::io::Error into testkit::Error so I/O results take .context directly. Use them across the conformance suite, which also gets shared template, global-setting and label-list helpers and a split on-failure restart poll. Make Engine::build_image private so callers go through build_test_image, which removes the image. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
…proxy Replace the hand-written WebSocket bridge with openshell_sdk::edge_tunnel::start_tunnel_proxy, so the test covers the client half of the tunnel and its edge-token headers as well as the router. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Move expect_listed, expect_absent, wait_absent and the CLI's sandbox get JSON (now get_json) from Context onto Sandbox, and drop delete_and_expect_absent. Give ExecOutput failure() and CliOutput expect_stdout(), so both outputs offer the same checks. Put with_deadline's description first, like poll_until. Make CliSandboxBuilder::run consume the builder like create, and rename its policy setter to policy_yaml. Update the testkit README's list of what a test can do. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Replace CliSandboxBuilder's private PolicyFile with testkit::YamlFile, and drop YamlFile's map_err calls now that I/O errors convert into testkit::Error. CliOutput::success now includes stdout in its failure message, like ExecOutput::success, since many commands report errors there. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
…ting changes Add SandboxBuilder::image and CliSandboxBuilder::create_ready, so both builders set an image and wait for Ready the same way. Convert tonic::Status into testkit::Error, keeping its code, so gRPC results take .context() directly, and drop Error::from_status. Create the host-gateway sandbox with cx.sandbox(..).image(..).policy(..) instead of a hand-written CLI create. In credential gating, use create_ready and poll_exec. Drop the remaining map_err calls on I/O results in host-server-support. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
…ble driver The gateway feature matrix builds without Docker, Podman or the VM driver, where the test file has no drivers to check. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
…ure restart Deleting a Docker sandbox that is still starting fails with a 409 because its supervisor volume is in use, so the labels test now waits for Ready before cleanup. The VM driver needs more than 45s to report an on-failure restart; the original e2e test allowed 60s. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
…lders Context, SandboxBuilder, Sandbox and CliSandboxBuilder now share one Handles value (clients, CLI, cleanup), so CliSandboxBuilder owns its state like SandboxBuilder instead of borrowing the context. Both builders are #[must_use] at the type level, and CliSandboxBuilder::image and policy_yaml take impl Into<String> like SandboxBuilder::image. ExecOutput and CliOutput run success, failure and expect_stdout through one shared check, so their messages match and failure() also reports stderr. ExecOutput.command is renamed description, since it names the exec and its sandbox. CliOutput::message is renamed report_text. serde_json and serde_yml errors convert into testkit::Error, which removes the last map_err(Error::from_error) calls. expect_listed uses let-else instead of ensure plus expect. kubernetes-updates uses create_ready. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
b5f0737 to
10e797e
Compare
elezar
left a comment
There was a problem hiding this comment.
Re-approving after the rebase onto current main (10e797e2b). The only conflict was in e2e/rust/Cargo.toml: I kept main's new supervisor_middleware_http_hooks test entry and dropped the sandbox_templates entry that this PR deletes. The rest of the diff is unchanged. cargo check passes on e2e/rust and the conformance suite. CI still needs to run on the new head.
Read errors in gateway.rs and the image test use .context(..) now that the error types convert. Error::from_error and from_display are crate-private. Document why the global-setting helpers take &Cli, why the template test names and adopts its sandbox by hand, SandboxBuilder::restart_policy, and that the --no-keep test checks only gateway-visible removal. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Restore edge_tunnel_e2e with the --enable-websocket-tunnel flag in the Docker and Podman gateway wrappers, and ephemeral_cleanup with its Podman and VM lane entries. Both check what conformance cannot: the tunnel flag's wiring through a real gateway, and that drivers remove their resources. They move in later batches. Remove the in-process WebSocket tunnel server test and its openshell-sdk dev-dependency, which checked the listener but not the flag wiring. The --no-keep conformance test now says the driver-resource check stays in ephemeral_cleanup. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
The two live-Internet benchmarks were manual, needed the live Internet, and nothing referenced them. Remove the Python port and its perf:live-internet task instead of keeping it. #5472 tracks whether to bring one back. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
proxy_settings_are_inserted_before_nested_driver_tables covers insert_docker_driver_settings, which the remaining corporate proxy tests still use. It was removed with the incoherent-configuration test by mistake. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
On the VM driver the replacement sandbox never starts: the preserved overlay disk fails e2fsck, and the sandbox stays in Starting. The test fails on every VM lane. Ignore it with a link to #5507, which also tracks removing the ignore. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
…2e/rust Restore `on_failure_policy_replaces_runtime_and_preserves_workspace` in `sandbox_lifecycle.rs` and `settings_management.rs` as they were, and drop their conformance counterparts. The on-failure restart test ran on the Docker and Kubernetes lanes but never on VM or Podman. Ported to conformance it fails on every VM row (#5507), and an `#[ignore]` there removes the coverage it gave Docker and Kubernetes. The global settings test changes a setting for the whole gateway, so it can't share a conformance run with other tests until the runner has a test group for it (#5295). `sandbox_setting_round_trip` stays in conformance. Signed-off-by: Evan Lezar <elezar@nvidia.com>
… trip sandbox_setting_round_trip deleted the gateway-wide ocsf_json_enabled value and restored it on cleanup, which changes every sandbox on a shared gateway while it runs. Fail with a hint when a global value is set instead, as policy_advisor does. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
10e797e to
36d882d
Compare
Summary
Moves the driver-agnostic sandbox lifecycle and API tests from
e2e/rustto testkit so they run on every conformance row, moves the rest to the podman driver suite or crate tests, and deletes the legacy files it replaces. PR1 of the #5297 plan.Related Issue
Closes #5425
Part of #5281
Changes
tests/suites/conformance/src/:image,labels,templates,settings,process,filesystem_policy. New tests inlifecycle.rsandfile_transfer.rs. The suite table intests/suites/conformance/README.mdis updated.tests/suites/drivers/podman/tests/oci_identity.rs: supervisor container identity and capabilities.crates/openshell-cli/tests/doctor_integration.rs(uses a fakedockeronPATH) andcrates/openshell-gateway/tests/proxy_config_preflight.rs.Context,SandboxBuilder,SandboxandCliSandboxBuildershare oneHandlesvalue (clients, CLI, cleanup), soCliSandboxBuilderowns its state likeSandboxBuilderrather than borrowingcx. Both builders are#[must_use]types, and their setters take the same argument types.cx.cli_sandbox(suffix)→CliSandboxBuilder(.image(),.policy_yaml(yaml),.args(),.command();.create()detaches and adopts,.run()returns the attachedCliOutput). It tracks the sandbox before the CLI runs and passes--no-tty.SandboxBuilder::image(..), so both builders set an image the same way, andcreate_ready()on both builders: create, then wait for Ready.Sandbox:poll_exec(what, timeout, command, ready)reruns an exec every 250 ms untilreadyaccepts its output;get_json()issandbox get --output json;wait_absent(timeout)waits for the gateway to remove the sandbox by itself, then checks get and list.ExecOutputandCliOutput:success(),failure()andexpect_stdout(expected), through one shared check so their messages match and report stdout and stderr.ExecOutput.descriptionnames the exec and its sandbox.CliOutput::report_text()(moved fromfile_transfer.rs) flattens a wrapped CLI error report for matching.testkit::YamlFile(from test(conformance): port the credential gating e2e tests #5318) replaces this PR's privatePolicyFile.CliSandboxBuilder::policy_yamluses it.testkit::with_deadline(what, timeout, future): a named deadline shorter than a step's own.std::io::Error,serde_json::Error,serde_yml::Errorandtonic::Statusconvert intotestkit::Error, so I/O and gRPC results take.context()directly. A convertedtonic::Statuskeeps its code forerror.grpc_code(), which replacesError::from_status. The.map_err(Error::from_error)calls in testkit,tests/supportand the features suites are gone.Engine::build_test_image(cx, name, containerfile)incontainer-engine-support: buildslocalhost/openshell-test-<name>:<run id>and removes it on cleanup.Engine::build_imageis now private, so callers can't skip the cleanup.cx.expect_listed(&sandbox, phase)andcx.expect_absent(&sandbox)are nowsandbox.expect_listed(phase)andsandbox.expect_absent(). The testkit README lists the current API.PolicyFilecopies and hand-writtensandbox create/sandbox getcalls inhost-gatewayandoci-image(host-gatewaynow creates its sandbox withcx.sandbox(..).image(..).policy(..).create_ready()and runs the client withsandbox.exec), the image build/cleanup inoci-imageand podmanoci_identity, and the create in podmanuserns.host-gatewaydrops itstempfiledependency andoci-imagedrops itsserde_jsondependency. The proposed CLI-delete cleanup helper was skipped because no test in this PR uses it.ExecOutput::success()also replaces the hand-written exit-code checks in the existingsmoke,lifecycle,persistent_workspace,file_transferandpolicy_advisorconformance tests. Polls and checks that expect a failure still readexit_code.credential_gating.rs(from test(conformance): port the credential gating e2e tests #5318) usescreate_ready()andpoll_exec.templates.rs,settings.rsandlabels.rsalso get small local helpers (create_template,read_global_setting,listed_names).[[test]]entries,PODMAN_CI_TESTSandTESTING.md. Also removed the now-deadSandboxGuard::create_with_gateway_default.e2e/rustuntil their batches:edge_tunnel_e2e.rs(with--enable-websocket-tunnel trueine2e/with-{docker,podman}-gateway.sh) andephemeral_cleanup.rs(on the Podman and VM lanes).e2e/rustuntil their blockers are fixed:sandbox_lifecycle::on_failure_policy_replaces_runtime_and_preserves_workspace(bug(vm): on-failure restart never completes because the preserved overlay fails e2fsck #5507) andsettings_management.rs(test(testkit): separate destructive tests from non-destructive ones #5527).sandbox_lifecycle.rskeeps its other tests for PR4 (test(e2e): port CLI-driven exec, attach and SSH host identity tests from e2e/rust #5426), which is stacked on this PR. PR4 must keep the file for the on-failure restart test until bug(vm): on-failure restart never completes because the preserved overlay fails e2fsck #5507 is fixed.docker_corporate_proxy.rsandvm_corporate_proxy.rs.docker_corporate_proxy.rskeeps itsproxy_settings_are_inserted_before_nested_driver_tablesunit test, because the remaining tests still use the helper it covers. Whichever of PR1/PR6 merges last deletesdocker_corporate_proxy.rs.vm_corporate_proxy.rsstays until PR9.Outcome per legacy test
sandbox_lifecycle::sandbox_stop_start_preserves_workspacepersistent_workspace_survives_stop_start. "Stop whileconnectis open" moves to PR4.sandbox_lifecycle::sandbox_can_be_deleted_while_stoppedlifecycle::stopped_sandbox_can_be_deletedsandbox_lifecycle::sandbox_exec_outlives_startup_recovery_deadlinelifecycle::exec_outlives_startup_recovery_deadlinesandbox_lifecycle::detached_canonical_main_{exit_zero_reaches_completed,nonzero_exit_reaches_error}lifecycle::main_exit_after_ready_sets_final_phasesandbox_lifecycle::canonical_main_and_exec_receive_declared_environment+canonical_tty_main_uses_sandbox_environmentlifecycle::canonical_main_environmentsandbox_lifecycle::detached_main_exit_during_provisioning_is_classified_as_workload_resultlifecycle::main_exit_during_provisioning_is_workload_resultsandbox_lifecycle::on_failure_policy_replaces_runtime_and_preserves_workspacee2e/rustuntil #5507 (on the VM driver the replacement never starts). The legacy test runs on the Docker and Kubernetes lanes.ephemeral_cleanup::detached_ephemeral_{success,failure}_removes_sandbox_and_driver_resourceslifecycle::detached_no_keep_sandbox_is_removed_after_main_exits; the legacy test stays for the driver-resource halflandlock::hard_requirement_accepts_enriched_device_pathfilesystem_policy::hard_requirement_accepts_added_device_pathslandlock::{best_effort,hard_requirement}_rejects_replaced_policy_{path,ancestor}(4)filesystem_policy::replaced_policy_path_rejects_next_launchcore_dump_hardening::sandbox_processes_disable_core_dumpsprocess::core_dumps_are_disableddefault_image::sandbox_from_default_imagelifecycle::default_command_sandbox_is_listed_readydefault_image::sandbox_from_explicit_nvidia_ubuntu_imageimage::explicit_image_is_usedsandbox_labels::sandbox_labels_are_stored_and_filterablelabels::labels_are_stored_and_filter_listsandbox_templates::sandbox_create_from_template_uses_reusable_workloadtemplates::sandbox_from_template_uses_its_workloadsandbox_templates::get-after-delete, duplicate name, missing template (3)templates::template_crud_errorssettings_management::settings_global_override_round_tripsettings::sandbox_setting_round_trip; the global override stays ine2e/rustuntil #5527upload_backpressure::large_upload_preserves_content_and_metadata_outside_workdirfile_transfer::large_upload_backpressure+ the outside-workdir metadata case infile_transferpodman_oci_identity::podman_supervisor_runs_as_oci_identity_without_capabilitiesdrivers/podmanoci_identity::supervisor_runs_as_oci_identity_without_capabilitiesdocker_preflight::doctor_check_fails_without_docker+doctor_check_output_shows_docker_labeldoctor_check_fails_without_docker_on_path(+doctor_check_fails_fast_when_docker_info_fails)docker_preflight::doctor_check_passes_with_dockerdoctor_check_passes_when_docker_info_succeedsdocker_preflight::doctor_check_error_includes_guidancedocker_corporate_proxy::…rejects_incoherent_configuration+vm_corporate_proxy::…rejects_incoherent_configurationproxy_config_preflight.rs(docker, podman, vm)docker_corporate_proxy::proxy_settings_are_inserted_before_nested_driver_tablesdocker_corporate_proxy.rsedge_tunnel_e2e(2 tests)e2e/rustuntil its batchinternet_network_perf::benchmark_complete_internet_pathlive_internet_traffic_perf::benchmark_live_internet_agent_trafficDecisions and defaults applied
large_upload_backpressureruns on every conformance row.sandbox_setting_round_tripreads the global value ofocsf_json_enabledand fails with a hint if one is set, because it would hide the sandbox's value. The legacy test cleared it instead.config preflight(category=malformed, file unchanged) and realopenshell-gateway --configstartup, because only startup names the offending keys.--policyYAML. Their policy sets noprocessidentity, so they run as the image'sUSER. The default test image has nosandboxuser. Rows without Landlock failhard_requirement, and they should.proxy_config_preflight.rscompiles only when the Docker, Podman or VM driver is built in, because the gateway feature matrix also builds without them. The--no-keeptest releases both sandboxes before waiting, with a 60 s limit.What was dropped or moved
internet_network_perfandlive_internet_traffic_perfwere manual, needed the live Internet, and nothing referenced them. test(perf): decide whether to bring back the live-Internet and data-path benchmarks #5472 tracks whether to bring one back.docker_preflight::doctor_check_error_includes_guidanceis dropped: the CLI doesn't printDOCKER_HOSTwhendocker infofails. The legacy test passed only because its fakedockerprintedDOCKER_HOSTitself, and the crate test already checks that the CLI shows docker's error.e2e/rustuntil their batches (test(e2e): decide which e2e/rust tests to port and in what order #5297, test: retire the old e2e test system onto testkit #5281).edge_tunnel_e2echecks the--enable-websocket-tunnelflag on real Docker and Podman gateways, which conformance can't vary.ephemeral_cleanupchecks that drivers remove their containers, pods and VM state, which conformance can't see. Until the driver suites replace it, its gateway half also runs in conformance.e2e/rustuntil their blockers are fixed. The on-failure restart test failed on every VM row when ported, because the VM driver's replacement never starts (bug(vm): on-failure restart never completes because the preserved overlay fails e2fsck #5507). Ignoring it in conformance would have dropped its Docker and Kubernetes coverage, so the legacy test stays until the fix. The global settings override changes a setting for every sandbox on the gateway. Conformance tests don't change gateway-wide state, so it waits for test(testkit): separate destructive tests from non-destructive ones #5527 to decide how destructive tests are marked and where they run.Testing
mise run e2e:testkiton a local Docker gateway: the full conformance suite passes (the#[ignore]d bug(sandbox): on Kubernetes, deleting a sandbox waits out the pods' termination grace period #5025 test is skipped, as on main), plus theoci-imageandhost-gatewayfeature suitescargo testfor the new crate tests on macOS:doctor_integration,proxy_config_preflight;proxy_config_preflightalso builds under the CI feature matrix (no drivers, Kubernetes only, Docker)-D warningsand fmt: openshell-server, -cli, -gateway, the conformance, podman and features suites,tests/support, testkit,e2e/rustmise run rust:lockfiles:checkcargo checkone2e/rustwithe2e,e2e-podman,e2e-dockerande2e-vmChecklist