Skip to content

Conversation

@afzal-qxip
Copy link

Implementation for #6

@rita7lopes rita7lopes linked an issue May 7, 2025 that may be closed by this pull request
data
(struct { ResultType string "json:\"resultType\""; Result []e2e_tests.MatrixResult "json:\"result\"" }) {
ResultType: (string) (len=6) "matrix",
Result: ([]e2e_tests.MatrixResult) <nil>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty much all the tests have Result: ([]e2e_tests.MatrixResult) <nil> . That's wrong. The result should be non-nil

var seriesResp SeriesResponse
err = json.Unmarshal(body, &seriesResp)
Expect(err).NotTo(HaveOccurred())
err = cupaloy.New().SnapshotMulti(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snapshot should be for the response body as well. Not just for status.

Expect(err).NotTo(HaveOccurred())

Expect(resp.StatusCode).To(Equal(200))
err = cupaloy.New().SnapshotMulti(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snapshot should be for the response body as well. Not just for status.

resp, err := runRequest(fmt.Sprintf(`{test_id="%s"} | freq > 1 and (freq="4" or freq==2 or freq > 0.5)`, testID), 0, 0, 0, "", 0)
Expect(err).NotTo(HaveOccurred())
adjustResult(resp, "", 0)
err = cupaloy.New().SnapshotMulti(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snapshot should be for the response body as well. Not just for status.

Expect(err).NotTo(HaveOccurred())
adjustResult(resp, "", 0)
err = cupaloy.New().SnapshotMulti(
"status", resp.Status,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snapshot should be for the response body as well. Not just for status.

Expect(err).ToNot(HaveOccurred())
defer resp.Body.Close()
Expect(resp.StatusCode).To(Equal(200))
err = cupaloy.New().SnapshotMulti(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this snapshot check.

Expect(err).ToNot(HaveOccurred())
defer resp.Body.Close()
Expect(resp.StatusCode).To(Equal(200))
err = cupaloy.New().SnapshotMulti(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this snapshot check.

Expect(err).ToNot(HaveOccurred())
defer resp.Body.Close()
Expect(resp.StatusCode).To(Equal(200))
err = cupaloy.New().SnapshotMulti(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this snapshot check.

Expect(err).ToNot(HaveOccurred())
defer resp.Body.Close()
Expect(resp.StatusCode).To(Equal(200))
err = cupaloy.New().SnapshotMulti(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this snapshot check.

defer resp.Body.Close()
Expect(resp.StatusCode).To(Equal(401))
}
err = cupaloy.New().SnapshotMulti(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this snapshot check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement E2E Test Suite Using Ginkgo

2 participants