Skip to content

Commit c87bdf0

Browse files
authored
Revert "handling for big int"
This reverts commit dacd2be.
1 parent 23b50a8 commit c87bdf0

File tree

2 files changed

+8
-23
lines changed

2 files changed

+8
-23
lines changed

core/util/util.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
log "github.com/sirupsen/logrus"
1515
"io/ioutil"
1616
"k8s.io/client-go/util/jsonpath"
17-
"math/big"
1817
"math/rand"
1918
"net/http"
2019
"net/url"
@@ -400,12 +399,14 @@ func jsonPath(query, toMatch string) interface{} {
400399
return ""
401400
}
402401

403-
// Jsonpath library converts large int into a string with scientific notion, the following
404-
// reverts that process to avoid mismatching when using the jsonpath result for csv data lookup
405-
bigInt := new(big.Int)
406-
if _, ok := bigInt.SetString(result, 10); ok {
407-
result = fmt.Sprint(bigInt)
408-
}
402+
//// Jsonpath library converts large int into a string with scientific notion, the following
403+
//// reverts that process to avoid mismatching when using the jsonpath result for csv data lookup
404+
//floatResult, err := strconv.ParseFloat(result, 64)
405+
//// if the string is a float and a whole number
406+
//if err == nil && floatResult == float64(int64(floatResult)) {
407+
// intResult := int(floatResult)
408+
// result = strconv.Itoa(intResult)
409+
//}
409410

410411
// convert to array data if applicable
411412
var data interface{}

core/util/util_test.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -234,22 +234,6 @@ func Test_CopyMap(t *testing.T) {
234234
Expect(newMap["second"]).To(Equal("2"))
235235
}
236236

237-
func Test_JsonPathMethod_WithBigFloatingNumber(t *testing.T) {
238-
239-
RegisterTestingT(t)
240-
res := jsonPath(PrepareJsonPathQuery("$.registrant"),
241-
`{"registrant":"13495985898986869898697879879987978978.12345566777"}`)
242-
Expect(res).To(Equal("13495985898986869898697879879987978978.12345566777"))
243-
}
244-
245-
func Test_JsonPathMethod_WithBigIntegerNumber(t *testing.T) {
246-
247-
RegisterTestingT(t)
248-
res := jsonPath(PrepareJsonPathQuery("$.registrant"),
249-
`{"registrant":"13495985898986869898697879879987978978"}`)
250-
Expect(res).To(Equal("13495985898986869898697879879987978978"))
251-
}
252-
253237
func Test_Identical_ReturnsTrue_WithExactlySameArray(t *testing.T) {
254238
RegisterTestingT(t)
255239
first := [2]string{"q1", "q2"}

0 commit comments

Comments
 (0)