diff --git a/internal/snapshotstream/stream.go b/internal/snapshotstream/stream.go index d403ee2..c9b06af 100644 --- a/internal/snapshotstream/stream.go +++ b/internal/snapshotstream/stream.go @@ -103,6 +103,7 @@ func (s *Stream) writeTo(w io.Writer) (err error) { gzipWriter := gzip.NewWriter(w) gzipWriter.Header.Name = strings.TrimSuffix(filepath.Base(s.Filename), filepath.Ext(s.Filename)) gzipWriter.Header.Comment = fmt.Sprintf("Prometheus snapshot %s", s.name) + gzipWriter.Header.ModTime = time.Now() defer multierr.AppendInvoke(&err, multierr.Close(gzipWriter)) diff --git a/internal/snapshotstream/stream_test.go b/internal/snapshotstream/stream_test.go index 1c1167b..b8204ea 100644 --- a/internal/snapshotstream/stream_test.go +++ b/internal/snapshotstream/stream_test.go @@ -154,7 +154,7 @@ func TestStream(t *testing.T) { t.Errorf("gzip.NewReader() failed: %v", err) } - if diff := cmp.Diff(tc.wantGzipHeader, gzReader.Header, cmpopts.IgnoreFields(gzip.Header{}, "OS")); diff != "" { + if diff := cmp.Diff(tc.wantGzipHeader, gzReader.Header, cmpopts.IgnoreFields(gzip.Header{}, "OS", "ModTime")); diff != "" { t.Errorf("Gzip header diff (-want +got):\n%s", diff) }