Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
76 lines
2.3 KiB
Go
76 lines
2.3 KiB
Go
package agentstatus
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/tutti-os/tutti/services/tuttid/service/managedruntime"
|
|
)
|
|
|
|
func TestResolvedExistingManagedNodeRuntimeRejectsBrokenCorepack(t *testing.T) {
|
|
root := fakeManagedRuntimeRoot(t)
|
|
writeExecutable(
|
|
t,
|
|
filepath.Join(root, "node", "bin", corepackBinaryNameForTest()),
|
|
"#!/bin/sh\nexit 0\n",
|
|
)
|
|
|
|
if runtime, ok := resolvedExistingManagedNodeRuntime(root, func() []string {
|
|
return []string{"PATH=/usr/bin:/bin"}
|
|
}); ok {
|
|
t.Fatalf("resolvedExistingManagedNodeRuntime() = %#v, want incompatible cache rejected", runtime)
|
|
}
|
|
}
|
|
|
|
func TestResolveManagedNodeRuntimeForProviderDoesNotUseBrokenOptionalCache(t *testing.T) {
|
|
root := fakeManagedRuntimeRoot(t)
|
|
writeExecutable(
|
|
t,
|
|
filepath.Join(root, "node", "bin", corepackBinaryNameForTest()),
|
|
"#!/bin/sh\nexit 0\n",
|
|
)
|
|
service := Service{
|
|
Environ: func() []string {
|
|
return []string{"PATH=/usr/bin:/bin"}
|
|
},
|
|
ManagedRuntime: managedruntime.DefaultResolver{RuntimeRoot: root},
|
|
}
|
|
|
|
if runtime, ok := service.resolveManagedNodeRuntimeForProvider(context.Background(), false); ok {
|
|
t.Fatalf("resolveManagedNodeRuntimeForProvider() = %#v, want incompatible optional cache skipped", runtime)
|
|
}
|
|
}
|
|
|
|
func TestResolvedExistingManagedNodeRuntimeAcceptsCompatibleCorepack(t *testing.T) {
|
|
root := fakeManagedRuntimeRoot(t)
|
|
|
|
runtime, ok := resolvedExistingManagedNodeRuntime(root, func() []string {
|
|
return []string{"PATH=/usr/bin:/bin"}
|
|
})
|
|
if !ok {
|
|
t.Fatal("resolvedExistingManagedNodeRuntime() rejected compatible cache")
|
|
}
|
|
wantNode := filepath.Join(root, "node", "bin", nodeBinaryNameForTest())
|
|
if runtime.Node != wantNode {
|
|
t.Fatalf("Node = %q, want %q", runtime.Node, wantNode)
|
|
}
|
|
}
|
|
|
|
func TestResolvedExistingManagedNodeRuntimeInheritsProcessPath(t *testing.T) {
|
|
root := fakeManagedRuntimeRoot(t)
|
|
inheritedPath := strings.Join([]string{t.TempDir(), t.TempDir()}, string(os.PathListSeparator))
|
|
t.Setenv("PATH", inheritedPath)
|
|
|
|
resolved, ok := resolvedExistingManagedNodeRuntime(root, nil)
|
|
if !ok {
|
|
t.Fatal("resolvedExistingManagedNodeRuntime() rejected compatible cache")
|
|
}
|
|
wantPath := filepath.Join(root, "node", "bin") + string(os.PathListSeparator) + inheritedPath
|
|
if got := managedruntime.EnvValue(resolved.EnvOverrides, "PATH"); got != wantPath {
|
|
t.Fatalf("PATH = %q, want %q", got, wantPath)
|
|
}
|
|
}
|