Skip to content

Commit dbceb5f

Browse files
committed
Add failing test for IsTrustedBuilder not matching tagless known builders
Signed-off-by: Rune Soerensen <rsoerensen@salesforce.com>
1 parent aea0c7a commit dbceb5f

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

internal/builder/trusted_builder_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,23 @@ func trustedBuilder(t *testing.T, when spec.G, it spec.S) {
3030
})
3131

3232
when("IsTrustedBuilder", func() {
33+
it("trusts known trusted builders", func() {
34+
// Known builder with exact tag match
35+
isTrusted, err := bldr.IsTrustedBuilder(config.Config{}, "heroku/builder:24")
36+
h.AssertNil(t, err)
37+
h.AssertTrue(t, isTrusted)
38+
39+
// Known builder without tag should match any tag
40+
isTrusted, err = bldr.IsTrustedBuilder(config.Config{}, "paketobuildpacks/builder-jammy-base:latest")
41+
h.AssertNil(t, err)
42+
h.AssertTrue(t, isTrusted)
43+
44+
// Unknown builder should not be trusted
45+
isTrusted, err = bldr.IsTrustedBuilder(config.Config{}, "my/private/builder")
46+
h.AssertNil(t, err)
47+
h.AssertFalse(t, isTrusted)
48+
})
49+
3350
it("trust image without tag", func() {
3451
cfg := config.Config{
3552
TrustedBuilders: []config.TrustedBuilder{

0 commit comments

Comments
 (0)