Skip to content

test(e2e): migrate template alias tests to sdk_compat framework#1052

Open
sparkzky wants to merge 4 commits into
TencentCloud:masterfrom
sparkzky:fix/e2e-template-alias-migration
Open

test(e2e): migrate template alias tests to sdk_compat framework#1052
sparkzky wants to merge 4 commits into
TencentCloud:masterfrom
sparkzky:fix/e2e-template-alias-migration

Conversation

@sparkzky

@sparkzky sparkzky commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrates template alias e2e tests from the standalone sdk/python/tests/test_template_e2e.py into the tests/e2e/sdk_compat/ framework introduced by #835.

Follow-up to #749 (template alias feature, merged).

Changes

File Change
sdk/python/tests/test_template_e2e.py Deleted — old standalone test file
tests/e2e/sdk_compat/cases/templates/test_alias.py New — 6 tests using CubeSandbox SDK
tests/e2e/sdk_compat/cases/templates/__init__.py New — package init
tests/e2e/sdk_compat/pytest.ini Added templates marker

No changes to framework/config.py. Container image (sandbox-code:latest) and writable layer size (1G) are hardcoded as module constants in the test file — no env vars needed.

Design decisions

  • CubeSandbox SDK only (no dual-backend parameterization): E2B SDK's template API uses a completely different endpoint format (/v3/templates with Dockerfile) that CubeAPI does not implement. E2B SDK compatibility is sandbox-operations-only. Template alias is a CubeSandbox feature inspired by E2B concepts, not an E2B SDK wire-compatible implementation.
  • No CUBE_TEMPLATE_E2E_IMAGE / CUBE_TEMPLATE_E2E_WRITABLE_LAYER_SIZE env vars: hardcoded defaults in the test module. Only CUBE_TEMPLATE_ID (already required by the framework) is needed.

Tests

Test What it covers
test_template_list_and_get_existing List templates + GET by ID
test_template_create_from_image_and_cleanup Create from image + cleanup
test_template_alias_dedicated_endpoint_rejects_invalid Invalid alias → 400 (no template creation)
test_template_alias_create_get_and_delete Full alias lifecycle: create → get by alias → delete by alias → 404
test_template_alias_dedicated_lookup_endpoint GET /templates/aliases/:alias endpoint
test_template_alias_rebuild_reassignment Rebuild with same alias → alias moves to newly READY template

Verified against a live one-click deployment: 6 passed in 55s.

Assisted-by: OhMyPi:zai/glm-5.2

Comment thread tests/e2e/sdk_compat/framework/config.py Outdated
@sparkzky sparkzky closed this Jul 21, 2026
@sparkzky
sparkzky force-pushed the fix/e2e-template-alias-migration branch from f6e66fc to 68d9165 Compare July 21, 2026 13:13
@sparkzky sparkzky reopened this Jul 21, 2026
sparkzky added 3 commits July 21, 2026 21:22
Move template e2e tests from sdk/python/tests/test_template_e2e.py to
tests/e2e/sdk_compat/cases/templates/test_alias.py, matching the TencentCloud#835
framework structure.

- Add cube_template_e2e_image (default: busybox from Tencent mirror)
  and cube_template_e2e_writable_layer_size (default: 1G) to config
  so users no longer need to set env vars manually.
- Add templates marker to pytest.ini.
- Replace the old validation test (which created 3 templates) with a
  lightweight one that hits GET /templates/aliases/:alias with invalid
  formats and expects 400 — no template creation needed.

Autonomously-by: OhMyPi:zai/glm-5.2
Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>
Per reviewer feedback, switch default from busybox to sandbox-code
(cube-sandbox-cn.tencentcloudcr.com/cube-sandbox/sandbox-code:latest)
which is the project's own image and more representative of real usage.

Autonomously-by: OhMyPi:zai/glm-5.2
Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>
…changes

- Remove TemplateAdapter and dual-backend parameterization. Template
  operations are CubeSandbox-only (E2B SDK template API is incompatible
  with CubeAPI — different endpoint format).
- Revert framework/config.py to master (remove cube_template_e2e_image
  and cube_template_e2e_writable_layer_size fields).
- Hardcode DEFAULT_IMAGE and DEFAULT_WRITABLE_LAYER_SIZE as module
  constants in test_alias.py. No env vars needed.

Autonomously-by: OhMyPi:zai/glm-5.2
Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>
@sparkzky
sparkzky force-pushed the fix/e2e-template-alias-migration branch from cbc4432 to 5669ede Compare July 21, 2026 13:24
Template operations only support cubesandbox backend. Add sdk_backend
parameter to template tests so [e2b] variants show as SKIPPED with
"template operations only support cubesandbox backend (E2B SDK template
API is incompatible with CubeAPI)" instead of silently not running.

test_template_alias_dedicated_endpoint_rejects_invalid stays unparameterized
since it tests raw HTTP validation (no SDK dependency).

Autonomously-by: OhMyPi:zai/glm-5.2
Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants