Skip to content

Commit 162afbd

Browse files
Eric HuZachary Scott
authored andcommitted
Use gotest.tools/golden to simplify test file loading
"dep ensure" also bumped some dependencies
1 parent a7159ae commit 162afbd

File tree

26 files changed

+4373
-9
lines changed

26 files changed

+4373
-9
lines changed

Gopkg.lock

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/orb_test.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import (
1010

1111
"io"
1212

13+
"gotest.tools/golden"
14+
1315
. "github.com/onsi/ginkgo"
1416
. "github.com/onsi/gomega"
1517
"github.com/onsi/gomega/gbytes"
@@ -1081,23 +1083,18 @@ var _ = Describe("Orb integration tests", func() {
10811083

10821084
It("makes a namespace query and requests all orbs on that namespace", func() {
10831085
By("setting up a mock server")
1084-
10851086
// These requests and responses are generated from production data,
10861087
// but using a 5-per-page limit instead of the 20 requested.
1087-
tmpBytes, err := ioutil.ReadFile(filepath.Join("testdata/gql_orb_list_with_namespace", "first_request.json"))
1088-
Expect(err).ShouldNot(HaveOccurred())
1088+
tmpBytes := golden.Get(GinkgoT(), filepath.FromSlash("gql_orb_list_with_namespace/first_request.json"))
10891089
firstGqlRequest := string(tmpBytes)
10901090

1091-
tmpBytes, err = ioutil.ReadFile(filepath.Join("testdata/gql_orb_list_with_namespace", "second_request.json"))
1092-
Expect(err).ShouldNot(HaveOccurred())
1091+
tmpBytes = golden.Get(GinkgoT(), filepath.FromSlash("gql_orb_list_with_namespace/second_request.json"))
10931092
secondGqlRequest := string(tmpBytes)
10941093

1095-
tmpBytes, err = ioutil.ReadFile(filepath.Join("testdata/gql_orb_list_with_namespace", "first_response.json"))
1096-
Expect(err).ShouldNot(HaveOccurred())
1094+
tmpBytes = golden.Get(GinkgoT(), filepath.FromSlash("gql_orb_list_with_namespace/first_response.json"))
10971095
firstGqlResponse := string(tmpBytes)
10981096

1099-
tmpBytes, err = ioutil.ReadFile(filepath.Join("testdata/gql_orb_list_with_namespace", "second_response.json"))
1100-
Expect(err).ShouldNot(HaveOccurred())
1097+
tmpBytes = golden.Get(GinkgoT(), filepath.FromSlash("gql_orb_list_with_namespace/second_response.json"))
11011098
secondGqlResponse := string(tmpBytes)
11021099

11031100
// Use Gomega's default matcher instead of our custom appendPostHandler

vendor/github.com/google/go-cmp/LICENSE

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)