(t *testing.T)
| 85 | } |
| 86 | |
| 87 | func (s *formatSpecificTestSuite) TestPackingSimple(t *testing.T) { |
| 88 | ctx, env := repotesting.NewEnvironment(t, s.formatVersion) |
| 89 | |
| 90 | content1 := "hello, how do you do?" |
| 91 | content2 := "hi, how are you?" |
| 92 | content3 := "thank you!" |
| 93 | |
| 94 | oid1a := writeObject(ctx, t, env.RepositoryWriter, []byte(content1), "packed-object-1a") |
| 95 | oid1b := writeObject(ctx, t, env.RepositoryWriter, []byte(content1), "packed-object-1b") |
| 96 | oid2a := writeObject(ctx, t, env.RepositoryWriter, []byte(content2), "packed-object-2a") |
| 97 | oid2b := writeObject(ctx, t, env.RepositoryWriter, []byte(content2), "packed-object-2b") |
| 98 | |
| 99 | oid3a := writeObject(ctx, t, env.RepositoryWriter, []byte(content3), "packed-object-3a") |
| 100 | oid3b := writeObject(ctx, t, env.RepositoryWriter, []byte(content3), "packed-object-3b") |
| 101 | verify(ctx, t, env.RepositoryWriter, oid1a, []byte(content1), "packed-object-1") |
| 102 | verify(ctx, t, env.RepositoryWriter, oid2a, []byte(content2), "packed-object-2") |
| 103 | oid2c := writeObject(ctx, t, env.RepositoryWriter, []byte(content2), "packed-object-2c") |
| 104 | oid1c := writeObject(ctx, t, env.RepositoryWriter, []byte(content1), "packed-object-1c") |
| 105 | |
| 106 | env.RepositoryWriter.ContentManager().Flush(ctx) |
| 107 | |
| 108 | if got, want := oid1a.String(), oid1b.String(); got != want { |
| 109 | t.Errorf("oid1a(%q) != oid1b(%q)", got, want) |
| 110 | } |
| 111 | |
| 112 | if got, want := oid1a.String(), oid1c.String(); got != want { |
| 113 | t.Errorf("oid1a(%q) != oid1c(%q)", got, want) |
| 114 | } |
| 115 | |
| 116 | if got, want := oid2a.String(), oid2b.String(); got != want { |
| 117 | t.Errorf("oid2(%q)a != oidb(%q)", got, want) |
| 118 | } |
| 119 | |
| 120 | if got, want := oid2a.String(), oid2c.String(); got != want { |
| 121 | t.Errorf("oid2(%q)a != oidc(%q)", got, want) |
| 122 | } |
| 123 | |
| 124 | if got, want := oid3a.String(), oid3b.String(); got != want { |
| 125 | t.Errorf("oid3a(%q) != oid3b(%q)", got, want) |
| 126 | } |
| 127 | |
| 128 | env.VerifyBlobCount(t, 4) |
| 129 | |
| 130 | env.MustReopen(t) |
| 131 | |
| 132 | verify(ctx, t, env.RepositoryWriter, oid1a, []byte(content1), "packed-object-1") |
| 133 | verify(ctx, t, env.RepositoryWriter, oid2a, []byte(content2), "packed-object-2") |
| 134 | verify(ctx, t, env.RepositoryWriter, oid3a, []byte(content3), "packed-object-3") |
| 135 | |
| 136 | if _, err := env.RepositoryWriter.ContentManager().CompactIndexes(ctx, indexblob.CompactOptions{MaxSmallBlobs: 1}); err != nil { |
| 137 | t.Errorf("optimize error: %v", err) |
| 138 | } |
| 139 | |
| 140 | env.MustReopen(t) |
| 141 | |
| 142 | verify(ctx, t, env.RepositoryWriter, oid1a, []byte(content1), "packed-object-1") |
| 143 | verify(ctx, t, env.RepositoryWriter, oid2a, []byte(content2), "packed-object-2") |
| 144 | verify(ctx, t, env.RepositoryWriter, oid3a, []byte(content3), "packed-object-3") |
nothing calls this directly
no test coverage detected