archive: improve TestSourceDateEpoch

The previous test wasn't highly meaningful because 5 * (100 * Millisecond)
is smaller than a second.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2023-01-06 11:19:02 +09:00
parent 5ef8bd4f87
commit f0917fb6e0
No known key found for this signature in database
GPG Key ID: 49524C6F9F638F1A

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 {