Skip to content

Commit

Permalink
♻️ fix test
Browse files Browse the repository at this point in the history
Signed-off-by: vankichi <[email protected]>
  • Loading branch information
vankichi committed May 23, 2022
1 parent 3e6c767 commit c6bb079
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/e2e/performance/max_vector_dim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func init() {
flag.StringVar(&namespace, "namespace", "default", "namespace")
flag.IntVar(&bit, "bit", 1, "bit")
flag.UintVar(&indexingWaitSeconds, "wait", 30, "indexing wait seconds")
flag.StringVar(&fileName, "file", "tmp.log", "output file name")

flag.BoolVar(&pf, "portforward", false, "enable port forwarding")
flag.StringVar(&pfPodName, "portforward-pod-name", "vald-lb-gateway", "pod name (only for port forward)")
Expand All @@ -88,28 +89,28 @@ func init() {
func TestMain(m *testing.M) {
log.Init(log.WithLoggerType(logger.NOP.String()))
var d []byte
err := os.WriteFile("./tmp.log", d, os.ModePerm)
err := os.WriteFile(fileName, d, os.ModePerm)
if err != nil {
os.Exit(1)
}

if pf {
kubeClient, err = client.New(kubeConfig)
if err != nil {
os.WriteFile("./tmp.log", []byte(err.Error()), os.ModePerm)
os.WriteFile(fileName, []byte(err.Error()), os.ModePerm)
os.Exit(1)
}
forwarder = kubeClient.Portforward(namespace, pfPodName, port, pfPodPort)
err = forwarder.Start()
if err != nil {
os.WriteFile("./tmp.log", []byte(err.Error()), os.ModePerm)
os.WriteFile(fileName, []byte(err.Error()), os.ModePerm)
os.Exit(1)
}
}

if bit < 2 || maxBit < bit {
err = errors.New("Invalid argument: bit should be 0 ~ 32. set bit was " + strconv.Itoa(bit))
os.WriteFile("./tmp.log", []byte(err.Error()), os.ModePerm)
os.WriteFile(fileName, []byte(err.Error()), os.ModePerm)
os.Exit(1)
}
_ = m.Run()
Expand Down Expand Up @@ -162,7 +163,7 @@ func TestE2EInsertOnlyWithOneVectorAndSearch(t *testing.T) {
if err != nil {
st, _ := status.FromError(err)
if st.Code() == codes.Code(code.Code_RESOURCE_EXHAUSTED) {
os.WriteFile("./tmp.log", []byte(st.Code().String()), os.ModePerm)
os.WriteFile(fileName, []byte(st.Code().String()), os.ModePerm)
return
}
t.Fatalf("TestE2EInsertOnlyWithOneVectorAndSearch\t Insert Error: %v", err)
Expand All @@ -188,7 +189,7 @@ func TestE2EInsertOnlyWithOneVectorAndSearch(t *testing.T) {
}
t.Logf("[Pass] SearchByID process (Bit = %d)", bit)
if string(b) != "" {
os.WriteFile("./tmp.log", []byte("OK"), os.ModePerm)
os.WriteFile(fileName, []byte("OK"), os.ModePerm)
return
}
}
Expand Down

0 comments on commit c6bb079

Please sign in to comment.