TestPutFileWithStorageClass covers the storageClass branch in putFile.
(c *C)
| 414 | |
| 415 | // TestPutFileWithStorageClass covers the storageClass branch in putFile. |
| 416 | func (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). |
nothing calls this directly
no test coverage detected