Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/cocoonstack/vk-cocoon
go 1.27.1

require (
github.com/cocoonstack/cocoon-common v0.3.6
github.com/cocoonstack/cocoon-common v0.3.7-0.20260928172801-b03e52d1f721
github.com/google/go-containerregistry v0.22.1
github.com/projecteru2/core v0.1.5
github.com/prometheus/client_golang v1.24.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506 h1:ASDL+UJcILM
github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506/go.mod h1:Mw7HqKr2kdtu6aYGn3tPmAftiP3QPX63LdK/zcariIo=
github.com/cockroachdb/redact v1.1.8 h1:8eVLLj6juKxiKrAEw2b8cJvNqWq++U8WOfQFuL7KTaA=
github.com/cockroachdb/redact v1.1.8/go.mod h1:GceHHpJ0rMDpYARL5In88Alq/xMBUtVlz7Qxix6ZVkw=
github.com/cocoonstack/cocoon-common v0.3.6 h1:iRrIyeRXHgYuwKYDOB6TjidiZL1oeyfOYkTGXDSD/PU=
github.com/cocoonstack/cocoon-common v0.3.6/go.mod h1:Gw/zBYqntoxpcT//2rBcXHQz6JErin/IsTsEmoQdGr0=
github.com/cocoonstack/cocoon-common v0.3.7-0.20260928172801-b03e52d1f721 h1:xUtBRurq3bzpL2D0P0Apeiq4jjplNLOD/Kbd6G14WwM=
github.com/cocoonstack/cocoon-common v0.3.7-0.20260928172801-b03e52d1f721/go.mod h1:Gw/zBYqntoxpcT//2rBcXHQz6JErin/IsTsEmoQdGr0=
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
github.com/coreos/go-systemd/v22 v22.7.0 h1:LAEzFkke61DFROc7zNLX/WA2i5J8gYqe0rSj9KI28KA=
Expand Down
20 changes: 20 additions & 0 deletions provider/cocoon/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"net/http"
"os"
"path/filepath"
"regexp"
"slices"
"strings"
"sync"
Expand Down Expand Up @@ -866,6 +867,25 @@ func TestLocalSnapshotNameBoundsLongRegistryRefs(t *testing.T) {
}
}

func TestLocalSnapshotNameForDigestRefs(t *testing.T) {
valid := regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9._:/-]{0,62}$`)
repoA, refA := ociutil.ParseRef("simular/ubuntu2404-base-snapshot@sha256:" + strings.Repeat("0a", 32))
repoB, refB := ociutil.ParseRef("simular/ubuntu2404-base-snapshot@sha256:" + strings.Repeat("0b", 32))
if repoA != "simular/ubuntu2404-base-snapshot" || refA != "sha256:"+strings.Repeat("0a", 32) {
t.Fatalf("ParseRef split the digest ref into (%q, %q)", repoA, refA)
}
a, b := localSnapshotName(repoA, refA), localSnapshotName(repoB, refB)
if !valid.MatchString(a) || !valid.MatchString(b) {
t.Fatalf("digest-derived names %q, %q are not valid cocoon snapshot names", a, b)
}
if a == b {
t.Fatalf("two digests produced the same local name %q", a)
}
if !strings.HasPrefix(a, "simular/ubuntu2404-base-snapshot:") {
t.Fatalf("digest-derived name lost its recognizable prefix: %q", a)
}
}

func TestAssertSnapshotBackend(t *testing.T) {
t.Parallel()

Expand Down
Loading