MCPcopy
hub / github.com/kopia/kopia / TestCompression_ContentCompressionEnabled

Function TestCompression_ContentCompressionEnabled

repo/object/object_manager_test.go:172–191  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

170}
171
172func TestCompression_ContentCompressionEnabled(t *testing.T) {
173 ctx := testlogging.Context(t)
174
175 cmap := map[content.ID]compression.HeaderID{}
176 _, _, om := setupTest(t, cmap)
177
178 w := om.NewWriter(ctx, WriterOptions{
179 Compressor: "gzip",
180 MetadataCompressor: "zstd-fastest",
181 })
182 w.Write(bytes.Repeat([]byte{1, 2, 3, 4}, 1000))
183 oid, err := w.Result()
184 require.NoError(t, err)
185
186 cid, isCompressed, ok := oid.ContentID()
187
188 require.True(t, ok)
189 require.False(t, isCompressed) // oid will not indicate compression
190 require.Equal(t, compression.ByName["gzip"].HeaderID(), cmap[cid])
191}
192
193func TestCompression_IndirectContentCompressionEnabledMetadata(t *testing.T) {
194 ctx := testlogging.Context(t)

Callers

nothing calls this directly

Calls 9

ResultMethod · 0.95
ContextFunction · 0.92
setupTestFunction · 0.85
RepeatMethod · 0.80
ContentIDMethod · 0.80
EqualMethod · 0.80
NewWriterMethod · 0.65
HeaderIDMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected