Merge pull request #7927 from AkihiroSuda/improve-TestSourceDateEpoch

archive: improve TestSourceDateEpoch
This commit is contained in:
Maksym Pavlenko 2023-01-06 12:01:36 -08:00 committed by GitHub
commit 9bfe1d911c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1186,6 +1186,9 @@ func TestSourceDateEpoch(t *testing.T) {
fstest.Chtimes("/f3", veryRecent, veryRecent), fstest.Chtimes("/f3", veryRecent, veryRecent),
) )
makeDiffTarTest(validators, a, b, opts...)(t) makeDiffTarTest(validators, a, b, opts...)(t)
if testing.Short() {
t.Skip("short: skipping repro test")
}
makeDiffTarReproTest(a, b, opts...)(t) makeDiffTarReproTest(a, b, opts...)(t)
} }
@ -1350,13 +1353,13 @@ func makeDiffTar(t *testing.T, a, b fstest.Applier, opts ...WriteDiffOpt) (diges
func makeDiffTarReproTest(a, b fstest.Applier, opts ...WriteDiffOpt) func(*testing.T) { func makeDiffTarReproTest(a, b fstest.Applier, opts ...WriteDiffOpt) func(*testing.T) {
return func(t *testing.T) { return func(t *testing.T) {
const ( const (
count = 5 count = 30
delay = 100 * time.Millisecond delay = 100 * time.Millisecond
) )
var lastDigest digest.Digest var lastDigest digest.Digest
for i := 0; i < count; i++ { for i := 0; i < count; i++ {
dgst, _ := makeDiffTar(t, a, b, opts...) dgst, _ := makeDiffTar(t, a, b, opts...)
t.Logf("#%d: digest %s", i, dgst) t.Logf("#%02d: %v: digest %s", i, time.Now(), dgst)
if lastDigest == "" { if lastDigest == "" {
lastDigest = dgst lastDigest = dgst
} else if dgst != lastDigest { } else if dgst != lastDigest {