go-concourse: fix flaky tests
When golang maps order is not guaranteed, ginkgo url values matching requires a deep equal i.e. same item with same order, there is no easy way to test such case fly: remove unused files Signed-off-by: Rui Yang <ryang@pivotal.io>
This commit is contained in:
parent
ac5f6b673f
commit
a4dad1a420
|
@ -1,21 +0,0 @@
|
|||
package flaghelpers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
type JsonFlag struct {
|
||||
Raw string
|
||||
Value map[string]string
|
||||
}
|
||||
|
||||
func (v *JsonFlag) UnmarshalFlag(value string) error {
|
||||
err := json.Unmarshal([]byte(value), &v.Value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
v.Raw = value
|
||||
|
||||
return nil
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package flaghelpers_test
|
||||
|
||||
import (
|
||||
. "github.com/concourse/concourse/fly/commands/internal/flaghelpers"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("JsonFlag", func() {
|
||||
Context("when JSON string is invalid", func() {
|
||||
It("displays an error message", func() {
|
||||
jsonFlag := &JsonFlag{}
|
||||
|
||||
err := jsonFlag.UnmarshalFlag("{some:value}")
|
||||
Expect(err).To(MatchError("invalid character 's' looking for beginning of object key string"))
|
||||
})
|
||||
})
|
||||
|
||||
Context("when JSON string is valid", func() {
|
||||
It("parse the JSON into version", func() {
|
||||
jsonFlag := &JsonFlag{}
|
||||
|
||||
err := jsonFlag.UnmarshalFlag(`{"some":"value"}`)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(jsonFlag.Value).To(Equal(map[string]string{"some": "value"}))
|
||||
Expect(jsonFlag.Raw).To(Equal(`{"some":"value"}`))
|
||||
})
|
||||
})
|
||||
})
|
|
@ -158,11 +158,11 @@ var _ = Describe("ATC Handler Resource Versions", func() {
|
|||
|
||||
Context("when filter is specified", func() {
|
||||
BeforeEach(func() {
|
||||
filter = atc.Version{"some": "value", "some-other": "other-value"}
|
||||
filter = atc.Version{"some": "value"}
|
||||
|
||||
atcServer.AppendHandlers(
|
||||
ghttp.CombineHandlers(
|
||||
ghttp.VerifyRequest("GET", expectedURL, "filter=some:value&filter=some-other:other-value"),
|
||||
ghttp.VerifyRequest("GET", expectedURL, "filter=some:value"),
|
||||
ghttp.RespondWithJSONEncoded(http.StatusOK, expectedVersions),
|
||||
),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue