Skip to content

Commit 6a2f36a

Browse files
committed
Rename 'helper.JsonSatisfies' into 'helper.JsonStatisfiesAll' to make the intent clearer
1 parent 12f1f56 commit 6a2f36a

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

tests/helper/helper_generic.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"context"
66
"encoding/json"
77
"fmt"
8-
"github.com/onsi/gomega/types"
98
"os"
109
"path/filepath"
1110
"regexp"
@@ -15,6 +14,8 @@ import (
1514
"testing"
1615
"time"
1716

17+
"github.com/onsi/gomega/types"
18+
1819
"github.com/tidwall/gjson"
1920

2021
"github.com/redhat-developer/odo/pkg/config"
@@ -325,8 +326,8 @@ func JsonPathContentContain(json string, path string, value string) {
325326
Expect(result.String()).To(ContainSubstring(value), fmt.Sprintf("content of path %q should contain %q but is %q", path, value, result.String()))
326327
}
327328

328-
// JsonPathSatisfies expects content of the path to satisfy all the matchers passed to it
329-
func JsonPathSatisfies(json string, path string, matchers ...types.GomegaMatcher) {
329+
// JsonPathSatisfiesAll expects content of the path to satisfy all the matchers passed to it
330+
func JsonPathSatisfiesAll(json string, path string, matchers ...types.GomegaMatcher) {
330331
result := gjson.Get(json, path)
331332
Expect(result.String()).Should(SatisfyAll(matchers...))
332333
}

tests/integration/generic_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ var _ = Describe("odo generic", func() {
155155
By("checking the JSON output", func() {
156156
odoVersion = helper.Cmd("odo", "version", "-o", "json").ShouldPass().Out()
157157
Expect(helper.IsJSON(odoVersion)).To(BeTrue())
158-
helper.JsonPathSatisfies(odoVersion, "version", MatchRegexp(reJSONVersion))
158+
helper.JsonPathSatisfiesAll(odoVersion, "version", MatchRegexp(reJSONVersion))
159159
helper.JsonPathExist(odoVersion, "gitCommit")
160160
if podman {
161-
helper.JsonPathSatisfies(odoVersion, "podman.client.version", MatchRegexp(reJSONVersion), Equal(helper.GetPodmanVersion()))
161+
helper.JsonPathSatisfiesAll(odoVersion, "podman.client.version", MatchRegexp(reJSONVersion), Equal(helper.GetPodmanVersion()))
162162
} else {
163-
helper.JsonPathSatisfies(odoVersion, "cluster.kubernetes.version", MatchRegexp(reJSONVersion))
163+
helper.JsonPathSatisfiesAll(odoVersion, "cluster.kubernetes.version", MatchRegexp(reJSONVersion))
164164
serverURL := oc.GetCurrentServerURL()
165165
helper.JsonPathContentIs(odoVersion, "cluster.serverURL", serverURL)
166166
if !helper.IsKubernetesCluster() {
@@ -169,7 +169,7 @@ var _ = Describe("odo generic", func() {
169169
// A blank serverVersion might indicate a user permission error on certain clusters (observed with a developer account on Prow nightly jobs)
170170
m = Not(m)
171171
}
172-
helper.JsonPathSatisfies(odoVersion, "cluster.openshift", m)
172+
helper.JsonPathSatisfiesAll(odoVersion, "cluster.openshift", m)
173173
}
174174
}
175175
})
@@ -205,10 +205,10 @@ var _ = Describe("odo generic", func() {
205205
By("checking JSON output", func() {
206206
odoVersion := helper.Cmd("odo", "version", "--client", "-o", "json").ShouldPass().Out()
207207
Expect(helper.IsJSON(odoVersion)).To(BeTrue())
208-
helper.JsonPathSatisfies(odoVersion, "version", MatchRegexp(reJSONVersion))
208+
helper.JsonPathSatisfiesAll(odoVersion, "version", MatchRegexp(reJSONVersion))
209209
helper.JsonPathExist(odoVersion, "gitCommit")
210-
helper.JsonPathSatisfies(odoVersion, "cluster", BeEmpty())
211-
helper.JsonPathSatisfies(odoVersion, "podman", BeEmpty())
210+
helper.JsonPathSatisfiesAll(odoVersion, "cluster", BeEmpty())
211+
helper.JsonPathSatisfiesAll(odoVersion, "podman", BeEmpty())
212212
})
213213
})
214214
})

0 commit comments

Comments
 (0)