Skip to content

Commit 11a31b8

Browse files
committed
fix
1 parent 1075097 commit 11a31b8

File tree

1 file changed

+4
-32
lines changed

1 file changed

+4
-32
lines changed

test/e2e/atlas_e2e_test_generator_test.go

+4-32
Original file line numberDiff line numberDiff line change
@@ -115,38 +115,6 @@ func removeContentEncoding(r *http.Response) {
115115
}
116116
}
117117

118-
func decompressGzip(r *http.Response) error {
119-
reader, err := gzip.NewReader(r.Body)
120-
if err != nil {
121-
return err
122-
}
123-
defer reader.Close()
124-
buf := new(bytes.Buffer)
125-
126-
if _, err := io.Copy(buf, reader); err != nil {
127-
return err
128-
}
129-
r.Body = io.NopCloser(buf)
130-
r.ContentLength = int64(buf.Len())
131-
r.Header["Content-Length"] = []string{fmt.Sprintf("%v", r.ContentLength)}
132-
removeContentEncoding(r)
133-
return nil
134-
}
135-
136-
func decompressDeflate(r *http.Response) error {
137-
reader := flate.NewReader(r.Body)
138-
defer reader.Close()
139-
buf := new(bytes.Buffer)
140-
if _, err := io.Copy(buf, reader); err != nil {
141-
return err
142-
}
143-
r.Body = io.NopCloser(buf)
144-
r.ContentLength = int64(buf.Len())
145-
r.Header["Content-Length"] = []string{fmt.Sprintf("%v", r.ContentLength)}
146-
removeContentEncoding(r)
147-
return nil
148-
}
149-
150118
func compareSnapshots(a *http.Response, b *http.Response) int {
151119
methodCmp := strings.Compare(a.Request.Method, b.Request.Method)
152120
if methodCmp != 0 {
@@ -680,6 +648,10 @@ func (g *atlasE2ETestGenerator) snapshotServer() {
680648

681649
snapshot := g.prepareSnapshot(resp)
682650

651+
if compareSnapshots(snapshot, g.lastData) == 0 {
652+
return nil // skip if the response is the same
653+
}
654+
683655
g.storeSnapshot(snapshot)
684656

685657
return nil

0 commit comments

Comments
 (0)