It verifies the size and hash of each before returning and fails the test if any of the checks fail. It also fails the test if StreamBlobs returns a non-nil error.
(t *testing.T, s *storage)
| 134 | // before returning and fails the test if any of the checks fail. It |
| 135 | // also fails the test if StreamBlobs returns a non-nil error. |
| 136 | func streamAll(t *testing.T, s *storage) []*blob.Blob { |
| 137 | blobs := make([]*blob.Blob, 0, 1024) |
| 138 | ch := make(chan blobserver.BlobAndToken) |
| 139 | errCh := make(chan error, 1) |
| 140 | |
| 141 | ctx, cancel := context.WithCancel(context.Background()) |
| 142 | defer cancel() |
| 143 | go func() { errCh <- s.StreamBlobs(ctx, ch, "") }() |
| 144 | |
| 145 | for bt := range ch { |
| 146 | verifySizeAndHash(t, bt.Blob) |
| 147 | blobs = append(blobs, bt.Blob) |
| 148 | } |
| 149 | if err := <-errCh; err != nil { |
| 150 | t.Fatalf("StreamBlobs error = %v", err) |
| 151 | } |
| 152 | return blobs |
| 153 | } |
| 154 | |
| 155 | // Tests the streaming of all blobs in a storage, with hash verification. |
| 156 | func TestBasicStreaming(t *testing.T) { |
no test coverage detected