Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions go/test/e2e/cases/api-snapshot-scrub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ name: scrub a snapshot without breaking the restored environment
# baseline. Assertions look for the old sentinels rather than requiring paths
# to stay absent, because fresh provisioning may legitimately recreate them.
steps:
# sshv2 authenticates with the caller's user-owned SSH key, so the local
# identity's public half has to be registered before any sshv2 step runs.
# `create` reuses an existing local keypair rather than regenerating one (see
# ssh.GenerateIdentity), so this uploads the key already at
# ~/.ssh/amika_id_ed25519 and never overwrites it. The run-unique name means
# the key this case deletes is always one it registered.
- name: register the local SSH public key for sshv2
cmd: [secret, ssh-key, create, --name, "e2e-scrub-{{run_id}}", -o, json]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore the caller's SSH session configuration

When this E2E case runs on a machine whose v2 SSH identity was configured with secret ssh-keygen --import, ssh-key create calls ConfigureSession and replaces the persisted SessionConfig with ~/.ssh/amika_id_ed25519. Because SSH state and config are written under the caller's real home despite the runner's isolated AMIKA_STATE_DIRECTORY, and cleanup only deletes the remote key, the test permanently loses the imported identity selection and may leave subsequent sshv2 commands using a key that cleanup just unregistered. Preserve and restore the existing session configuration, or defer this case until its SSH files can be isolated.

Useful? React with 👍 / 👎.

expect:
exit: 0
schema: SshPublicKeySummary
stdout_json:
id: "@string"
capture:
ssh_key_id: $.id
resource:
type: ssh-key
name: "{{ssh_key_id}}"
cleanup: [secret, ssh-key, delete, "{{ssh_key_id}}", --force, -o, json]

- name: create a source sandbox
cmd: [sandbox, create, --remote, --no-git, --preset, coder, --size, xs, --yes, -o, json]
expect:
Expand All @@ -22,7 +42,7 @@ steps:
- name: inject scrub sentinels into the source sandbox
cmd:
- sandbox
- ssh
- sshv2
- "{{source_sandbox}}"
- --
- sh
Expand Down Expand Up @@ -114,7 +134,7 @@ steps:
- name: verify the scrubbed snapshot restores a clean usable environment
cmd:
- sandbox
- ssh
- sshv2
- "{{restored_sandbox}}"
- --
- sh
Expand Down
Loading