Skip to content

atelet: add successful RPC boundary tests#469

Open
Yiqing Wang (YQ-Wang) wants to merge 1 commit into
agent-substrate:mainfrom
YQ-Wang:feat/issue-217-atelet-rpc-tests
Open

atelet: add successful RPC boundary tests#469
Yiqing Wang (YQ-Wang) wants to merge 1 commit into
agent-substrate:mainfrom
YQ-Wang:feat/issue-217-atelet-rpc-tests

Conversation

@YQ-Wang

Copy link
Copy Markdown

Summary

  • make ateom client dialing and image pulling injectable
  • allow atelet filesystem paths to be redirected in tests
  • cover a successful local Run, Checkpoint, and Restore lifecycle at the RPC boundary

Testing

  • go test ./cmd/atelet ./internal/ateompath
  • go test ./...

Closes #217

@YQ-Wang
Yiqing Wang (YQ-Wang) force-pushed the feat/issue-217-atelet-rpc-tests branch from 089f487 to 711e3bb Compare July 22, 2026 04:55
@YQ-Wang

Copy link
Copy Markdown
Author

Dmitry Berkovich (@dberkov) ptal, thanks!

Comment thread cmd/atelet/main_test.go Outdated
// and sandbox record handling all use the production paths.
func TestRPCBoundariesAccept(t *testing.T) {
origBasePath, origStaticFilesDir := ateompath.BasePath, ateompath.StaticFilesDir
ateompath.BasePath = t.TempDir()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Mutable derived path vars are a footgun (main concern). StaticFilesDir is derived from BasePath at package init, so a test that overrides BasePath must remember to also override every derived var — this test does, but the invariant lives in the test, not the package. Concretely: the in-flight PR #467 adds ImageCacheDir = filepath.Join(BasePath, "image-cache") to that same var block. Once both merge, this test would silently leave ImageCacheDir pointing at
/var/lib/ateom-gvisor/image-cache while BasePath points at a tempdir.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated the derived paths to functions of BasePath and added a regression test covering StaticFilesDir, ImageCacheDir, and RunSCBinaryPath.

Comment thread cmd/atelet/main_test.go
@@ -458,6 +461,156 @@ func TestRPCBoundariesReject(t *testing.T) {
})
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Global mutation rules out t.Parallel. Fine today (no parallel tests in the package), but worth a one-line comment on the test so nobody adds t.Parallel() to a sibling test that touches ateompath paths.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added a comment that the test must not run in parallel because it redirects the package-wide BasePath.

Comment thread cmd/atelet/oci.go Outdated
Fetch(context.Context, string) (io.ReadCloser, *v1.Config, error)
}

func prepareOCIDirectory(ctx context.Context, pullCache imagePuller, actorUID, containerName, ref string, command, args []string, env []string, annotations map[string]string, netns string, identityDir string, durableDirVolumeMounts []*ateletpb.VolumeMount) error {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

could you please wait for #467 be committed first.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Rebased onto merged #467 and updated the test seam to the new EnsureImage API.

Comment thread cmd/atelet/main_test.go Outdated

client := &fakeAteomClient{}
dialer := &fakeAteomDialer{client: client}
s := &AteomHerder{ateomDialer: dialer, pullCache: fakeImagePuller{}}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nil GCS clients are safe only implicitly. The AteomHerder fixture omits anonGCSClient/gcsClient; that's sound because the runsc binary is pre-seeded (so ensureSandboxAssets cache-hits) and checkpoint type is LOCAL — but a future edit that causes a cache miss would nil-panic rather than fail with a message. A one-line comment stating why nil is OK would save the next person a debugging round.

// GCS clients stay nil: the runsc asset is pre-seeded above (so
// ensureSandboxAssets never downloads) and the checkpoint/restore legs
// use CHECKPOINT_TYPE_LOCAL, so no code path touches object storage.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added the requested comment explaining why the nil GCS clients are safe in this fixture.

@YQ-Wang
Yiqing Wang (YQ-Wang) force-pushed the feat/issue-217-atelet-rpc-tests branch from 711e3bb to 6f40c26 Compare July 23, 2026 07:40
@YQ-Wang
Yiqing Wang (YQ-Wang) force-pushed the feat/issue-217-atelet-rpc-tests branch from 6f40c26 to 02ab98b Compare July 23, 2026 07:48
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.

Expand validation test coverage at atelet's RPC layer

2 participants