MCPcopy Create free account
hub / github.com/aptly-dev/aptly / TestPutFileWithStorageClass

Method TestPutFileWithStorageClass

gcs/public_test.go:416–429  ·  view source on GitHub ↗

TestPutFileWithStorageClass covers the storageClass branch in putFile.

(c *C)

Source from the content-addressed store, hash-verified

414
415// TestPutFileWithStorageClass covers the storageClass branch in putFile.
416func (s *PublishedStorageSuite) TestPutFileWithStorageClass(c *C) {
417 st, err := NewPublishedStorage("test", "", "", "", "", "", "", "NEARLINE", "", false, false)
418 c.Assert(err, IsNil)
419
420 dir := c.MkDir()
421 src := filepath.Join(dir, "f")
422 c.Assert(os.WriteFile(src, []byte("hi"), 0644), IsNil)
423
424 c.Check(st.PutFile("a/b.txt", src), IsNil)
425
426 attrs, err := s.storage.bucket.Object("a/b.txt").Attrs(context.TODO())
427 c.Assert(err, IsNil)
428 c.Check(attrs.StorageClass, Equals, "NEARLINE")
429}
430
431// TestRemoveDirsNoSuchBucket covers the internalFilelist error path inside
432// RemoveDirs (and the iterator error branch in internalFilelist itself).

Callers

nothing calls this directly

Calls 4

PutFileMethod · 0.95
NewPublishedStorageFunction · 0.70
MkDirMethod · 0.65
CheckMethod · 0.45

Tested by

no test coverage detected