mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-08-15 10:23:37 +00:00
Squash merge PR #100 after resolving changelog conflict with current dev. PR CI run 26703558537 passed release-versioning, go, and web.
31 lines
892 B
Go
31 lines
892 B
Go
package sandbox
|
|
|
|
import "testing"
|
|
|
|
func TestDockerCacheKeyIncludesWorkspaceAndConfig(t *testing.T) {
|
|
cfg := DefaultConfig()
|
|
key := "agent:default:session"
|
|
|
|
first := dockerCacheKey(key, "/srv/goclaw/workspace/tenant-a", cfg)
|
|
second := dockerCacheKey(key, "/srv/goclaw/workspace/tenant-b", cfg)
|
|
if first == second {
|
|
t.Fatalf("dockerCacheKey reused key for different workspaces: %q", first)
|
|
}
|
|
|
|
ro := cfg
|
|
ro.WorkspaceAccess = AccessRO
|
|
third := dockerCacheKey(key, "/srv/goclaw/workspace/tenant-a", ro)
|
|
if first == third {
|
|
t.Fatalf("dockerCacheKey reused key for different workspace access: %q", first)
|
|
}
|
|
}
|
|
|
|
func TestDockerCacheKeyPreservesEmptyWorkspaceCompatibility(t *testing.T) {
|
|
cfg := DefaultConfig()
|
|
key := "agent:default:session"
|
|
|
|
if got := dockerCacheKey(key, "", cfg); got != key {
|
|
t.Fatalf("dockerCacheKey empty workspace = %q, want original key %q", got, key)
|
|
}
|
|
}
|