|
|
|
@@ -24,7 +24,7 @@ func makeTestOpts(t *testing.T) *LocalBuildOptions {
|
|
|
|
|
RepoPrefix: "https://git.test/molecule-ai/molecule-ai-workspace-template-",
|
|
|
|
|
Platform: "linux/amd64",
|
|
|
|
|
HTTPClient: &http.Client{},
|
|
|
|
|
preflightLocalBuild: func() error {
|
|
|
|
|
checkShellDeps: func() error {
|
|
|
|
|
return nil // tests bypass the real PATH check
|
|
|
|
|
},
|
|
|
|
|
remoteHeadSha: func(ctx context.Context, opts *LocalBuildOptions, runtime string) (string, error) {
|
|
|
|
@@ -46,10 +46,7 @@ func makeTestOpts(t *testing.T) *LocalBuildOptions {
|
|
|
|
|
dockerTag: func(ctx context.Context, src, dst string) error {
|
|
|
|
|
return nil
|
|
|
|
|
},
|
|
|
|
|
// Stub the shell-dep pre-flight so tests run without docker/git on PATH.
|
|
|
|
|
checkShellDeps: func() error {
|
|
|
|
|
return nil
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -677,10 +674,10 @@ func TestProvisionerStartUsesLocalBuild_LocalMode(t *testing.T) {
|
|
|
|
|
// caught by this test.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TestEnsureLocalImage_Hooks preflightLocalBuild — when preflight fails,
|
|
|
|
|
// TestEnsureLocalImage_Hooks checkShellDeps — when preflight fails,
|
|
|
|
|
func TestEnsureLocalImage_PreflightFailsIfDockerMissing(t *testing.T) {
|
|
|
|
|
opts := makeTestOpts(t)
|
|
|
|
|
opts.preflightLocalBuild = func() error {
|
|
|
|
|
opts.checkShellDeps = func() error {
|
|
|
|
|
return fmt.Errorf(
|
|
|
|
|
"local-build mode requires `docker` and `git` on PATH in the platform container; " +
|
|
|
|
|
"found: docker=<missing>, git=<missing>. " +
|
|
|
|
@@ -702,7 +699,7 @@ func TestEnsureLocalImage_PreflightFailsIfDockerMissing(t *testing.T) {
|
|
|
|
|
// nil, execution proceeds normally.
|
|
|
|
|
func TestEnsureLocalImage_PreflightOKPassesThrough(t *testing.T) {
|
|
|
|
|
opts := makeTestOpts(t)
|
|
|
|
|
opts.preflightLocalBuild = func() error { return nil }
|
|
|
|
|
opts.checkShellDeps = func() error { return nil }
|
|
|
|
|
tag, err := ensureLocalImageWithOpts(context.Background(), "claude-code", opts)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatalf("unexpected error: %v", err)
|
|
|
|
|