MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / TestDownload

Method TestDownload

pkg/blobmanager/s3/backend_test.go:226–253  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

224}
225
226func (s *testSuite) TestDownload() {
227 s.T().Run("exist but not uploaded by Chainloop", func(t *testing.T) {
228 buf := bytes.NewBuffer(nil)
229 err := s.backend.Download(context.Background(), buf, s.externalObjectDigest)
230 s.ErrorContains(err, "asset not uploaded by Chainloop")
231 s.Empty(buf)
232 })
233
234 s.T().Run("doesn't exist", func(t *testing.T) {
235 buf := bytes.NewBuffer(nil)
236 err := s.backend.Download(context.Background(), buf, "deadbeef")
237 s.ErrorContains(err, "artifact not found")
238 s.Empty(buf)
239 })
240
241 s.T().Run("exists", func(t *testing.T) {
242 buf := bytes.NewBuffer(nil)
243 err := s.backend.Download(context.Background(), buf, s.ownedObjectDigest)
244 s.NoError(err)
245 s.Equal("test", buf.String())
246 })
247
248 // s.T().Run("it's been tampered", func(t *testing.T) {
249 // buf := bytes.NewBuffer(nil)
250 // err := s.backend.Download(context.Background(), buf, s.tamperedObjectDigest)
251 // s.ErrorContains(err, "failed to validate integrity of object")
252 // })
253}
254
255type testSuite struct {
256 suite.Suite

Callers

nothing calls this directly

Calls 3

DownloadMethod · 0.65
StringMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected