Skip to content

Commit

Permalink
add e2e make command
Browse files Browse the repository at this point in the history
Signed-off-by: kpango <[email protected]>
  • Loading branch information
kpango committed Feb 1, 2021
1 parent 57269ff commit abbfa88
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 1 deletion.
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,22 @@ K8S_SERVER_VERSION ?= $(eval K8S_SERVER_VERSION := $(shell echo "$(K8S_KUBECTL_V
COMMA := ,
SHELL = bash

E2E_BIND_HOST ?= 127.0.0.1
E2E_BIND_PORT ?= 8082
E2E_TIMEOUT ?= 15m
E2E_DATASET_NAME ?= fashion-mnist-784-euclidean
E2E_INSERT_COUNT ?= 1000
E2E_SEARCH_COUNT ?= 1000
E2E_SEARCH_BY_ID_COUNT ?= 10
E2E_GET_OBJECT_COUNT ?= 10
E2E_UPDATE_COUNT ?= 3
E2E_REMOVE_COUNT ?= 3
E2E_WAIT_FOR_CREATE_INDEX_DURATION ?= 3m
E2E_TARGET_NAME ?= vald-meta-gateway
E2E_TARGET_POD_NAME ?= $(eval E2E_TARGET_POD_NAME := $(shell kubectl get pods --selector=app=$(E2E_TARGET_NAME) | tail -1 | cut -f1 -d " "))$(E2E_TARGET_POD_NAME)
E2E_TARGET_NAMESPACE ?= default
E2E_TARGET_PORT ?= 8081

include Makefile.d/functions.mk

.PHONY: maintainer
Expand Down Expand Up @@ -469,3 +485,4 @@ include Makefile.d/kind.mk
include Makefile.d/client.mk
include Makefile.d/ml.mk
include Makefile.d/test.mk
include Makefile.d/e2e.mk
41 changes: 41 additions & 0 deletions Makefile.d/e2e.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#
# Copyright (C) 2019-2021 vdaas.org vald team <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

.PHONY: e2e
## run e2e
e2e:
$(call run-e2e-test)

.PHONY: e2e/insert
## run insert e2e
e2e/insert:
$(call run-e2e-test,-run TestE2EInsert)


.PHONY: e2e/update
## run update e2e
e2e/update:
$(call run-e2e-test,-run TestE2EUpdate)

.PHONY: e2e/search
## run search e2e
e2e/search:
$(call run-e2e-test,-run TestE2ESearch)

.PHONY: e2e/remove
## run remove e2e
e2e/remove:
$(call run-e2e-test,-run TestE2ERemove)
23 changes: 23 additions & 0 deletions Makefile.d/functions.mk
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,26 @@ define telepresence
## https://github.com/telepresenceio/telepresence/commit/bb7473fbf19ed4f61796a5e32747e23de6ab03da
## --deployment-type "$(SWAP_DEPLOYMENT_TYPE)"
endef


define run-e2e-test
go test \
$1 \
-v $(ROOTDIR)/tests/e2e/crud_test.go \
-tags "e2e" \
-timeout $(E2E_TIMEOUT) \
-host=$(E2E_BIND_HOST) \
-port=$(E2E_BIND_PORT) \
-dataset=$(ROOTDIR)/hack/benchmark/assets/dataset/$(E2E_DATASET_NAME).hdf5 \
-insert-num=$(E2E_INSERT_COUNT) \
-search-num=$(E2E_SEARCH_COUNT) \
-search-by-id-num=$(E2E_SEARCH_BY_ID_COUNT) \
-get-object-num=$(E2E_GET_OBJECT_COUNT) \
-update-num=$(E2E_UPDATE_COUNT) \
-remove-num=$(E2E_REMOVE_COUNT) \
-wait-after-insert=$(E2E_WAIT_FOR_CREATE_INDEX_DURATION) \
-portforward-ns=$(E2E_TARGET_NAMESPACE) \
-portforward-pod-name=$(E2E_TARGET_POD_NAME) \
-portforward-pod-port=$(E2E_TARGET_PORT) \
-portforward
endef
2 changes: 1 addition & 1 deletion tests/e2e/crud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func init() {
}
}

fmt.Printf("loading dataset: %s", *datasetName)
fmt.Printf("loading dataset: %s ", *datasetName)
ds, err = hdf5ToDataset(*datasetName)
if err != nil {
panic(err)
Expand Down

0 comments on commit abbfa88

Please sign in to comment.