Fix unittest of flow graph

Signed-off-by: neza2017 <yefu.chen@zilliz.com>
pull/4973/head^2
neza2017 2020-12-24 14:10:00 +08:00 committed by yefu.chen
parent 5d58606349
commit 0afeaa78c8
2 changed files with 10 additions and 5 deletions

View File

@ -5,7 +5,6 @@ import (
"fmt" "fmt"
"log" "log"
"math" "math"
"math/big"
"math/rand" "math/rand"
"sync" "sync"
"testing" "testing"
@ -139,9 +138,15 @@ func sendMsgFromCmd(ctx context.Context, fg *TimeTickedFlowGraph) {
} }
// assert result // assert result
expect := math.Pow(num, 2) + math.Sqrt(num) expect := math.Pow(num, 2) + math.Sqrt(num)
if big.NewFloat(res) != big.NewFloat(expect) { resBits := math.Float64bits(res)
fmt.Println(res) expBits := math.Float64bits(expect)
fmt.Println(math.Pow(num, 2) + math.Sqrt(num)) var diffBits uint64
if resBits >= expBits {
diffBits = resBits - expBits
} else {
diffBits = expBits - resBits
}
if diffBits > 2 {
panic("wrong answer") panic("wrong answer")
} }
} }

View File

@ -13,5 +13,5 @@ SCRIPTS_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# ignore Minio,S3 unittes # ignore Minio,S3 unittes
MILVUS_DIR="${SCRIPTS_DIR}/../internal/" MILVUS_DIR="${SCRIPTS_DIR}/../internal/"
echo $MILVUS_DIR echo $MILVUS_DIR
go test -cover "${MILVUS_DIR}/kv/..." "${MILVUS_DIR}/msgstream/..." "${MILVUS_DIR}/master/..." "${MILVUS_DIR}/querynode/..." "${MILVUS_DIR}/storage" "${MILVUS_DIR}/proxy/..." "${MILVUS_DIR}/writenode/..." -failfast go test -cover "${MILVUS_DIR}/kv/..." "${MILVUS_DIR}/msgstream/..." "${MILVUS_DIR}/master/..." "${MILVUS_DIR}/querynode/..." "${MILVUS_DIR}/storage" "${MILVUS_DIR}/proxy/..." "${MILVUS_DIR}/writenode/..." "${MILVUS_DIR}/util/..." -failfast
#go test -cover "${MILVUS_DIR}/kv/..." "${MILVUS_DIR}/msgstream/..." "${MILVUS_DIR}/master/..." "${MILVUS_DIR}/querynode/..." -failfast #go test -cover "${MILVUS_DIR}/kv/..." "${MILVUS_DIR}/msgstream/..." "${MILVUS_DIR}/master/..." "${MILVUS_DIR}/querynode/..." -failfast