From 88a6e6d3746826172524d339aca7b80baac4588f Mon Sep 17 00:00:00 2001 From: ashmrtn <3891298+ashmrtn@users.noreply.github.com> Date: Thu, 31 Aug 2023 08:50:41 -0700 Subject: [PATCH] Use a larger data chunk to test compression (#4115) Test that compression is on by default by having one file be large and easily compressible. Compression is indirectly checked by looking at how many bytes were uploaded. --- #### Does this PR need a docs update or release note? - [ ] :white_check_mark: Yes, it's included - [ ] :clock1: Yes, but in a later PR - [x] :no_entry: No #### Type of change - [ ] :sunflower: Feature - [ ] :bug: Bugfix - [ ] :world_map: Documentation - [x] :robot: Supportability/Tests - [ ] :computer: CI/Deployment - [x] :broom: Tech Debt/Cleanup #### Issue(s) * closes #3156 #### Test Plan - [x] :muscle: Manual - [ ] :zap: Unit test - [ ] :green_heart: E2E --- src/internal/kopia/wrapper_test.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/internal/kopia/wrapper_test.go b/src/internal/kopia/wrapper_test.go index 8c511a6f0..c43b724eb 100644 --- a/src/internal/kopia/wrapper_test.go +++ b/src/internal/kopia/wrapper_test.go @@ -5,6 +5,7 @@ import ( "context" "io" stdpath "path" + "strings" "testing" "time" @@ -765,18 +766,24 @@ func (suite *KopiaIntegrationSuite) TearDownTest() { } func (suite *KopiaIntegrationSuite) TestBackupCollections() { + c1 := exchMock.NewCollection( + suite.storePath1, + suite.locPath1, + 5) + // Add a 4k chunk of data that should be compressible. This helps check + // compression is enabled because we do some testing on the number of bytes + // uploaded during the first backup. + c1.Data[0] = []byte(strings.Repeat("abcdefgh", 512)) + collections := []data.BackupCollection{ - exchMock.NewCollection( - suite.storePath1, - suite.locPath1, - 5), + c1, exchMock.NewCollection( suite.storePath2, suite.locPath2, 42), } - c1 := exchMock.NewCollection( + c1 = exchMock.NewCollection( suite.storePath1, suite.locPath1, 0)