mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-08 01:58:34 +08:00
Merge branch '0.5.0' into '0.5.0'
Merge from github See merge request megasearch/milvus!777 Former-commit-id: 1708e34ea9f129a1f7d6d484785a20d63f1a3b2b
This commit is contained in:
commit
a69ae2e1ba
152
ci/jenkins/Jenkinsfile
vendored
Normal file
152
ci/jenkins/Jenkinsfile
vendored
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
pipeline {
|
||||||
|
agent none
|
||||||
|
|
||||||
|
options {
|
||||||
|
timestamps()
|
||||||
|
}
|
||||||
|
|
||||||
|
parameters{
|
||||||
|
choice choices: ['Release', 'Debug'], description: '', name: 'BUILD_TYPE'
|
||||||
|
string defaultValue: 'cf1434e7-5a4b-4d25-82e8-88d667aef9e5', description: 'GIT CREDENTIALS ID', name: 'GIT_CREDENTIALS_ID', trim: true
|
||||||
|
string defaultValue: 'registry.zilliz.com', description: 'DOCKER REGISTRY URL', name: 'DOKCER_REGISTRY_URL', trim: true
|
||||||
|
string defaultValue: 'ba070c98-c8cc-4f7c-b657-897715f359fc', description: 'DOCKER CREDENTIALS ID', name: 'DOCKER_CREDENTIALS_ID', trim: true
|
||||||
|
string defaultValue: 'http://192.168.1.202/artifactory/milvus', description: 'JFROG ARTFACTORY URL', name: 'JFROG_ARTFACTORY_URL', trim: true
|
||||||
|
string defaultValue: '1a527823-d2b7-44fd-834b-9844350baf14', description: 'JFROG CREDENTIALS ID', name: 'JFROG_CREDENTIALS_ID', trim: true
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
PROJECT_NAME = "milvus"
|
||||||
|
LOWER_BUILD_TYPE = params.BUILD_TYPE.toLowerCase()
|
||||||
|
SEMVER = "${BRANCH_NAME}"
|
||||||
|
JOBNAMES = env.JOB_NAME.split('/')
|
||||||
|
PIPELINE_NAME = "${JOBNAMES[0]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage("Ubuntu 18.04") {
|
||||||
|
environment {
|
||||||
|
OS_NAME = "ubuntu18.04"
|
||||||
|
PACKAGE_VERSION = VersionNumber([
|
||||||
|
versionNumberString : '${SEMVER}-${LOWER_BUILD_TYPE}-ubuntu18.04-x86_64-${BUILD_DATE_FORMATTED, "yyyyMMdd"}-${BUILDS_TODAY}'
|
||||||
|
]);
|
||||||
|
DOCKER_VERSION = "${SEMVER}-${OS_NAME}-${LOWER_BUILD_TYPE}"
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage("Run Build") {
|
||||||
|
agent {
|
||||||
|
kubernetes {
|
||||||
|
label 'build'
|
||||||
|
defaultContainer 'jnlp'
|
||||||
|
yamlFile 'ci/jenkins/pod/milvus-build-env-pod.yaml'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
container('milvus-build-env') {
|
||||||
|
script {
|
||||||
|
load "${env.WORKSPACE}/ci/jenkins/jenkinsfile/build.groovy"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Code Coverage') {
|
||||||
|
steps {
|
||||||
|
container('milvus-build-env') {
|
||||||
|
script {
|
||||||
|
load "${env.WORKSPACE}/ci/jenkins/jenkinsfile/coverage.groovy"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Upload Package') {
|
||||||
|
steps {
|
||||||
|
container('milvus-build-env') {
|
||||||
|
script {
|
||||||
|
load "${env.WORKSPACE}/ci/jenkins/jenkinsfile/package.groovy"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage("Publish docker images") {
|
||||||
|
agent {
|
||||||
|
kubernetes {
|
||||||
|
label 'publish'
|
||||||
|
defaultContainer 'jnlp'
|
||||||
|
yamlFile 'ci/jenkins/pod/docker-pod.yaml'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Publish') {
|
||||||
|
steps {
|
||||||
|
container('publish-images'){
|
||||||
|
script {
|
||||||
|
load "${env.WORKSPACE}/ci/jenkins/jenkinsfile/publishImages.groovy"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage("Deploy to Development") {
|
||||||
|
agent {
|
||||||
|
kubernetes {
|
||||||
|
label 'dev-test'
|
||||||
|
defaultContainer 'jnlp'
|
||||||
|
yamlFile 'ci/jenkins/pod/testEnvironment.yaml'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage("Deploy to Dev") {
|
||||||
|
steps {
|
||||||
|
container('milvus-test-env') {
|
||||||
|
script {
|
||||||
|
load "${env.WORKSPACE}/ci/jenkins/jenkinsfile/deploySingle2Dev.groovy"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage("Dev Test") {
|
||||||
|
steps {
|
||||||
|
container('milvus-test-env') {
|
||||||
|
script {
|
||||||
|
load "${env.WORKSPACE}/ci/jenkins/jenkinsfile/singleDevTest.groovy"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage ("Cleanup Dev") {
|
||||||
|
steps {
|
||||||
|
container('milvus-test-env') {
|
||||||
|
script {
|
||||||
|
load "${env.WORKSPACE}/ci/jenkins/jenkinsfile/cleanupSingleDev.groovy"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
unsuccessful {
|
||||||
|
container('milvus-test-env') {
|
||||||
|
script {
|
||||||
|
load "${env.WORKSPACE}/ci/jenkins/jenkinsfile/cleanupSingleDev.groovy"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
9
ci/jenkins/jenkinsfile/build.groovy
Normal file
9
ci/jenkins/jenkinsfile/build.groovy
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
timeout(time: 60, unit: 'MINUTES') {
|
||||||
|
dir ("ci/jenkins/scripts") {
|
||||||
|
sh "./build.sh -l"
|
||||||
|
withCredentials([usernamePassword(credentialsId: "${params.JFROG_CREDENTIALS_ID}", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
|
||||||
|
sh "export JFROG_ARTFACTORY_URL='${params.JFROG_ARTFACTORY_URL}' && export JFROG_USER_NAME='${USERNAME}' && export JFROG_PASSWORD='${PASSWORD}' && ./build.sh -t ${params.BUILD_TYPE} -o /opt/milvus -d /opt/milvus -j -u -c"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
9
ci/jenkins/jenkinsfile/cleanupSingleDev.groovy
Normal file
9
ci/jenkins/jenkinsfile/cleanupSingleDev.groovy
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
try {
|
||||||
|
sh "helm del --purge ${env.PIPELINE_NAME}-${env.BUILD_NUMBER}-single-gpu"
|
||||||
|
} catch (exc) {
|
||||||
|
def helmResult = sh script: "helm status ${env.PIPELINE_NAME}-${env.BUILD_NUMBER}-single-gpu", returnStatus: true
|
||||||
|
if (!helmResult) {
|
||||||
|
sh "helm del --purge ${env.PIPELINE_NAME}-${env.BUILD_NUMBER}-single-gpu"
|
||||||
|
}
|
||||||
|
throw exc
|
||||||
|
}
|
||||||
10
ci/jenkins/jenkinsfile/coverage.groovy
Normal file
10
ci/jenkins/jenkinsfile/coverage.groovy
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
timeout(time: 60, unit: 'MINUTES') {
|
||||||
|
dir ("ci/jenkins/scripts") {
|
||||||
|
sh "./coverage.sh -o /opt/milvus -u root -p 123456 -t \$POD_IP"
|
||||||
|
// Set some env variables so codecov detection script works correctly
|
||||||
|
withCredentials([[$class: 'StringBinding', credentialsId: "${env.PIPELINE_NAME}-codecov-token", variable: 'CODECOV_TOKEN']]) {
|
||||||
|
sh 'curl -s https://codecov.io/bash | bash -s - -f output_new.info || echo "Codecov did not collect coverage reports"'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
14
ci/jenkins/jenkinsfile/deploySingle2Dev.groovy
Normal file
14
ci/jenkins/jenkinsfile/deploySingle2Dev.groovy
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
try {
|
||||||
|
sh 'helm init --client-only --skip-refresh --stable-repo-url https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts'
|
||||||
|
sh 'helm repo update'
|
||||||
|
dir ('milvus-helm') {
|
||||||
|
checkout([$class: 'GitSCM', branches: [[name: "0.5.0"]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${params.GIT_CREDENTIALS_ID}", url: "https://github.com/milvus-io/milvus-helm.git", name: 'origin', refspec: "+refs/heads/0.5.0:refs/remotes/origin/0.5.0"]]])
|
||||||
|
dir ("milvus-gpu") {
|
||||||
|
sh "helm install --wait --timeout 300 --set engine.image.tag=${DOCKER_VERSION} --set expose.type=clusterIP --name ${env.PIPELINE_NAME}-${env.BUILD_NUMBER}-single-gpu -f ci/values.yaml --namespace milvus ."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (exc) {
|
||||||
|
echo 'Helm running failed!'
|
||||||
|
sh "helm del --purge ${env.PIPELINE_NAME}-${env.BUILD_NUMBER}-single-gpu"
|
||||||
|
throw exc
|
||||||
|
}
|
||||||
9
ci/jenkins/jenkinsfile/package.groovy
Normal file
9
ci/jenkins/jenkinsfile/package.groovy
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
timeout(time: 5, unit: 'MINUTES') {
|
||||||
|
sh "tar -zcvf ./${PROJECT_NAME}-${PACKAGE_VERSION}.tar.gz -C /opt/ milvus"
|
||||||
|
withCredentials([usernamePassword(credentialsId: "${params.JFROG_CREDENTIALS_ID}", usernameVariable: 'JFROG_USERNAME', passwordVariable: 'JFROG_PASSWORD')]) {
|
||||||
|
def uploadStatus = sh(returnStatus: true, script: "curl -u${JFROG_USERNAME}:${JFROG_PASSWORD} -T ./${PROJECT_NAME}-${PACKAGE_VERSION}.tar.gz ${params.JFROG_ARTFACTORY_URL}/milvus/package/${PROJECT_NAME}-${PACKAGE_VERSION}.tar.gz")
|
||||||
|
if (uploadStatus != 0) {
|
||||||
|
error("\" ${PROJECT_NAME}-${PACKAGE_VERSION}.tar.gz \" upload to \" ${params.JFROG_ARTFACTORY_URL}/milvus/package/${PROJECT_NAME}-${PACKAGE_VERSION}.tar.gz \" failed!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
47
ci/jenkins/jenkinsfile/publishImages.groovy
Normal file
47
ci/jenkins/jenkinsfile/publishImages.groovy
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
container('publish-images') {
|
||||||
|
timeout(time: 15, unit: 'MINUTES') {
|
||||||
|
dir ("docker/deploy/${OS_NAME}") {
|
||||||
|
def binaryPackage = "${PROJECT_NAME}-${PACKAGE_VERSION}.tar.gz"
|
||||||
|
|
||||||
|
withCredentials([usernamePassword(credentialsId: "${params.JFROG_CREDENTIALS_ID}", usernameVariable: 'JFROG_USERNAME', passwordVariable: 'JFROG_PASSWORD')]) {
|
||||||
|
def downloadStatus = sh(returnStatus: true, script: "curl -u${JFROG_USERNAME}:${JFROG_PASSWORD} -O ${params.JFROG_ARTFACTORY_URL}/milvus/package/${binaryPackage}")
|
||||||
|
|
||||||
|
if (downloadStatus != 0) {
|
||||||
|
error("\" Download \" ${params.JFROG_ARTFACTORY_URL}/milvus/package/${binaryPackage} \" failed!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sh "tar zxvf ${binaryPackage}"
|
||||||
|
def imageName = "${PROJECT_NAME}/engine:${DOCKER_VERSION}"
|
||||||
|
|
||||||
|
try {
|
||||||
|
def isExistSourceImage = sh(returnStatus: true, script: "docker inspect --type=image ${imageName} 2>&1 > /dev/null")
|
||||||
|
if (isExistSourceImage == 0) {
|
||||||
|
def removeSourceImageStatus = sh(returnStatus: true, script: "docker rmi ${imageName}")
|
||||||
|
}
|
||||||
|
|
||||||
|
def customImage = docker.build("${imageName}")
|
||||||
|
|
||||||
|
def isExistTargeImage = sh(returnStatus: true, script: "docker inspect --type=image ${params.DOKCER_REGISTRY_URL}/${imageName} 2>&1 > /dev/null")
|
||||||
|
if (isExistTargeImage == 0) {
|
||||||
|
def removeTargeImageStatus = sh(returnStatus: true, script: "docker rmi ${params.DOKCER_REGISTRY_URL}/${imageName}")
|
||||||
|
}
|
||||||
|
|
||||||
|
docker.withRegistry("https://${params.DOKCER_REGISTRY_URL}", "${params.DOCKER_CREDENTIALS_ID}") {
|
||||||
|
customImage.push()
|
||||||
|
}
|
||||||
|
} catch (exc) {
|
||||||
|
throw exc
|
||||||
|
} finally {
|
||||||
|
def isExistSourceImage = sh(returnStatus: true, script: "docker inspect --type=image ${imageName} 2>&1 > /dev/null")
|
||||||
|
if (isExistSourceImage == 0) {
|
||||||
|
def removeSourceImageStatus = sh(returnStatus: true, script: "docker rmi ${imageName}")
|
||||||
|
}
|
||||||
|
|
||||||
|
def isExistTargeImage = sh(returnStatus: true, script: "docker inspect --type=image ${params.DOKCER_REGISTRY_URL}/${imageName} 2>&1 > /dev/null")
|
||||||
|
if (isExistTargeImage == 0) {
|
||||||
|
def removeTargeImageStatus = sh(returnStatus: true, script: "docker rmi ${params.DOKCER_REGISTRY_URL}/${imageName}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
ci/jenkins/jenkinsfile/singleDevTest.groovy
Normal file
22
ci/jenkins/jenkinsfile/singleDevTest.groovy
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
timeout(time: 30, unit: 'MINUTES') {
|
||||||
|
dir ("tests/milvus_python_test") {
|
||||||
|
sh 'python3 -m pip install -r requirements.txt'
|
||||||
|
sh "pytest . --alluredir=\"test_out/dev/single/sqlite\" --level=1 --ip ${env.PIPELINE_NAME}-${env.BUILD_NUMBER}-single-gpu-milvus-gpu-engine.milvus.svc.cluster.local"
|
||||||
|
}
|
||||||
|
// mysql database backend test
|
||||||
|
load "${env.WORKSPACE}/ci/jenkins/jenkinsfile/cleanupSingleDev.groovy"
|
||||||
|
|
||||||
|
if (!fileExists('milvus-helm')) {
|
||||||
|
dir ("milvus-helm") {
|
||||||
|
checkout([$class: 'GitSCM', branches: [[name: "0.5.0"]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${params.GIT_CREDENTIALS_ID}", url: "https://github.com/milvus-io/milvus-helm.git", name: 'origin', refspec: "+refs/heads/0.5.0:refs/remotes/origin/0.5.0"]]])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dir ("milvus-helm") {
|
||||||
|
dir ("milvus-gpu") {
|
||||||
|
sh "helm install --wait --timeout 300 --set engine.image.tag=${DOCKER_VERSION} --set expose.type=clusterIP --name ${env.PIPELINE_NAME}-${env.BUILD_NUMBER}-single-gpu -f ci/db_backend/mysql_values.yaml --namespace milvus ."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dir ("tests/milvus_python_test") {
|
||||||
|
sh "pytest . --alluredir=\"test_out/dev/single/mysql\" --level=1 --ip ${env.PIPELINE_NAME}-${env.BUILD_NUMBER}-single-gpu-milvus-gpu-engine.milvus.svc.cluster.local"
|
||||||
|
}
|
||||||
|
}
|
||||||
23
ci/jenkins/pod/docker-pod.yaml
Normal file
23
ci/jenkins/pod/docker-pod.yaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: publish
|
||||||
|
componet: docker
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: publish-images
|
||||||
|
image: registry.zilliz.com/library/docker:v1.0.0
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
command:
|
||||||
|
- cat
|
||||||
|
tty: true
|
||||||
|
volumeMounts:
|
||||||
|
- name: docker-sock
|
||||||
|
mountPath: /var/run/docker.sock
|
||||||
|
volumes:
|
||||||
|
- name: docker-sock
|
||||||
|
hostPath:
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
|
||||||
35
ci/jenkins/pod/milvus-build-env-pod.yaml
Normal file
35
ci/jenkins/pod/milvus-build-env-pod.yaml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: milvus-build-env
|
||||||
|
labels:
|
||||||
|
app: milvus
|
||||||
|
componet: build-env
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: milvus-build-env
|
||||||
|
image: registry.zilliz.com/milvus/milvus-build-env:v0.5.0-ubuntu18.04
|
||||||
|
env:
|
||||||
|
- name: POD_IP
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: status.podIP
|
||||||
|
command:
|
||||||
|
- cat
|
||||||
|
tty: true
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: "32Gi"
|
||||||
|
cpu: "8.0"
|
||||||
|
nvidia.com/gpu: 1
|
||||||
|
requests:
|
||||||
|
memory: "16Gi"
|
||||||
|
cpu: "4.0"
|
||||||
|
- name: milvus-mysql
|
||||||
|
image: mysql:5.6
|
||||||
|
env:
|
||||||
|
- name: MYSQL_ROOT_PASSWORD
|
||||||
|
value: 123456
|
||||||
|
ports:
|
||||||
|
- containerPort: 3306
|
||||||
|
name: mysql
|
||||||
22
ci/jenkins/pod/testEnvironment.yaml
Normal file
22
ci/jenkins/pod/testEnvironment.yaml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: milvus
|
||||||
|
componet: test-env
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: milvus-test-env
|
||||||
|
image: registry.zilliz.com/milvus/milvus-test-env:v0.1
|
||||||
|
command:
|
||||||
|
- cat
|
||||||
|
tty: true
|
||||||
|
volumeMounts:
|
||||||
|
- name: kubeconf
|
||||||
|
mountPath: /root/.kube/
|
||||||
|
readOnly: true
|
||||||
|
volumes:
|
||||||
|
- name: kubeconf
|
||||||
|
secret:
|
||||||
|
secretName: test-cluster-config
|
||||||
|
|
||||||
142
ci/jenkins/scripts/build.sh
Executable file
142
ci/jenkins/scripts/build.sh
Executable file
@ -0,0 +1,142 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SOURCE="${BASH_SOURCE[0]}"
|
||||||
|
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||||
|
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||||
|
SOURCE="$(readlink "$SOURCE")"
|
||||||
|
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||||
|
done
|
||||||
|
SCRIPTS_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||||
|
|
||||||
|
CMAKE_BUILD_DIR="${SCRIPTS_DIR}/../../../core/cmake_build"
|
||||||
|
BUILD_TYPE="Debug"
|
||||||
|
BUILD_UNITTEST="OFF"
|
||||||
|
INSTALL_PREFIX="/opt/milvus"
|
||||||
|
BUILD_COVERAGE="OFF"
|
||||||
|
DB_PATH="/opt/milvus"
|
||||||
|
PROFILING="OFF"
|
||||||
|
USE_JFROG_CACHE="OFF"
|
||||||
|
RUN_CPPLINT="OFF"
|
||||||
|
CUSTOMIZATION="OFF" # default use ori faiss
|
||||||
|
CUDA_COMPILER=/usr/local/cuda/bin/nvcc
|
||||||
|
|
||||||
|
CUSTOMIZED_FAISS_URL="${FAISS_URL:-NONE}"
|
||||||
|
wget -q --method HEAD ${CUSTOMIZED_FAISS_URL}
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
CUSTOMIZATION="ON"
|
||||||
|
else
|
||||||
|
CUSTOMIZATION="OFF"
|
||||||
|
fi
|
||||||
|
|
||||||
|
while getopts "o:d:t:ulcgjhx" arg
|
||||||
|
do
|
||||||
|
case $arg in
|
||||||
|
o)
|
||||||
|
INSTALL_PREFIX=$OPTARG
|
||||||
|
;;
|
||||||
|
d)
|
||||||
|
DB_PATH=$OPTARG
|
||||||
|
;;
|
||||||
|
t)
|
||||||
|
BUILD_TYPE=$OPTARG # BUILD_TYPE
|
||||||
|
;;
|
||||||
|
u)
|
||||||
|
echo "Build and run unittest cases" ;
|
||||||
|
BUILD_UNITTEST="ON";
|
||||||
|
;;
|
||||||
|
l)
|
||||||
|
RUN_CPPLINT="ON"
|
||||||
|
;;
|
||||||
|
c)
|
||||||
|
BUILD_COVERAGE="ON"
|
||||||
|
;;
|
||||||
|
g)
|
||||||
|
PROFILING="ON"
|
||||||
|
;;
|
||||||
|
j)
|
||||||
|
USE_JFROG_CACHE="ON"
|
||||||
|
;;
|
||||||
|
x)
|
||||||
|
CUSTOMIZATION="OFF" # force use ori faiss
|
||||||
|
;;
|
||||||
|
h) # help
|
||||||
|
echo "
|
||||||
|
|
||||||
|
parameter:
|
||||||
|
-o: install prefix(default: /opt/milvus)
|
||||||
|
-d: db data path(default: /opt/milvus)
|
||||||
|
-t: build type(default: Debug)
|
||||||
|
-u: building unit test options(default: OFF)
|
||||||
|
-l: run cpplint, clang-format and clang-tidy(default: OFF)
|
||||||
|
-c: code coverage(default: OFF)
|
||||||
|
-g: profiling(default: OFF)
|
||||||
|
-j: use jfrog cache build directory(default: OFF)
|
||||||
|
-h: help
|
||||||
|
|
||||||
|
usage:
|
||||||
|
./build.sh -p \${INSTALL_PREFIX} -t \${BUILD_TYPE} [-u] [-l] [-r] [-c] [-g] [-j] [-h]
|
||||||
|
"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
?)
|
||||||
|
echo "ERROR! unknown argument"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ ! -d ${CMAKE_BUILD_DIR} ]]; then
|
||||||
|
mkdir ${CMAKE_BUILD_DIR}
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd ${CMAKE_BUILD_DIR}
|
||||||
|
|
||||||
|
# remove make cache since build.sh -l use default variables
|
||||||
|
# force update the variables each time
|
||||||
|
make rebuild_cache
|
||||||
|
|
||||||
|
CMAKE_CMD="cmake \
|
||||||
|
-DBUILD_UNIT_TEST=${BUILD_UNITTEST} \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}
|
||||||
|
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
|
||||||
|
-DCMAKE_CUDA_COMPILER=${CUDA_COMPILER} \
|
||||||
|
-DBUILD_COVERAGE=${BUILD_COVERAGE} \
|
||||||
|
-DMILVUS_DB_PATH=${DB_PATH} \
|
||||||
|
-DMILVUS_ENABLE_PROFILING=${PROFILING} \
|
||||||
|
-DUSE_JFROG_CACHE=${USE_JFROG_CACHE} \
|
||||||
|
-DCUSTOMIZATION=${CUSTOMIZATION} \
|
||||||
|
-DFAISS_URL=${CUSTOMIZED_FAISS_URL} \
|
||||||
|
.."
|
||||||
|
echo ${CMAKE_CMD}
|
||||||
|
${CMAKE_CMD}
|
||||||
|
|
||||||
|
if [[ ${RUN_CPPLINT} == "ON" ]]; then
|
||||||
|
# cpplint check
|
||||||
|
make lint
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "ERROR! cpplint check failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "cpplint check passed!"
|
||||||
|
|
||||||
|
# clang-format check
|
||||||
|
make check-clang-format
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "ERROR! clang-format check failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "clang-format check passed!"
|
||||||
|
|
||||||
|
# # clang-tidy check
|
||||||
|
# make check-clang-tidy
|
||||||
|
# if [ $? -ne 0 ]; then
|
||||||
|
# echo "ERROR! clang-tidy check failed"
|
||||||
|
# rm -f CMakeCache.txt
|
||||||
|
# exit 1
|
||||||
|
# fi
|
||||||
|
# echo "clang-tidy check passed!"
|
||||||
|
else
|
||||||
|
# compile and build
|
||||||
|
make -j8 || exit 1
|
||||||
|
make install || exit 1
|
||||||
|
fi
|
||||||
138
ci/jenkins/scripts/coverage.sh
Executable file
138
ci/jenkins/scripts/coverage.sh
Executable file
@ -0,0 +1,138 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SOURCE="${BASH_SOURCE[0]}"
|
||||||
|
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||||
|
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||||
|
SOURCE="$(readlink "$SOURCE")"
|
||||||
|
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||||
|
done
|
||||||
|
SCRIPTS_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||||
|
|
||||||
|
INSTALL_PREFIX="/opt/milvus"
|
||||||
|
CMAKE_BUILD_DIR="${SCRIPTS_DIR}/../../../core/cmake_build"
|
||||||
|
MYSQL_USER_NAME=root
|
||||||
|
MYSQL_PASSWORD=123456
|
||||||
|
MYSQL_HOST='127.0.0.1'
|
||||||
|
MYSQL_PORT='3306'
|
||||||
|
|
||||||
|
while getopts "o:u:p:t:h" arg
|
||||||
|
do
|
||||||
|
case $arg in
|
||||||
|
o)
|
||||||
|
INSTALL_PREFIX=$OPTARG
|
||||||
|
;;
|
||||||
|
u)
|
||||||
|
MYSQL_USER_NAME=$OPTARG
|
||||||
|
;;
|
||||||
|
p)
|
||||||
|
MYSQL_PASSWORD=$OPTARG
|
||||||
|
;;
|
||||||
|
t)
|
||||||
|
MYSQL_HOST=$OPTARG
|
||||||
|
;;
|
||||||
|
h) # help
|
||||||
|
echo "
|
||||||
|
|
||||||
|
parameter:
|
||||||
|
-o: milvus install prefix(default: /opt/milvus)
|
||||||
|
-u: mysql account
|
||||||
|
-p: mysql password
|
||||||
|
-t: mysql host
|
||||||
|
-h: help
|
||||||
|
|
||||||
|
usage:
|
||||||
|
./coverage.sh -o \${INSTALL_PREFIX} -u \${MYSQL_USER} -p \${MYSQL_PASSWORD} -t \${MYSQL_HOST} [-h]
|
||||||
|
"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
?)
|
||||||
|
echo "ERROR! unknown argument"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${INSTALL_PREFIX}/lib
|
||||||
|
|
||||||
|
LCOV_CMD="lcov"
|
||||||
|
# LCOV_GEN_CMD="genhtml"
|
||||||
|
|
||||||
|
FILE_INFO_BASE="base.info"
|
||||||
|
FILE_INFO_MILVUS="server.info"
|
||||||
|
FILE_INFO_OUTPUT="output.info"
|
||||||
|
FILE_INFO_OUTPUT_NEW="output_new.info"
|
||||||
|
DIR_LCOV_OUTPUT="lcov_out"
|
||||||
|
|
||||||
|
DIR_GCNO="${CMAKE_BUILD_DIR}"
|
||||||
|
DIR_UNITTEST="${INSTALL_PREFIX}/unittest"
|
||||||
|
|
||||||
|
# delete old code coverage info files
|
||||||
|
rm -rf lcov_out
|
||||||
|
rm -f FILE_INFO_BASE FILE_INFO_MILVUS FILE_INFO_OUTPUT FILE_INFO_OUTPUT_NEW
|
||||||
|
|
||||||
|
MYSQL_DB_NAME=milvus_`date +%s%N`
|
||||||
|
|
||||||
|
function mysql_exc()
|
||||||
|
{
|
||||||
|
cmd=$1
|
||||||
|
mysql -h${MYSQL_HOST} -u${MYSQL_USER_NAME} -p${MYSQL_PASSWORD} -e "${cmd}"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "mysql $cmd run failed"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
mysql_exc "CREATE DATABASE IF NOT EXISTS ${MYSQL_DB_NAME};"
|
||||||
|
mysql_exc "GRANT ALL PRIVILEGES ON ${MYSQL_DB_NAME}.* TO '${MYSQL_USER_NAME}'@'%';"
|
||||||
|
mysql_exc "FLUSH PRIVILEGES;"
|
||||||
|
mysql_exc "USE ${MYSQL_DB_NAME};"
|
||||||
|
|
||||||
|
# get baseline
|
||||||
|
${LCOV_CMD} -c -i -d ${DIR_GCNO} -o "${FILE_INFO_BASE}"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "gen baseline coverage run failed"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for test in `ls ${DIR_UNITTEST}`; do
|
||||||
|
echo $test
|
||||||
|
case ${test} in
|
||||||
|
test_db)
|
||||||
|
# set run args for test_db
|
||||||
|
args="mysql://${MYSQL_USER_NAME}:${MYSQL_PASSWORD}@${MYSQL_HOST}:${MYSQL_PORT}/${MYSQL_DB_NAME}"
|
||||||
|
;;
|
||||||
|
*test_*)
|
||||||
|
args=""
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
# run unittest
|
||||||
|
${DIR_UNITTEST}/${test} "${args}"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo ${args}
|
||||||
|
echo ${DIR_UNITTEST}/${test} "run failed"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
mysql_exc "DROP DATABASE IF EXISTS ${MYSQL_DB_NAME};"
|
||||||
|
|
||||||
|
# gen code coverage
|
||||||
|
${LCOV_CMD} -d ${DIR_GCNO} -o "${FILE_INFO_MILVUS}" -c
|
||||||
|
# merge coverage
|
||||||
|
${LCOV_CMD} -a ${FILE_INFO_BASE} -a ${FILE_INFO_MILVUS} -o "${FILE_INFO_OUTPUT}"
|
||||||
|
|
||||||
|
# remove third party from tracefiles
|
||||||
|
${LCOV_CMD} -r "${FILE_INFO_OUTPUT}" -o "${FILE_INFO_OUTPUT_NEW}" \
|
||||||
|
"/usr/*" \
|
||||||
|
"*/boost/*" \
|
||||||
|
"*/cmake_build/*_ep-prefix/*" \
|
||||||
|
"*/src/index/cmake_build*" \
|
||||||
|
"*/src/index/thirdparty*" \
|
||||||
|
"*/src/grpc*" \
|
||||||
|
"*/src/metrics/MetricBase.h" \
|
||||||
|
"*/src/server/Server.cpp" \
|
||||||
|
"*/src/server/DBWrapper.cpp" \
|
||||||
|
"*/src/server/grpc_impl/GrpcServer.cpp" \
|
||||||
|
"*/src/utils/easylogging++.h" \
|
||||||
|
"*/src/utils/easylogging++.cc"
|
||||||
|
|
||||||
|
# gen html report
|
||||||
|
# ${LCOV_GEN_CMD} "${FILE_INFO_OUTPUT_NEW}" --output-directory ${DIR_LCOV_OUTPUT}/
|
||||||
25
docker/build_env/ubuntu16.04/Dockerfile
Normal file
25
docker/build_env/ubuntu16.04/Dockerfile
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
FROM nvidia/cuda:10.1-devel-ubuntu16.04
|
||||||
|
|
||||||
|
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends wget && \
|
||||||
|
wget -qO- "https://cmake.org/files/v3.14/cmake-3.14.3-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local && \
|
||||||
|
wget -P /tmp https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB && \
|
||||||
|
apt-key add /tmp/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB && \
|
||||||
|
sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list' && \
|
||||||
|
apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
git flex bison gfortran \
|
||||||
|
curl libtool automake libboost1.58-all-dev libssl-dev pkg-config libcurl4-openssl-dev \
|
||||||
|
clang-format-6.0 clang-tidy-6.0 \
|
||||||
|
lcov mysql-client libmysqlclient-dev intel-mkl-gnu-2019.4-243 intel-mkl-core-2019.4-243 && \
|
||||||
|
apt-get remove --purge -y && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN ln -s /usr/lib/x86_64-linux-gnu/libmysqlclient.so /usr/lib/x86_64-linux-gnu/libmysqlclient_r.so
|
||||||
|
|
||||||
|
RUN sh -c 'echo export LD_LIBRARY_PATH=/opt/intel/compilers_and_libraries_2019.4.243/linux/mkl/lib/intel64:\$LD_LIBRARY_PATH > /etc/profile.d/mkl.sh'
|
||||||
|
|
||||||
|
COPY docker-entrypoint.sh /app/docker-entrypoint.sh
|
||||||
|
ENTRYPOINT [ "/app/docker-entrypoint.sh" ]
|
||||||
|
CMD [ "start" ]
|
||||||
|
|
||||||
10
docker/build_env/ubuntu16.04/docker-entrypoint.sh
Executable file
10
docker/build_env/ubuntu16.04/docker-entrypoint.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$1" = 'start' ]; then
|
||||||
|
tail -f /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
|
|
||||||
25
docker/build_env/ubuntu18.04/Dockerfile
Normal file
25
docker/build_env/ubuntu18.04/Dockerfile
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
FROM nvidia/cuda:10.1-devel-ubuntu18.04
|
||||||
|
|
||||||
|
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends wget && \
|
||||||
|
wget -qO- "https://cmake.org/files/v3.14/cmake-3.14.3-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local && \
|
||||||
|
wget -P /tmp https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB && \
|
||||||
|
apt-key add /tmp/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB && \
|
||||||
|
sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list' && \
|
||||||
|
apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
git flex bison gfortran \
|
||||||
|
curl libtool automake libboost-all-dev libssl-dev pkg-config libcurl4-openssl-dev \
|
||||||
|
clang-format-6.0 clang-tidy-6.0 \
|
||||||
|
lcov mysql-client libmysqlclient-dev intel-mkl-gnu-2019.4-243 intel-mkl-core-2019.4-243 && \
|
||||||
|
apt-get remove --purge -y && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN ln -s /usr/lib/x86_64-linux-gnu/libmysqlclient.so /usr/lib/x86_64-linux-gnu/libmysqlclient_r.so
|
||||||
|
|
||||||
|
RUN sh -c 'echo export LD_LIBRARY_PATH=/opt/intel/compilers_and_libraries_2019.4.243/linux/mkl/lib/intel64:\$LD_LIBRARY_PATH > /etc/profile.d/mkl.sh'
|
||||||
|
|
||||||
|
COPY docker-entrypoint.sh /app/docker-entrypoint.sh
|
||||||
|
ENTRYPOINT [ "/app/docker-entrypoint.sh" ]
|
||||||
|
CMD [ "start" ]
|
||||||
|
|
||||||
10
docker/build_env/ubuntu18.04/docker-entrypoint.sh
Executable file
10
docker/build_env/ubuntu18.04/docker-entrypoint.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$1" = 'start' ]; then
|
||||||
|
tail -f /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
|
|
||||||
23
docker/deploy/ubuntu16.04/Dockerfile
Normal file
23
docker/deploy/ubuntu16.04/Dockerfile
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
FROM nvidia/cuda:10.1-devel-ubuntu16.04
|
||||||
|
|
||||||
|
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
|
||||||
|
|
||||||
|
RUN rm -rf /etc/apt/sources.list.d/nvidia-ml.list && rm -rf /etc/apt/sources.list.d/cuda.list
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
gfortran libsqlite3-dev libmysqlclient-dev libcurl4-openssl-dev python3 && \
|
||||||
|
apt-get remove --purge -y && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN ln -s /usr/lib/x86_64-linux-gnu/libmysqlclient.so /usr/lib/x86_64-linux-gnu/libmysqlclient_r.so
|
||||||
|
|
||||||
|
COPY ./docker-entrypoint.sh /opt
|
||||||
|
COPY ./milvus /opt/milvus
|
||||||
|
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/milvus/lib"
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/opt/docker-entrypoint.sh" ]
|
||||||
|
|
||||||
|
CMD [ "start" ]
|
||||||
|
|
||||||
|
EXPOSE 19530
|
||||||
|
|
||||||
10
docker/deploy/ubuntu16.04/docker-entrypoint.sh
Executable file
10
docker/deploy/ubuntu16.04/docker-entrypoint.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$1" == 'start' ]; then
|
||||||
|
cd /opt/milvus/scripts && ./start_server.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
|
|
||||||
23
docker/deploy/ubuntu18.04/Dockerfile
Normal file
23
docker/deploy/ubuntu18.04/Dockerfile
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
FROM nvidia/cuda:10.1-devel-ubuntu18.04
|
||||||
|
|
||||||
|
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
|
||||||
|
|
||||||
|
RUN rm -rf /etc/apt/sources.list.d/nvidia-ml.list && rm -rf /etc/apt/sources.list.d/cuda.list
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
gfortran libsqlite3-dev libmysqlclient-dev libcurl4-openssl-dev python3 && \
|
||||||
|
apt-get remove --purge -y && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN ln -s /usr/lib/x86_64-linux-gnu/libmysqlclient.so /usr/lib/x86_64-linux-gnu/libmysqlclient_r.so
|
||||||
|
|
||||||
|
COPY ./docker-entrypoint.sh /opt
|
||||||
|
COPY ./milvus /opt/milvus
|
||||||
|
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/milvus/lib"
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/opt/docker-entrypoint.sh" ]
|
||||||
|
|
||||||
|
CMD [ "start" ]
|
||||||
|
|
||||||
|
EXPOSE 19530
|
||||||
|
|
||||||
10
docker/deploy/ubuntu18.04/docker-entrypoint.sh
Executable file
10
docker/deploy/ubuntu18.04/docker-entrypoint.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$1" == 'start' ]; then
|
||||||
|
cd /opt/milvus/scripts && ./start_server.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
|
|
||||||
29
tests/milvus-java-test/README.md
Normal file
29
tests/milvus-java-test/README.md
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Requirements
|
||||||
|
|
||||||
|
- jdk-1.8
|
||||||
|
- testng
|
||||||
|
|
||||||
|
# How to use this Test Project
|
||||||
|
|
||||||
|
1. package and install
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mvn clean install
|
||||||
|
```
|
||||||
|
|
||||||
|
2. start or deploy your milvus server
|
||||||
|
3. run tests
|
||||||
|
|
||||||
|
```shell
|
||||||
|
java -cp \"target/MilvusSDkJavaTest-1.0-SNAPSHOT.jar:lib/*\" com.MainClass -h 127.0.0.1
|
||||||
|
```
|
||||||
|
|
||||||
|
4. get test report
|
||||||
|
|
||||||
|
```shell
|
||||||
|
firefox test-output/index.html
|
||||||
|
```
|
||||||
|
|
||||||
|
# Contribution getting started
|
||||||
|
|
||||||
|
Add test cases under testng framework
|
||||||
@ -99,12 +99,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.milvus</groupId>
|
<groupId>io.milvus</groupId>
|
||||||
<artifactId>milvus-sdk-java</artifactId>
|
<artifactId>milvus-sdk-java</artifactId>
|
||||||
<version>0.1.1-SNAPSHOT</version>
|
<version>0.2.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>io.grpc</groupId>-->
|
<!-- <groupId>io.grpc</groupId>-->
|
||||||
<!-- <artifactId>grpc-netty-shaded</artifactId>-->
|
<!-- <artifactId>grpc-netty-sher staded</artifactId>-->
|
||||||
<!-- <scope>runtime</scope>-->
|
<!-- <scope>runtime</scope>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
|
|||||||
@ -16,8 +16,8 @@ import java.util.List;
|
|||||||
public class MainClass {
|
public class MainClass {
|
||||||
private static String host = "127.0.0.1";
|
private static String host = "127.0.0.1";
|
||||||
private static String port = "19530";
|
private static String port = "19530";
|
||||||
public Integer index_file_size = 50;
|
private int index_file_size = 50;
|
||||||
public Integer dimension = 128;
|
public int dimension = 128;
|
||||||
|
|
||||||
public static void setHost(String host) {
|
public static void setHost(String host) {
|
||||||
MainClass.host = host;
|
MainClass.host = host;
|
||||||
@ -33,7 +33,7 @@ public class MainClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@DataProvider(name="ConnectInstance")
|
@DataProvider(name="ConnectInstance")
|
||||||
public Object[][] connectInstance(){
|
public Object[][] connectInstance() throws ConnectFailedException {
|
||||||
MilvusClient client = new MilvusGrpcClient();
|
MilvusClient client = new MilvusGrpcClient();
|
||||||
ConnectParam connectParam = new ConnectParam.Builder()
|
ConnectParam connectParam = new ConnectParam.Builder()
|
||||||
.withHost(host)
|
.withHost(host)
|
||||||
@ -45,7 +45,7 @@ public class MainClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@DataProvider(name="DisConnectInstance")
|
@DataProvider(name="DisConnectInstance")
|
||||||
public Object[][] disConnectInstance(){
|
public Object[][] disConnectInstance() throws ConnectFailedException {
|
||||||
// Generate connection instance
|
// Generate connection instance
|
||||||
MilvusClient client = new MilvusGrpcClient();
|
MilvusClient client = new MilvusGrpcClient();
|
||||||
ConnectParam connectParam = new ConnectParam.Builder()
|
ConnectParam connectParam = new ConnectParam.Builder()
|
||||||
@ -63,10 +63,10 @@ public class MainClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@DataProvider(name="Table")
|
@DataProvider(name="Table")
|
||||||
public Object[][] provideTable(){
|
public Object[][] provideTable() throws ConnectFailedException {
|
||||||
Object[][] tables = new Object[2][2];
|
Object[][] tables = new Object[2][2];
|
||||||
MetricType metricTypes[] = { MetricType.L2, MetricType.IP };
|
MetricType[] metricTypes = { MetricType.L2, MetricType.IP };
|
||||||
for (Integer i = 0; i < metricTypes.length; ++i) {
|
for (int i = 0; i < metricTypes.length; ++i) {
|
||||||
String tableName = metricTypes[i].toString()+"_"+RandomStringUtils.randomAlphabetic(10);
|
String tableName = metricTypes[i].toString()+"_"+RandomStringUtils.randomAlphabetic(10);
|
||||||
// Generate connection instance
|
// Generate connection instance
|
||||||
MilvusClient client = new MilvusGrpcClient();
|
MilvusClient client = new MilvusGrpcClient();
|
||||||
@ -79,8 +79,7 @@ public class MainClass {
|
|||||||
.withIndexFileSize(index_file_size)
|
.withIndexFileSize(index_file_size)
|
||||||
.withMetricType(metricTypes[i])
|
.withMetricType(metricTypes[i])
|
||||||
.build();
|
.build();
|
||||||
TableSchemaParam tableSchemaParam = new TableSchemaParam.Builder(tableSchema).build();
|
Response res = client.createTable(tableSchema);
|
||||||
Response res = client.createTable(tableSchemaParam);
|
|
||||||
if (!res.ok()) {
|
if (!res.ok()) {
|
||||||
System.out.println(res.getMessage());
|
System.out.println(res.getMessage());
|
||||||
throw new SkipException("Table created failed");
|
throw new SkipException("Table created failed");
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package com;
|
|||||||
import io.milvus.client.InsertParam;
|
import io.milvus.client.InsertParam;
|
||||||
import io.milvus.client.InsertResponse;
|
import io.milvus.client.InsertResponse;
|
||||||
import io.milvus.client.MilvusClient;
|
import io.milvus.client.MilvusClient;
|
||||||
import io.milvus.client.TableParam;
|
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@ -55,19 +54,18 @@ public class TestAddVectors {
|
|||||||
assert(res.getResponse().ok());
|
assert(res.getResponse().ok());
|
||||||
Thread.currentThread().sleep(1000);
|
Thread.currentThread().sleep(1000);
|
||||||
// Assert table row count
|
// Assert table row count
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
Assert.assertEquals(client.getTableRowCount(tableName).getTableRowCount(), nb);
|
||||||
Assert.assertEquals(client.getTableRowCount(tableParam).getTableRowCount(), nb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
// @Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_add_vectors_timeout(MilvusClient client, String tableName) throws InterruptedException {
|
// public void test_add_vectors_timeout(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
int nb = 200000;
|
// int nb = 200000;
|
||||||
List<List<Float>> vectors = gen_vectors(nb);
|
// List<List<Float>> vectors = gen_vectors(nb);
|
||||||
System.out.println(new Date());
|
// System.out.println(new Date());
|
||||||
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).withTimeout(1).build();
|
// InsertParam insertParam = new InsertParam.Builder(tableName, vectors).withTimeout(1).build();
|
||||||
InsertResponse res = client.insert(insertParam);
|
// InsertResponse res = client.insert(insertParam);
|
||||||
assert(!res.getResponse().ok());
|
// assert(!res.getResponse().ok());
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_add_vectors_big_data(MilvusClient client, String tableName) throws InterruptedException {
|
public void test_add_vectors_big_data(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
@ -91,10 +89,9 @@ public class TestAddVectors {
|
|||||||
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).withVectorIds(vectorIds).build();
|
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).withVectorIds(vectorIds).build();
|
||||||
InsertResponse res = client.insert(insertParam);
|
InsertResponse res = client.insert(insertParam);
|
||||||
assert(res.getResponse().ok());
|
assert(res.getResponse().ok());
|
||||||
Thread.currentThread().sleep(1000);
|
Thread.currentThread().sleep(2000);
|
||||||
// Assert table row count
|
// Assert table row count
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
Assert.assertEquals(client.getTableRowCount(tableName).getTableRowCount(), nb);
|
||||||
Assert.assertEquals(client.getTableRowCount(tableParam).getTableRowCount(), nb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: MS-628
|
// TODO: MS-628
|
||||||
@ -147,8 +144,7 @@ public class TestAddVectors {
|
|||||||
}
|
}
|
||||||
Thread.currentThread().sleep(1000);
|
Thread.currentThread().sleep(1000);
|
||||||
// Assert table row count
|
// Assert table row count
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
Assert.assertEquals(client.getTableRowCount(tableName).getTableRowCount(), nb * loops);
|
||||||
Assert.assertEquals(client.getTableRowCount(tableParam).getTableRowCount(), nb * loops);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,13 @@
|
|||||||
package com;
|
package com;
|
||||||
|
|
||||||
import io.milvus.client.ConnectParam;
|
import io.milvus.client.*;
|
||||||
import io.milvus.client.MilvusClient;
|
import org.testng.Assert;
|
||||||
import io.milvus.client.MilvusGrpcClient;
|
|
||||||
import io.milvus.client.Response;
|
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestConnect {
|
public class TestConnect {
|
||||||
@Test(dataProvider = "DefaultConnectArgs", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "DefaultConnectArgs", dataProviderClass = MainClass.class)
|
||||||
public void test_connect(String host, String port){
|
public void test_connect(String host, String port) throws ConnectFailedException {
|
||||||
System.out.println("Host: "+host+", Port: "+port);
|
System.out.println("Host: "+host+", Port: "+port);
|
||||||
MilvusClient client = new MilvusGrpcClient();
|
MilvusClient client = new MilvusGrpcClient();
|
||||||
ConnectParam connectParam = new ConnectParam.Builder()
|
ConnectParam connectParam = new ConnectParam.Builder()
|
||||||
@ -18,31 +16,42 @@ public class TestConnect {
|
|||||||
.build();
|
.build();
|
||||||
Response res = client.connect(connectParam);
|
Response res = client.connect(connectParam);
|
||||||
assert(res.ok());
|
assert(res.ok());
|
||||||
assert(client.connected());
|
assert(client.isConnected());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "DefaultConnectArgs", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "DefaultConnectArgs", dataProviderClass = MainClass.class)
|
||||||
public void test_connect_repeat(String host, String port){
|
public void test_connect_repeat(String host, String port) {
|
||||||
MilvusGrpcClient client = new MilvusGrpcClient();
|
MilvusGrpcClient client = new MilvusGrpcClient();
|
||||||
ConnectParam connectParam = new ConnectParam.Builder()
|
ConnectParam connectParam = new ConnectParam.Builder()
|
||||||
.withHost(host)
|
.withHost(host)
|
||||||
.withPort(port)
|
.withPort(port)
|
||||||
.build();
|
.build();
|
||||||
client.connect(connectParam);
|
Response res = null;
|
||||||
Response res = client.connect(connectParam);
|
try {
|
||||||
assert(!res.ok());
|
res = client.connect(connectParam);
|
||||||
assert(client.connected());
|
res = client.connect(connectParam);
|
||||||
|
} catch (ConnectFailedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
assert (res.ok());
|
||||||
|
assert(client.isConnected());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider="InvalidConnectArgs")
|
@Test(dataProvider="InvalidConnectArgs")
|
||||||
public void test_connect_invalid_connect_args(String ip, String port) throws InterruptedException {
|
public void test_connect_invalid_connect_args(String ip, String port) {
|
||||||
MilvusClient client = new MilvusGrpcClient();
|
MilvusClient client = new MilvusGrpcClient();
|
||||||
ConnectParam connectParam = new ConnectParam.Builder()
|
ConnectParam connectParam = new ConnectParam.Builder()
|
||||||
.withHost(ip)
|
.withHost(ip)
|
||||||
.withPort(port)
|
.withPort(port)
|
||||||
.build();
|
.build();
|
||||||
client.connect(connectParam);
|
Response res = null;
|
||||||
assert(!client.connected());
|
try {
|
||||||
|
res = client.connect(connectParam);
|
||||||
|
} catch (ConnectFailedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Assert.assertEquals(res, null);
|
||||||
|
assert(!client.isConnected());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: MS-615
|
// TODO: MS-615
|
||||||
@ -63,18 +72,18 @@ public class TestConnect {
|
|||||||
|
|
||||||
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
||||||
public void test_disconnect(MilvusClient client, String tableName){
|
public void test_disconnect(MilvusClient client, String tableName){
|
||||||
assert(!client.connected());
|
assert(!client.isConnected());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
||||||
public void test_disconnect_repeatably(MilvusClient client, String tableNam){
|
public void test_disconnect_repeatably(MilvusClient client, String tableName){
|
||||||
Response res = null;
|
Response res = null;
|
||||||
try {
|
try {
|
||||||
res = client.disconnect();
|
res = client.disconnect();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
assert(res.ok());
|
assert(!res.ok());
|
||||||
assert(!client.connected());
|
assert(!client.isConnected());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
package com;
|
package com;
|
||||||
|
|
||||||
import io.milvus.client.*;
|
|
||||||
import org.testng.Assert;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class TestDeleteVectors {
|
public class TestDeleteVectors {
|
||||||
@ -31,92 +27,90 @@ public class TestDeleteVectors {
|
|||||||
return c.getTime();
|
return c.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
// @Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_delete_vectors(MilvusClient client, String tableName) throws InterruptedException {
|
// public void test_delete_vectors(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
int nb = 10000;
|
// int nb = 10000;
|
||||||
List<List<Float>> vectors = gen_vectors(nb);
|
// List<List<Float>> vectors = gen_vectors(nb);
|
||||||
// Add vectors
|
// // Add vectors
|
||||||
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
// InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
||||||
InsertResponse res = client.insert(insertParam);
|
// InsertResponse res = client.insert(insertParam);
|
||||||
assert(res.getResponse().ok());
|
// assert(res.getResponse().ok());
|
||||||
Thread.sleep(1000);
|
// Thread.sleep(1000);
|
||||||
DateRange dateRange = new DateRange(getDeltaDate(-1), getDeltaDate(1));
|
// DateRange dateRange = new DateRange(getDeltaDate(-1), getDeltaDate(1));
|
||||||
DeleteByRangeParam param = new DeleteByRangeParam.Builder(dateRange, tableName).build();
|
// DeleteByRangeParam param = new DeleteByRangeParam.Builder(dateRange, tableName).build();
|
||||||
Response res_delete = client.deleteByRange(param);
|
// Response res_delete = client.deleteByRange(param);
|
||||||
assert(res_delete.ok());
|
// assert(res_delete.ok());
|
||||||
Thread.sleep(1000);
|
// Thread.sleep(1000);
|
||||||
// Assert table row count
|
// // Assert table row count
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
// Assert.assertEquals(client.getTableRowCount(tableParam).getTableRowCount(), 0);
|
||||||
Assert.assertEquals(client.getTableRowCount(tableParam).getTableRowCount(), 0);
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
// @Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_delete_vectors_table_not_existed(MilvusClient client, String tableName) throws InterruptedException {
|
// public void test_delete_vectors_table_not_existed(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
String tableNameNew = tableName + "_";
|
// String tableNameNew = tableName + "_";
|
||||||
DateRange dateRange = new DateRange(getDeltaDate(-1), getDeltaDate(1));
|
// DateRange dateRange = new DateRange(getDeltaDate(-1), getDeltaDate(1));
|
||||||
DeleteByRangeParam param = new DeleteByRangeParam.Builder(dateRange, tableNameNew).build();
|
// DeleteByRangeParam param = new DeleteByRangeParam.Builder(dateRange, tableNameNew).build();
|
||||||
Response res_delete = client.deleteByRange(param);
|
// Response res_delete = client.deleteByRange(param);
|
||||||
assert(!res_delete.ok());
|
// assert(!res_delete.ok());
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
// @Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
||||||
public void test_delete_vectors_without_connect(MilvusClient client, String tableName) throws InterruptedException {
|
// public void test_delete_vectors_without_connect(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
DateRange dateRange = new DateRange(getDeltaDate(-1), getDeltaDate(1));
|
// DateRange dateRange = new DateRange(getDeltaDate(-1), getDeltaDate(1));
|
||||||
DeleteByRangeParam param = new DeleteByRangeParam.Builder(dateRange, tableName).build();
|
// DeleteByRangeParam param = new DeleteByRangeParam.Builder(dateRange, tableName).build();
|
||||||
Response res_delete = client.deleteByRange(param);
|
// Response res_delete = client.deleteByRange(param);
|
||||||
assert(!res_delete.ok());
|
// assert(!res_delete.ok());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
// @Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
|
// public void test_delete_vectors_table_empty(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
|
// DateRange dateRange = new DateRange(getDeltaDate(-1), getDeltaDate(1));
|
||||||
|
// DeleteByRangeParam param = new DeleteByRangeParam.Builder(dateRange, tableName).build();
|
||||||
|
// Response res_delete = client.deleteByRange(param);
|
||||||
|
// assert(res_delete.ok());
|
||||||
|
// }
|
||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
// @Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_delete_vectors_table_empty(MilvusClient client, String tableName) throws InterruptedException {
|
// public void test_delete_vectors_invalid_date_range(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
DateRange dateRange = new DateRange(getDeltaDate(-1), getDeltaDate(1));
|
// int nb = 100;
|
||||||
DeleteByRangeParam param = new DeleteByRangeParam.Builder(dateRange, tableName).build();
|
// List<List<Float>> vectors = gen_vectors(nb);
|
||||||
Response res_delete = client.deleteByRange(param);
|
// // Add vectors
|
||||||
assert(res_delete.ok());
|
// InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
||||||
}
|
// InsertResponse res = client.insert(insertParam);
|
||||||
|
// assert(res.getResponse().ok());
|
||||||
|
// Thread.sleep(1000);
|
||||||
|
// DateRange dateRange = new DateRange(getDeltaDate(1), getDeltaDate(0));
|
||||||
|
// DeleteByRangeParam param = new DeleteByRangeParam.Builder(dateRange, tableName).build();
|
||||||
|
// Response res_delete = client.deleteByRange(param);
|
||||||
|
// assert(!res_delete.ok());
|
||||||
|
// }
|
||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
// @Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_delete_vectors_invalid_date_range(MilvusClient client, String tableName) throws InterruptedException {
|
// public void test_delete_vectors_invalid_date_range_1(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
int nb = 100;
|
// int nb = 100;
|
||||||
List<List<Float>> vectors = gen_vectors(nb);
|
// List<List<Float>> vectors = gen_vectors(nb);
|
||||||
// Add vectors
|
// InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
||||||
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
// InsertResponse res = client.insert(insertParam);
|
||||||
InsertResponse res = client.insert(insertParam);
|
// assert(res.getResponse().ok());
|
||||||
assert(res.getResponse().ok());
|
// DateRange dateRange = new DateRange(getDeltaDate(2), getDeltaDate(-1));
|
||||||
Thread.sleep(1000);
|
// DeleteByRangeParam param = new DeleteByRangeParam.Builder(dateRange, tableName).build();
|
||||||
DateRange dateRange = new DateRange(getDeltaDate(1), getDeltaDate(0));
|
// Response res_delete = client.deleteByRange(param);
|
||||||
DeleteByRangeParam param = new DeleteByRangeParam.Builder(dateRange, tableName).build();
|
// assert(!res_delete.ok());
|
||||||
Response res_delete = client.deleteByRange(param);
|
// }
|
||||||
assert(!res_delete.ok());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
// @Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_delete_vectors_invalid_date_range_1(MilvusClient client, String tableName) throws InterruptedException {
|
// public void test_delete_vectors_no_result(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
int nb = 100;
|
// int nb = 100;
|
||||||
List<List<Float>> vectors = gen_vectors(nb);
|
// List<List<Float>> vectors = gen_vectors(nb);
|
||||||
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
// InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
||||||
InsertResponse res = client.insert(insertParam);
|
// InsertResponse res = client.insert(insertParam);
|
||||||
assert(res.getResponse().ok());
|
// assert(res.getResponse().ok());
|
||||||
DateRange dateRange = new DateRange(getDeltaDate(2), getDeltaDate(-1));
|
// Thread.sleep(1000);
|
||||||
DeleteByRangeParam param = new DeleteByRangeParam.Builder(dateRange, tableName).build();
|
// DateRange dateRange = new DateRange(getDeltaDate(-3), getDeltaDate(-2));
|
||||||
Response res_delete = client.deleteByRange(param);
|
// DeleteByRangeParam param = new DeleteByRangeParam.Builder(dateRange, tableName).build();
|
||||||
assert(!res_delete.ok());
|
// Response res_delete = client.deleteByRange(param);
|
||||||
}
|
// assert(res_delete.ok());
|
||||||
|
// Assert.assertEquals(client.getTableRowCount(tableParam).getTableRowCount(), nb);
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
// }
|
||||||
public void test_delete_vectors_no_result(MilvusClient client, String tableName) throws InterruptedException {
|
|
||||||
int nb = 100;
|
|
||||||
List<List<Float>> vectors = gen_vectors(nb);
|
|
||||||
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
|
||||||
InsertResponse res = client.insert(insertParam);
|
|
||||||
assert(res.getResponse().ok());
|
|
||||||
Thread.sleep(1000);
|
|
||||||
DateRange dateRange = new DateRange(getDeltaDate(-3), getDeltaDate(-2));
|
|
||||||
DeleteByRangeParam param = new DeleteByRangeParam.Builder(dateRange, tableName).build();
|
|
||||||
Response res_delete = client.deleteByRange(param);
|
|
||||||
assert(res_delete.ok());
|
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
|
||||||
Assert.assertEquals(client.getTableRowCount(tableParam).getTableRowCount(), nb);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import io.milvus.client.*;
|
|||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@ -56,8 +55,7 @@ public class TestIndex {
|
|||||||
Response res_create = client.createIndex(createIndexParam);
|
Response res_create = client.createIndex(createIndexParam);
|
||||||
res_create = client.createIndex(createIndexParam);
|
res_create = client.createIndex(createIndexParam);
|
||||||
assert(res_create.ok());
|
assert(res_create.ok());
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
DescribeIndexResponse res = client.describeIndex(tableName);
|
||||||
DescribeIndexResponse res = client.describeIndex(tableParam);
|
|
||||||
assert(res.getResponse().ok());
|
assert(res.getResponse().ok());
|
||||||
Index index1 = res.getIndex().get();
|
Index index1 = res.getIndex().get();
|
||||||
Assert.assertEquals(index1.getNList(), n_list);
|
Assert.assertEquals(index1.getNList(), n_list);
|
||||||
@ -76,29 +74,27 @@ public class TestIndex {
|
|||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
Response res_create = client.createIndex(createIndexParam);
|
Response res_create = client.createIndex(createIndexParam);
|
||||||
assert(res_create.ok());
|
assert(res_create.ok());
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
DescribeIndexResponse res = client.describeIndex(tableName);
|
||||||
DescribeIndexResponse res = client.describeIndex(tableParam);
|
|
||||||
assert(res.getResponse().ok());
|
assert(res.getResponse().ok());
|
||||||
Index index1 = res.getIndex().get();
|
Index index1 = res.getIndex().get();
|
||||||
Assert.assertEquals(index1.getIndexType(), indexType);
|
Assert.assertEquals(index1.getIndexType(), indexType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
// public void test_create_index_FLAT_timeout(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
public void test_create_index_FLAT_timeout(MilvusClient client, String tableName) throws InterruptedException {
|
// int nb = 500000;
|
||||||
int nb = 500000;
|
// IndexType indexType = IndexType.IVF_SQ8;
|
||||||
IndexType indexType = IndexType.IVF_SQ8;
|
// List<List<Float>> vectors = gen_vectors(nb);
|
||||||
List<List<Float>> vectors = gen_vectors(nb);
|
// InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
||||||
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
// client.insert(insertParam);
|
||||||
client.insert(insertParam);
|
// Index index = new Index.Builder().withIndexType(indexType)
|
||||||
Index index = new Index.Builder().withIndexType(indexType)
|
// .withNList(n_list)
|
||||||
.withNList(n_list)
|
// .build();
|
||||||
.build();
|
// System.out.println(new Date());
|
||||||
System.out.println(new Date());
|
// CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).withTimeout(1).build();
|
||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).withTimeout(1).build();
|
// Response res_create = client.createIndex(createIndexParam);
|
||||||
Response res_create = client.createIndex(createIndexParam);
|
// assert(!res_create.ok());
|
||||||
assert(!res_create.ok());
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_create_index_IVFLAT(MilvusClient client, String tableName) throws InterruptedException {
|
public void test_create_index_IVFLAT(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
@ -112,8 +108,7 @@ public class TestIndex {
|
|||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
Response res_create = client.createIndex(createIndexParam);
|
Response res_create = client.createIndex(createIndexParam);
|
||||||
assert(res_create.ok());
|
assert(res_create.ok());
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
DescribeIndexResponse res = client.describeIndex(tableName);
|
||||||
DescribeIndexResponse res = client.describeIndex(tableParam);
|
|
||||||
assert(res.getResponse().ok());
|
assert(res.getResponse().ok());
|
||||||
Index index1 = res.getIndex().get();
|
Index index1 = res.getIndex().get();
|
||||||
Assert.assertEquals(index1.getIndexType(), indexType);
|
Assert.assertEquals(index1.getIndexType(), indexType);
|
||||||
@ -131,8 +126,7 @@ public class TestIndex {
|
|||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
Response res_create = client.createIndex(createIndexParam);
|
Response res_create = client.createIndex(createIndexParam);
|
||||||
assert(res_create.ok());
|
assert(res_create.ok());
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
DescribeIndexResponse res = client.describeIndex(tableName);
|
||||||
DescribeIndexResponse res = client.describeIndex(tableParam);
|
|
||||||
assert(res.getResponse().ok());
|
assert(res.getResponse().ok());
|
||||||
Index index1 = res.getIndex().get();
|
Index index1 = res.getIndex().get();
|
||||||
Assert.assertEquals(index1.getIndexType(), indexType);
|
Assert.assertEquals(index1.getIndexType(), indexType);
|
||||||
@ -140,7 +134,7 @@ public class TestIndex {
|
|||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_create_index_IVFSQ8H(MilvusClient client, String tableName) throws InterruptedException {
|
public void test_create_index_IVFSQ8H(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
IndexType indexType = IndexType.IVF_SQ8_H;
|
IndexType indexType = IndexType.IVF_SQ8H;
|
||||||
List<List<Float>> vectors = gen_vectors(nb);
|
List<List<Float>> vectors = gen_vectors(nb);
|
||||||
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
||||||
client.insert(insertParam);
|
client.insert(insertParam);
|
||||||
@ -150,8 +144,7 @@ public class TestIndex {
|
|||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
Response res_create = client.createIndex(createIndexParam);
|
Response res_create = client.createIndex(createIndexParam);
|
||||||
assert(res_create.ok());
|
assert(res_create.ok());
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
DescribeIndexResponse res = client.describeIndex(tableName);
|
||||||
DescribeIndexResponse res = client.describeIndex(tableParam);
|
|
||||||
assert(res.getResponse().ok());
|
assert(res.getResponse().ok());
|
||||||
Index index1 = res.getIndex().get();
|
Index index1 = res.getIndex().get();
|
||||||
Assert.assertEquals(index1.getIndexType(), indexType);
|
Assert.assertEquals(index1.getIndexType(), indexType);
|
||||||
@ -213,8 +206,7 @@ public class TestIndex {
|
|||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
Response res_create = client.createIndex(createIndexParam);
|
Response res_create = client.createIndex(createIndexParam);
|
||||||
assert(res_create.ok());
|
assert(res_create.ok());
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
DescribeIndexResponse res = client.describeIndex(tableName);
|
||||||
DescribeIndexResponse res = client.describeIndex(tableParam);
|
|
||||||
assert(res.getResponse().ok());
|
assert(res.getResponse().ok());
|
||||||
Index index1 = res.getIndex().get();
|
Index index1 = res.getIndex().get();
|
||||||
Assert.assertEquals(index1.getNList(), n_list);
|
Assert.assertEquals(index1.getNList(), n_list);
|
||||||
@ -232,7 +224,6 @@ public class TestIndex {
|
|||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
Response res_create = client.createIndex(createIndexParam);
|
Response res_create = client.createIndex(createIndexParam);
|
||||||
assert(res_create.ok());
|
assert(res_create.ok());
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
|
||||||
// Create another index
|
// Create another index
|
||||||
IndexType indexTypeNew = IndexType.IVFLAT;
|
IndexType indexTypeNew = IndexType.IVFLAT;
|
||||||
int n_list_new = n_list + 1;
|
int n_list_new = n_list + 1;
|
||||||
@ -242,7 +233,7 @@ public class TestIndex {
|
|||||||
CreateIndexParam createIndexParamNew = new CreateIndexParam.Builder(tableName).withIndex(index_new).build();
|
CreateIndexParam createIndexParamNew = new CreateIndexParam.Builder(tableName).withIndex(index_new).build();
|
||||||
Response res_create_new = client.createIndex(createIndexParamNew);
|
Response res_create_new = client.createIndex(createIndexParamNew);
|
||||||
assert(res_create_new.ok());
|
assert(res_create_new.ok());
|
||||||
DescribeIndexResponse res = client.describeIndex(tableParam);
|
DescribeIndexResponse res = client.describeIndex(tableName);
|
||||||
assert(res_create.ok());
|
assert(res_create.ok());
|
||||||
Index index1 = res.getIndex().get();
|
Index index1 = res.getIndex().get();
|
||||||
Assert.assertEquals(index1.getNList(), n_list_new);
|
Assert.assertEquals(index1.getNList(), n_list_new);
|
||||||
@ -252,15 +243,13 @@ public class TestIndex {
|
|||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_describe_index_table_not_existed(MilvusClient client, String tableName) throws InterruptedException {
|
public void test_describe_index_table_not_existed(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
String tableNameNew = tableName + "_";
|
String tableNameNew = tableName + "_";
|
||||||
TableParam tableParam = new TableParam.Builder(tableNameNew).build();
|
DescribeIndexResponse res = client.describeIndex(tableNameNew);
|
||||||
DescribeIndexResponse res = client.describeIndex(tableParam);
|
|
||||||
assert(!res.getResponse().ok());
|
assert(!res.getResponse().ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
||||||
public void test_describe_index_without_connect(MilvusClient client, String tableName) throws InterruptedException {
|
public void test_describe_index_without_connect(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
DescribeIndexResponse res = client.describeIndex(tableName);
|
||||||
DescribeIndexResponse res = client.describeIndex(tableParam);
|
|
||||||
assert(!res.getResponse().ok());
|
assert(!res.getResponse().ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,10 +264,9 @@ public class TestIndex {
|
|||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
Response res_create = client.createIndex(createIndexParam);
|
Response res_create = client.createIndex(createIndexParam);
|
||||||
assert(res_create.ok());
|
assert(res_create.ok());
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
Response res_drop = client.dropIndex(tableName);
|
||||||
Response res_drop = client.dropIndex(tableParam);
|
|
||||||
assert(res_drop.ok());
|
assert(res_drop.ok());
|
||||||
DescribeIndexResponse res = client.describeIndex(tableParam);
|
DescribeIndexResponse res = client.describeIndex(tableName);
|
||||||
assert(res.getResponse().ok());
|
assert(res.getResponse().ok());
|
||||||
Index index1 = res.getIndex().get();
|
Index index1 = res.getIndex().get();
|
||||||
Assert.assertEquals(index1.getNList(), default_n_list);
|
Assert.assertEquals(index1.getNList(), default_n_list);
|
||||||
@ -296,11 +284,10 @@ public class TestIndex {
|
|||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
Response res_create = client.createIndex(createIndexParam);
|
Response res_create = client.createIndex(createIndexParam);
|
||||||
assert(res_create.ok());
|
assert(res_create.ok());
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
Response res_drop = client.dropIndex(tableName);
|
||||||
Response res_drop = client.dropIndex(tableParam);
|
res_drop = client.dropIndex(tableName);
|
||||||
res_drop = client.dropIndex(tableParam);
|
|
||||||
assert(res_drop.ok());
|
assert(res_drop.ok());
|
||||||
DescribeIndexResponse res = client.describeIndex(tableParam);
|
DescribeIndexResponse res = client.describeIndex(tableName);
|
||||||
assert(res.getResponse().ok());
|
assert(res.getResponse().ok());
|
||||||
Index index1 = res.getIndex().get();
|
Index index1 = res.getIndex().get();
|
||||||
Assert.assertEquals(index1.getNList(), default_n_list);
|
Assert.assertEquals(index1.getNList(), default_n_list);
|
||||||
@ -310,15 +297,13 @@ public class TestIndex {
|
|||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_drop_index_table_not_existed(MilvusClient client, String tableName) throws InterruptedException {
|
public void test_drop_index_table_not_existed(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
String tableNameNew = tableName + "_";
|
String tableNameNew = tableName + "_";
|
||||||
TableParam tableParam = new TableParam.Builder(tableNameNew).build();
|
Response res_drop = client.dropIndex(tableNameNew);
|
||||||
Response res_drop = client.dropIndex(tableParam);
|
|
||||||
assert(!res_drop.ok());
|
assert(!res_drop.ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
||||||
public void test_drop_index_without_connect(MilvusClient client, String tableName) throws InterruptedException {
|
public void test_drop_index_without_connect(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
Response res_drop = client.dropIndex(tableName);
|
||||||
Response res_drop = client.dropIndex(tableParam);
|
|
||||||
assert(!res_drop.ok());
|
assert(!res_drop.ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,10 +312,9 @@ public class TestIndex {
|
|||||||
List<List<Float>> vectors = gen_vectors(nb);
|
List<List<Float>> vectors = gen_vectors(nb);
|
||||||
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
||||||
client.insert(insertParam);
|
client.insert(insertParam);
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
Response res_drop = client.dropIndex(tableName);
|
||||||
Response res_drop = client.dropIndex(tableParam);
|
|
||||||
assert(res_drop.ok());
|
assert(res_drop.ok());
|
||||||
DescribeIndexResponse res = client.describeIndex(tableParam);
|
DescribeIndexResponse res = client.describeIndex(tableName);
|
||||||
assert(res.getResponse().ok());
|
assert(res.getResponse().ok());
|
||||||
Index index1 = res.getIndex().get();
|
Index index1 = res.getIndex().get();
|
||||||
Assert.assertEquals(index1.getNList(), default_n_list);
|
Assert.assertEquals(index1.getNList(), default_n_list);
|
||||||
|
|||||||
@ -71,7 +71,7 @@ public class TestMix {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "DefaultConnectArgs", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "DefaultConnectArgs", dataProviderClass = MainClass.class)
|
||||||
public void test_connect_threads(String host, String port) throws InterruptedException {
|
public void test_connect_threads(String host, String port) throws ConnectFailedException {
|
||||||
int thread_num = 100;
|
int thread_num = 100;
|
||||||
ForkJoinPool executor = new ForkJoinPool();
|
ForkJoinPool executor = new ForkJoinPool();
|
||||||
for (int i = 0; i < thread_num; i++) {
|
for (int i = 0; i < thread_num; i++) {
|
||||||
@ -82,8 +82,12 @@ public class TestMix {
|
|||||||
.withHost(host)
|
.withHost(host)
|
||||||
.withPort(port)
|
.withPort(port)
|
||||||
.build();
|
.build();
|
||||||
client.connect(connectParam);
|
try {
|
||||||
assert(client.connected());
|
client.connect(connectParam);
|
||||||
|
} catch (ConnectFailedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
assert(client.isConnected());
|
||||||
try {
|
try {
|
||||||
client.disconnect();
|
client.disconnect();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
@ -112,8 +116,7 @@ public class TestMix {
|
|||||||
executor.shutdown();
|
executor.shutdown();
|
||||||
|
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
GetTableRowCountResponse getTableRowCountResponse = client.getTableRowCount(tableName);
|
||||||
GetTableRowCountResponse getTableRowCountResponse = client.getTableRowCount(tableParam);
|
|
||||||
Assert.assertEquals(getTableRowCountResponse.getTableRowCount(), thread_num * nb);
|
Assert.assertEquals(getTableRowCountResponse.getTableRowCount(), thread_num * nb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,8 +141,7 @@ public class TestMix {
|
|||||||
executor.awaitQuiescence(300, TimeUnit.SECONDS);
|
executor.awaitQuiescence(300, TimeUnit.SECONDS);
|
||||||
executor.shutdown();
|
executor.shutdown();
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
GetTableRowCountResponse getTableRowCountResponse = client.getTableRowCount(tableName);
|
||||||
GetTableRowCountResponse getTableRowCountResponse = client.getTableRowCount(tableParam);
|
|
||||||
Assert.assertEquals(getTableRowCountResponse.getTableRowCount(), thread_num * nb);
|
Assert.assertEquals(getTableRowCountResponse.getTableRowCount(), thread_num * nb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,13 +178,12 @@ public class TestMix {
|
|||||||
executor.awaitQuiescence(300, TimeUnit.SECONDS);
|
executor.awaitQuiescence(300, TimeUnit.SECONDS);
|
||||||
executor.shutdown();
|
executor.shutdown();
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
GetTableRowCountResponse getTableRowCountResponse = client.getTableRowCount(tableName);
|
||||||
GetTableRowCountResponse getTableRowCountResponse = client.getTableRowCount(tableParam);
|
|
||||||
Assert.assertEquals(getTableRowCountResponse.getTableRowCount(), thread_num * nb);
|
Assert.assertEquals(getTableRowCountResponse.getTableRowCount(), thread_num * nb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "DefaultConnectArgs", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "DefaultConnectArgs", dataProviderClass = MainClass.class)
|
||||||
public void test_create_insert_delete_threads(String host, String port) throws InterruptedException {
|
public void test_create_insert_delete_threads(String host, String port) {
|
||||||
int thread_num = 100;
|
int thread_num = 100;
|
||||||
List<List<Float>> vectors = gen_vectors(nb,false);
|
List<List<Float>> vectors = gen_vectors(nb,false);
|
||||||
ForkJoinPool executor = new ForkJoinPool();
|
ForkJoinPool executor = new ForkJoinPool();
|
||||||
@ -194,18 +195,21 @@ public class TestMix {
|
|||||||
.withHost(host)
|
.withHost(host)
|
||||||
.withPort(port)
|
.withPort(port)
|
||||||
.build();
|
.build();
|
||||||
client.connect(connectParam);
|
try {
|
||||||
|
client.connect(connectParam);
|
||||||
|
} catch (ConnectFailedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
assert(client.isConnected());
|
||||||
String tableName = RandomStringUtils.randomAlphabetic(10);
|
String tableName = RandomStringUtils.randomAlphabetic(10);
|
||||||
TableSchema tableSchema = new TableSchema.Builder(tableName, dimension)
|
TableSchema tableSchema = new TableSchema.Builder(tableName, dimension)
|
||||||
.withIndexFileSize(index_file_size)
|
.withIndexFileSize(index_file_size)
|
||||||
.withMetricType(MetricType.IP)
|
.withMetricType(MetricType.IP)
|
||||||
.build();
|
.build();
|
||||||
TableSchemaParam tableSchemaParam = new TableSchemaParam.Builder(tableSchema).build();
|
client.createTable(tableSchema);
|
||||||
client.createTable(tableSchemaParam);
|
|
||||||
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
||||||
client.insert(insertParam);
|
client.insert(insertParam);
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
Response response = client.dropTable(tableName);
|
||||||
Response response = client.dropTable(tableParam);
|
|
||||||
Assert.assertTrue(response.ok());
|
Assert.assertTrue(response.ok());
|
||||||
try {
|
try {
|
||||||
client.disconnect();
|
client.disconnect();
|
||||||
|
|||||||
@ -1,14 +1,11 @@
|
|||||||
package com;
|
package com;
|
||||||
|
|
||||||
import io.milvus.client.ConnectParam;
|
import io.milvus.client.*;
|
||||||
import io.milvus.client.MilvusClient;
|
|
||||||
import io.milvus.client.MilvusGrpcClient;
|
|
||||||
import io.milvus.client.Response;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestPing {
|
public class TestPing {
|
||||||
@Test(dataProvider = "DefaultConnectArgs", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "DefaultConnectArgs", dataProviderClass = MainClass.class)
|
||||||
public void test_server_status(String host, String port){
|
public void test_server_status(String host, String port) throws ConnectFailedException {
|
||||||
System.out.println("Host: "+host+", Port: "+port);
|
System.out.println("Host: "+host+", Port: "+port);
|
||||||
MilvusClient client = new MilvusGrpcClient();
|
MilvusClient client = new MilvusGrpcClient();
|
||||||
ConnectParam connectParam = new ConnectParam.Builder()
|
ConnectParam connectParam = new ConnectParam.Builder()
|
||||||
@ -16,13 +13,13 @@ public class TestPing {
|
|||||||
.withPort(port)
|
.withPort(port)
|
||||||
.build();
|
.build();
|
||||||
client.connect(connectParam);
|
client.connect(connectParam);
|
||||||
Response res = client.serverStatus();
|
Response res = client.getServerStatus();
|
||||||
assert (res.ok());
|
assert (res.ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
||||||
public void test_server_status_without_connected(MilvusGrpcClient client, String tableName){
|
public void test_server_status_without_connected(MilvusGrpcClient client, String tableName){
|
||||||
Response res = client.serverStatus();
|
Response res = client.getServerStatus();
|
||||||
assert (!res.ok());
|
assert (!res.ok());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,7 +77,6 @@ public class TestSearchVectors {
|
|||||||
.build();
|
.build();
|
||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
client.createIndex(createIndexParam);
|
client.createIndex(createIndexParam);
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
|
||||||
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).build();
|
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).build();
|
||||||
List<List<SearchResponse.QueryResult>> res_search = client.search(searchParam).getQueryResultsList();
|
List<List<SearchResponse.QueryResult>> res_search = client.search(searchParam).getQueryResultsList();
|
||||||
Assert.assertEquals(res_search.size(), nq);
|
Assert.assertEquals(res_search.size(), nq);
|
||||||
@ -101,7 +100,6 @@ public class TestSearchVectors {
|
|||||||
.build();
|
.build();
|
||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
client.createIndex(createIndexParam);
|
client.createIndex(createIndexParam);
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
|
||||||
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).build();
|
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).build();
|
||||||
List<List<SearchResponse.QueryResult>> res_search = client.search(searchParam).getQueryResultsList();
|
List<List<SearchResponse.QueryResult>> res_search = client.search(searchParam).getQueryResultsList();
|
||||||
Assert.assertEquals(res_search.get(0).get(0).getVectorId(), 0L);
|
Assert.assertEquals(res_search.get(0).get(0).getVectorId(), 0L);
|
||||||
@ -115,7 +113,7 @@ public class TestSearchVectors {
|
|||||||
List<List<Float>> queryVectors = vectors.subList(0,nq);
|
List<List<Float>> queryVectors = vectors.subList(0,nq);
|
||||||
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
||||||
client.insert(insertParam);
|
client.insert(insertParam);
|
||||||
Thread.sleep(1000);
|
Thread.sleep(2000);
|
||||||
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).build();
|
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).build();
|
||||||
List<List<SearchResponse.QueryResult>> res_search = client.search(searchParam).getQueryResultsList();
|
List<List<SearchResponse.QueryResult>> res_search = client.search(searchParam).getQueryResultsList();
|
||||||
Assert.assertEquals(res_search.size(), nq);
|
Assert.assertEquals(res_search.size(), nq);
|
||||||
@ -135,7 +133,6 @@ public class TestSearchVectors {
|
|||||||
.build();
|
.build();
|
||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
client.createIndex(createIndexParam);
|
client.createIndex(createIndexParam);
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
|
||||||
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).build();
|
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).build();
|
||||||
List<List<SearchResponse.QueryResult>> res_search = client.search(searchParam).getQueryResultsList();
|
List<List<SearchResponse.QueryResult>> res_search = client.search(searchParam).getQueryResultsList();
|
||||||
double distance = res_search.get(0).get(0).getDistance();
|
double distance = res_search.get(0).get(0).getDistance();
|
||||||
@ -159,7 +156,6 @@ public class TestSearchVectors {
|
|||||||
.build();
|
.build();
|
||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
client.createIndex(createIndexParam);
|
client.createIndex(createIndexParam);
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
|
||||||
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).build();
|
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).build();
|
||||||
List<List<SearchResponse.QueryResult>> res_search = client.search(searchParam).getQueryResultsList();
|
List<List<SearchResponse.QueryResult>> res_search = client.search(searchParam).getQueryResultsList();
|
||||||
Assert.assertEquals(res_search.size(), nq);
|
Assert.assertEquals(res_search.size(), nq);
|
||||||
@ -195,7 +191,6 @@ public class TestSearchVectors {
|
|||||||
.build();
|
.build();
|
||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
client.createIndex(createIndexParam);
|
client.createIndex(createIndexParam);
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
|
||||||
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).build();
|
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).build();
|
||||||
List<List<Double>> res_search = client.search(searchParam).getResultDistancesList();
|
List<List<Double>> res_search = client.search(searchParam).getResultDistancesList();
|
||||||
for (int i = 0; i < nq; i++) {
|
for (int i = 0; i < nq; i++) {
|
||||||
@ -222,7 +217,6 @@ public class TestSearchVectors {
|
|||||||
.build();
|
.build();
|
||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
client.createIndex(createIndexParam);
|
client.createIndex(createIndexParam);
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
|
||||||
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).build();
|
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).build();
|
||||||
List<List<SearchResponse.QueryResult>> res_search = client.search(searchParam).getQueryResultsList();
|
List<List<SearchResponse.QueryResult>> res_search = client.search(searchParam).getQueryResultsList();
|
||||||
Assert.assertEquals(res_search.size(), nq);
|
Assert.assertEquals(res_search.size(), nq);
|
||||||
@ -244,22 +238,23 @@ public class TestSearchVectors {
|
|||||||
Assert.assertEquals(res_search.get(0).size(), top_k);
|
Assert.assertEquals(res_search.get(0).size(), top_k);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
// @Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_search_FLAT_timeout(MilvusClient client, String tableName) throws InterruptedException {
|
// public void test_search_FLAT_timeout(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
IndexType indexType = IndexType.FLAT;
|
// IndexType indexType = IndexType.FLAT;
|
||||||
int nb = 100000;
|
// int nb = 100000;
|
||||||
int nq = 1000;
|
// int nq = 1000;
|
||||||
int top_k = 2048;
|
// int top_k = 2048;
|
||||||
List<List<Float>> vectors = gen_vectors(nb, false);
|
// List<List<Float>> vectors = gen_vectors(nb, false);
|
||||||
List<List<Float>> queryVectors = vectors.subList(0,nq);
|
// List<List<Float>> vectors = gen_vectors(nb, false);
|
||||||
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
// List<List<Float>> queryVectors = vectors.subList(0,nq);
|
||||||
client.insert(insertParam);
|
// InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
|
||||||
Thread.sleep(1000);
|
// client.insert(insertParam);
|
||||||
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).withTimeout(1).build();
|
// Thread.sleep(1000);
|
||||||
System.out.println(new Date());
|
// SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).withTimeout(1).build();
|
||||||
SearchResponse res_search = client.search(searchParam);
|
// System.out.println(new Date());
|
||||||
assert (!res_search.getResponse().ok());
|
// SearchResponse res_search = client.search(searchParam);
|
||||||
}
|
// assert (!res_search.getResponse().ok());
|
||||||
|
// }
|
||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_search_FLAT_big_data_size(MilvusClient client, String tableName) throws InterruptedException {
|
public void test_search_FLAT_big_data_size(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
@ -315,7 +310,6 @@ public class TestSearchVectors {
|
|||||||
.build();
|
.build();
|
||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
client.createIndex(createIndexParam);
|
client.createIndex(createIndexParam);
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
|
||||||
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe_new).withTopK(top_k).build();
|
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe_new).withTopK(top_k).build();
|
||||||
SearchResponse res_search = client.search(searchParam);
|
SearchResponse res_search = client.search(searchParam);
|
||||||
assert (!res_search.getResponse().ok());
|
assert (!res_search.getResponse().ok());
|
||||||
@ -335,7 +329,6 @@ public class TestSearchVectors {
|
|||||||
.build();
|
.build();
|
||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
client.createIndex(createIndexParam);
|
client.createIndex(createIndexParam);
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
|
||||||
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k_new).build();
|
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k_new).build();
|
||||||
SearchResponse res_search = client.search(searchParam);
|
SearchResponse res_search = client.search(searchParam);
|
||||||
assert (!res_search.getResponse().ok());
|
assert (!res_search.getResponse().ok());
|
||||||
@ -374,7 +367,6 @@ public class TestSearchVectors {
|
|||||||
.build();
|
.build();
|
||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
client.createIndex(createIndexParam);
|
client.createIndex(createIndexParam);
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
|
||||||
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).withDateRanges(dateRange).build();
|
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).withDateRanges(dateRange).build();
|
||||||
SearchResponse res_search = client.search(searchParam);
|
SearchResponse res_search = client.search(searchParam);
|
||||||
assert (res_search.getResponse().ok());
|
assert (res_search.getResponse().ok());
|
||||||
@ -416,7 +408,6 @@ public class TestSearchVectors {
|
|||||||
.build();
|
.build();
|
||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
client.createIndex(createIndexParam);
|
client.createIndex(createIndexParam);
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
|
||||||
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).withDateRanges(dateRange).build();
|
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).withDateRanges(dateRange).build();
|
||||||
SearchResponse res_search = client.search(searchParam);
|
SearchResponse res_search = client.search(searchParam);
|
||||||
assert (res_search.getResponse().ok());
|
assert (res_search.getResponse().ok());
|
||||||
@ -456,7 +447,6 @@ public class TestSearchVectors {
|
|||||||
.build();
|
.build();
|
||||||
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
||||||
client.createIndex(createIndexParam);
|
client.createIndex(createIndexParam);
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
|
||||||
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).withDateRanges(dateRange).build();
|
SearchParam searchParam = new SearchParam.Builder(tableName, queryVectors).withNProbe(n_probe).withTopK(top_k).withDateRanges(dateRange).build();
|
||||||
SearchResponse res_search = client.search(searchParam);
|
SearchResponse res_search = client.search(searchParam);
|
||||||
assert (!res_search.getResponse().ok());
|
assert (!res_search.getResponse().ok());
|
||||||
|
|||||||
@ -17,8 +17,7 @@ public class TestTable {
|
|||||||
.withIndexFileSize(index_file_size)
|
.withIndexFileSize(index_file_size)
|
||||||
.withMetricType(MetricType.L2)
|
.withMetricType(MetricType.L2)
|
||||||
.build();
|
.build();
|
||||||
TableSchemaParam tableSchemaParam = new TableSchemaParam.Builder(tableSchema).build();
|
Response res = client.createTable(tableSchema);
|
||||||
Response res = client.createTable(tableSchemaParam);
|
|
||||||
assert(res.ok());
|
assert(res.ok());
|
||||||
Assert.assertEquals(res.ok(), true);
|
Assert.assertEquals(res.ok(), true);
|
||||||
}
|
}
|
||||||
@ -29,8 +28,7 @@ public class TestTable {
|
|||||||
.withIndexFileSize(index_file_size)
|
.withIndexFileSize(index_file_size)
|
||||||
.withMetricType(MetricType.L2)
|
.withMetricType(MetricType.L2)
|
||||||
.build();
|
.build();
|
||||||
TableSchemaParam tableSchemaParam = new TableSchemaParam.Builder(tableSchema).build();
|
Response res = client.createTable(tableSchema);
|
||||||
Response res = client.createTable(tableSchemaParam);
|
|
||||||
assert(!res.ok());
|
assert(!res.ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,10 +38,9 @@ public class TestTable {
|
|||||||
.withIndexFileSize(index_file_size)
|
.withIndexFileSize(index_file_size)
|
||||||
.withMetricType(MetricType.L2)
|
.withMetricType(MetricType.L2)
|
||||||
.build();
|
.build();
|
||||||
TableSchemaParam tableSchemaParam = new TableSchemaParam.Builder(tableSchema).build();
|
Response res = client.createTable(tableSchema);
|
||||||
Response res = client.createTable(tableSchemaParam);
|
|
||||||
Assert.assertEquals(res.ok(), true);
|
Assert.assertEquals(res.ok(), true);
|
||||||
Response res_new = client.createTable(tableSchemaParam);
|
Response res_new = client.createTable(tableSchema);
|
||||||
Assert.assertEquals(res_new.ok(), false);
|
Assert.assertEquals(res_new.ok(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,8 +51,7 @@ public class TestTable {
|
|||||||
.withIndexFileSize(index_file_size)
|
.withIndexFileSize(index_file_size)
|
||||||
.withMetricType(MetricType.L2)
|
.withMetricType(MetricType.L2)
|
||||||
.build();
|
.build();
|
||||||
TableSchemaParam tableSchemaParam = new TableSchemaParam.Builder(tableSchema).build();
|
Response res = client.createTable(tableSchema);
|
||||||
Response res = client.createTable(tableSchemaParam);
|
|
||||||
System.out.println(res.toString());
|
System.out.println(res.toString());
|
||||||
Assert.assertEquals(res.ok(), false);
|
Assert.assertEquals(res.ok(), false);
|
||||||
}
|
}
|
||||||
@ -70,8 +66,7 @@ public class TestTable {
|
|||||||
.withIndexFileSize(index_file_size)
|
.withIndexFileSize(index_file_size)
|
||||||
.withMetricType(MetricType.L2)
|
.withMetricType(MetricType.L2)
|
||||||
.build();
|
.build();
|
||||||
TableSchemaParam tableSchemaParam = new TableSchemaParam.Builder(tableSchema).build();
|
client.createTable(tableSchema);
|
||||||
client.createTable(tableSchemaParam);
|
|
||||||
List<String> tableNames = client.showTables().getTableNames();
|
List<String> tableNames = client.showTables().getTableNames();
|
||||||
Assert.assertTrue(tableNames.contains(tableNameNew));
|
Assert.assertTrue(tableNames.contains(tableNameNew));
|
||||||
}
|
}
|
||||||
@ -85,8 +80,7 @@ public class TestTable {
|
|||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_drop_table(MilvusClient client, String tableName) throws InterruptedException {
|
public void test_drop_table(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
Response res = client.dropTable(tableName);
|
||||||
Response res = client.dropTable(tableParam);
|
|
||||||
assert(res.ok());
|
assert(res.ok());
|
||||||
Thread.currentThread().sleep(1000);
|
Thread.currentThread().sleep(1000);
|
||||||
List<String> tableNames = client.showTables().getTableNames();
|
List<String> tableNames = client.showTables().getTableNames();
|
||||||
@ -95,8 +89,7 @@ public class TestTable {
|
|||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_drop_table_not_existed(MilvusClient client, String tableName) throws InterruptedException {
|
public void test_drop_table_not_existed(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
TableParam tableParam = new TableParam.Builder(tableName+"_").build();
|
Response res = client.dropTable(tableName+"_");
|
||||||
Response res = client.dropTable(tableParam);
|
|
||||||
assert(!res.ok());
|
assert(!res.ok());
|
||||||
List<String> tableNames = client.showTables().getTableNames();
|
List<String> tableNames = client.showTables().getTableNames();
|
||||||
Assert.assertTrue(tableNames.contains(tableName));
|
Assert.assertTrue(tableNames.contains(tableName));
|
||||||
@ -104,15 +97,13 @@ public class TestTable {
|
|||||||
|
|
||||||
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
||||||
public void test_drop_table_without_connect(MilvusClient client, String tableName) throws InterruptedException {
|
public void test_drop_table_without_connect(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
Response res = client.dropTable(tableName);
|
||||||
Response res = client.dropTable(tableParam);
|
|
||||||
assert(!res.ok());
|
assert(!res.ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_describe_table(MilvusClient client, String tableName) throws InterruptedException {
|
public void test_describe_table(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
DescribeTableResponse res = client.describeTable(tableName);
|
||||||
DescribeTableResponse res = client.describeTable(tableParam);
|
|
||||||
assert(res.getResponse().ok());
|
assert(res.getResponse().ok());
|
||||||
TableSchema tableSchema = res.getTableSchema().get();
|
TableSchema tableSchema = res.getTableSchema().get();
|
||||||
Assert.assertEquals(tableSchema.getDimension(), dimension);
|
Assert.assertEquals(tableSchema.getDimension(), dimension);
|
||||||
@ -123,30 +114,26 @@ public class TestTable {
|
|||||||
|
|
||||||
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
||||||
public void test_describe_table_without_connect(MilvusClient client, String tableName) throws InterruptedException {
|
public void test_describe_table_without_connect(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
DescribeTableResponse res = client.describeTable(tableName);
|
||||||
DescribeTableResponse res = client.describeTable(tableParam);
|
|
||||||
assert(!res.getResponse().ok());
|
assert(!res.getResponse().ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_has_table_not_existed(MilvusClient client, String tableName) throws InterruptedException {
|
public void test_has_table_not_existed(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
TableParam tableParam = new TableParam.Builder(tableName+"_").build();
|
HasTableResponse res = client.hasTable(tableName+"_");
|
||||||
HasTableResponse res = client.hasTable(tableParam);
|
|
||||||
assert(res.getResponse().ok());
|
assert(res.getResponse().ok());
|
||||||
Assert.assertFalse(res.hasTable());
|
Assert.assertFalse(res.hasTable());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
||||||
public void test_has_table_without_connect(MilvusClient client, String tableName) throws InterruptedException {
|
public void test_has_table_without_connect(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
HasTableResponse res = client.hasTable(tableName);
|
||||||
HasTableResponse res = client.hasTable(tableParam);
|
|
||||||
assert(!res.getResponse().ok());
|
assert(!res.getResponse().ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_has_table(MilvusClient client, String tableName) throws InterruptedException {
|
public void test_has_table(MilvusClient client, String tableName) throws InterruptedException {
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
HasTableResponse res = client.hasTable(tableName);
|
||||||
HasTableResponse res = client.hasTable(tableParam);
|
|
||||||
assert(res.getResponse().ok());
|
assert(res.getResponse().ok());
|
||||||
Assert.assertTrue(res.hasTable());
|
Assert.assertTrue(res.hasTable());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,21 +27,18 @@ public class TestTableCount {
|
|||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_table_count_no_vectors(MilvusClient client, String tableName) {
|
public void test_table_count_no_vectors(MilvusClient client, String tableName) {
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
Assert.assertEquals(client.getTableRowCount(tableName).getTableRowCount(), 0);
|
||||||
Assert.assertEquals(client.getTableRowCount(tableParam).getTableRowCount(), 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
public void test_table_count_table_not_existed(MilvusClient client, String tableName) {
|
public void test_table_count_table_not_existed(MilvusClient client, String tableName) {
|
||||||
TableParam tableParam = new TableParam.Builder(tableName+"_").build();
|
GetTableRowCountResponse res = client.getTableRowCount(tableName+"_");
|
||||||
GetTableRowCountResponse res = client.getTableRowCount(tableParam);
|
|
||||||
assert(!res.getResponse().ok());
|
assert(!res.getResponse().ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "DisConnectInstance", dataProviderClass = MainClass.class)
|
||||||
public void test_table_count_without_connect(MilvusClient client, String tableName) {
|
public void test_table_count_without_connect(MilvusClient client, String tableName) {
|
||||||
TableParam tableParam = new TableParam.Builder(tableName+"_").build();
|
GetTableRowCountResponse res = client.getTableRowCount(tableName+"_");
|
||||||
GetTableRowCountResponse res = client.getTableRowCount(tableParam);
|
|
||||||
assert(!res.getResponse().ok());
|
assert(!res.getResponse().ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,9 +49,8 @@ public class TestTableCount {
|
|||||||
// Add vectors
|
// Add vectors
|
||||||
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();;
|
InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();;
|
||||||
client.insert(insertParam);
|
client.insert(insertParam);
|
||||||
Thread.currentThread().sleep(1000);
|
Thread.currentThread().sleep(2000);
|
||||||
TableParam tableParam = new TableParam.Builder(tableName).build();
|
Assert.assertEquals(client.getTableRowCount(tableName).getTableRowCount(), nb);
|
||||||
Assert.assertEquals(client.getTableRowCount(tableParam).getTableRowCount(), nb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
@Test(dataProvider = "Table", dataProviderClass = MainClass.class)
|
||||||
@ -69,8 +65,7 @@ public class TestTableCount {
|
|||||||
.withIndexFileSize(index_file_size)
|
.withIndexFileSize(index_file_size)
|
||||||
.withMetricType(MetricType.L2)
|
.withMetricType(MetricType.L2)
|
||||||
.build();
|
.build();
|
||||||
TableSchemaParam tableSchemaParam = new TableSchemaParam.Builder(tableSchema).build();
|
client.createTable(tableSchema);
|
||||||
client.createTable(tableSchemaParam);
|
|
||||||
// Add vectors
|
// Add vectors
|
||||||
InsertParam insertParam = new InsertParam.Builder(tableNameNew, vectors).build();
|
InsertParam insertParam = new InsertParam.Builder(tableNameNew, vectors).build();
|
||||||
client.insert(insertParam);
|
client.insert(insertParam);
|
||||||
@ -78,8 +73,7 @@ public class TestTableCount {
|
|||||||
Thread.currentThread().sleep(1000);
|
Thread.currentThread().sleep(1000);
|
||||||
for (int i = 0; i < tableNum; ++i) {
|
for (int i = 0; i < tableNum; ++i) {
|
||||||
String tableNameNew = tableName + "_" + Integer.toString(i);
|
String tableNameNew = tableName + "_" + Integer.toString(i);
|
||||||
TableParam tableParam = new TableParam.Builder(tableNameNew).build();
|
res = client.getTableRowCount(tableNameNew);
|
||||||
res = client.getTableRowCount(tableParam);
|
|
||||||
Assert.assertEquals(res.getTableRowCount(), nb);
|
Assert.assertEquals(res.getTableRowCount(), nb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
21
tests/milvus_ann_acc/README.md
Normal file
21
tests/milvus_ann_acc/README.md
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Requirements
|
||||||
|
|
||||||
|
- python 3.6+
|
||||||
|
- pip install -r requirements.txt
|
||||||
|
|
||||||
|
# How to use this Test Project
|
||||||
|
|
||||||
|
This project is used to test search accuracy based on the given datasets (https://github.com/erikbern/ann-benchmarks#data-sets)
|
||||||
|
|
||||||
|
1. start your milvus server
|
||||||
|
2. update your test configuration in test.py
|
||||||
|
3. run command
|
||||||
|
|
||||||
|
```shell
|
||||||
|
python test.py
|
||||||
|
```
|
||||||
|
|
||||||
|
# Contribution getting started
|
||||||
|
|
||||||
|
- Follow PEP-8 for naming and black for formatting.
|
||||||
|
|
||||||
4
tests/milvus_ann_acc/requirements.txt
Normal file
4
tests/milvus_ann_acc/requirements.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
numpy==1.16.3
|
||||||
|
pymilvus>=0.2.0
|
||||||
|
scikit-learn==0.19.1
|
||||||
|
h5py==2.7.1
|
||||||
@ -1,57 +1,23 @@
|
|||||||
# Quick start
|
# Requirements
|
||||||
|
|
||||||
## 运行
|
- python 3.6+
|
||||||
|
- pip install -r requirements.txt
|
||||||
|
|
||||||
### 运行示例:
|
# How to use this Test Project
|
||||||
|
|
||||||
`python3 main.py --image=registry.zilliz.com/milvus/engine:branch-0.3.1-release --run-count=2 --run-type=performance`
|
This project is used to test performance / accuracy / stability of milvus server
|
||||||
|
|
||||||
### 运行参数:
|
1. update your test configuration in suites_*.yaml
|
||||||
|
2. run command
|
||||||
|
|
||||||
--image: 容器模式,传入镜像名称,如传入,则运行测试时,会先进行pull image,基于image生成milvus server容器
|
```shell
|
||||||
|
### docker mode:
|
||||||
|
python main.py --image=milvusdb/milvus:latest --run-count=2 --run-type=performance
|
||||||
|
|
||||||
--local: 与image参数互斥,本地模式,连接使用本地启动的milvus server进行测试
|
### local mode:
|
||||||
|
python main.py --local --run-count=2 --run-type=performance --ip=127.0.0.1 --port=19530
|
||||||
|
```
|
||||||
|
|
||||||
--run-count: 重复运行次数
|
# Contribution getting started
|
||||||
|
|
||||||
--suites: 测试集配置文件,默认使用suites.yaml
|
- Follow PEP-8 for naming and black for formatting.
|
||||||
|
|
||||||
--run-type: 测试类型,包括性能--performance、准确性测试--accuracy以及稳定性--stability
|
|
||||||
|
|
||||||
### 测试集配置文件:
|
|
||||||
|
|
||||||
`operations:
|
|
||||||
|
|
||||||
insert:
|
|
||||||
|
|
||||||
[
|
|
||||||
{"table.index_type": "ivf_flat", "server.index_building_threshold": 300, "table.size": 2000000, "table.ni": 100000, "table.dim": 512},
|
|
||||||
]
|
|
||||||
|
|
||||||
build: []
|
|
||||||
|
|
||||||
query:
|
|
||||||
|
|
||||||
[
|
|
||||||
{"dataset": "ip_ivfsq8_1000", "top_ks": [10], "nqs": [10, 100], "server.nprobe": 1, "server.use_blas_threshold": 800},
|
|
||||||
{"dataset": "ip_ivfsq8_1000", "top_ks": [10], "nqs": [10, 100], "server.nprobe": 10, "server.use_blas_threshold": 20},
|
|
||||||
]`
|
|
||||||
|
|
||||||
## 测试结果:
|
|
||||||
|
|
||||||
性能:
|
|
||||||
|
|
||||||
`INFO:milvus_benchmark.runner:Start warm query, query params: top-k: 1, nq: 1
|
|
||||||
|
|
||||||
INFO:milvus_benchmark.client:query run in 19.19s
|
|
||||||
INFO:milvus_benchmark.runner:Start query, query params: top-k: 64, nq: 10, actually length of vectors: 10
|
|
||||||
INFO:milvus_benchmark.runner:Start run query, run 1 of 1
|
|
||||||
INFO:milvus_benchmark.client:query run in 0.2s
|
|
||||||
INFO:milvus_benchmark.runner:Avarage query time: 0.20
|
|
||||||
INFO:milvus_benchmark.runner:[[0.2]]`
|
|
||||||
|
|
||||||
**│ 10 │ 0.2 │**
|
|
||||||
|
|
||||||
准确率:
|
|
||||||
|
|
||||||
`INFO:milvus_benchmark.runner:Avarage accuracy: 1.0`
|
|
||||||
@ -1,14 +1,23 @@
|
|||||||
# Requirements
|
# Requirements
|
||||||
* python 3.6.8
|
* python 3.6.8+
|
||||||
|
* pip install -r requirements.txt
|
||||||
|
|
||||||
# How to use this Test Project
|
# How to use this Test Project
|
||||||
```shell
|
```shell
|
||||||
pytest . -q -v
|
pytest . --level=1
|
||||||
```
|
```
|
||||||
|
or test connect function only
|
||||||
|
|
||||||
|
```shell
|
||||||
|
pytest test_connect.py --level=1
|
||||||
|
```
|
||||||
|
|
||||||
with allure test report
|
with allure test report
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
pytest --alluredir=test_out . -q -v
|
pytest --alluredir=test_out . -q -v
|
||||||
allure serve test_out
|
allure serve test_out
|
||||||
```
|
```
|
||||||
# Contribution getting started
|
# Contribution getting started
|
||||||
* Follow PEP-8 for naming and black for formatting.
|
* Follow PEP-8 for naming and black for formatting.
|
||||||
|
|
||||||
|
|||||||
@ -1,27 +0,0 @@
|
|||||||
* GLOBAL:
|
|
||||||
FORMAT = "%datetime | %level | %logger | %msg"
|
|
||||||
FILENAME = "/opt/milvus/logs/milvus-%datetime{%H:%m}-global.log"
|
|
||||||
ENABLED = true
|
|
||||||
TO_FILE = true
|
|
||||||
TO_STANDARD_OUTPUT = false
|
|
||||||
SUBSECOND_PRECISION = 3
|
|
||||||
PERFORMANCE_TRACKING = false
|
|
||||||
MAX_LOG_FILE_SIZE = 209715200 ## Throw log files away after 200MB
|
|
||||||
* DEBUG:
|
|
||||||
FILENAME = "/opt/milvus/logs/milvus-%datetime{%H:%m}-debug.log"
|
|
||||||
ENABLED = true
|
|
||||||
* WARNING:
|
|
||||||
FILENAME = "/opt/milvus/logs/milvus-%datetime{%H:%m}-warning.log"
|
|
||||||
* TRACE:
|
|
||||||
FILENAME = "/opt/milvus/logs/milvus-%datetime{%H:%m}-trace.log"
|
|
||||||
* VERBOSE:
|
|
||||||
FORMAT = "%datetime{%d/%M/%y} | %level-%vlevel | %msg"
|
|
||||||
TO_FILE = false
|
|
||||||
TO_STANDARD_OUTPUT = false
|
|
||||||
## Error logs
|
|
||||||
* ERROR:
|
|
||||||
ENABLED = true
|
|
||||||
FILENAME = "/opt/milvus/logs/milvus-%datetime{%H:%m}-error.log"
|
|
||||||
* FATAL:
|
|
||||||
ENABLED = true
|
|
||||||
FILENAME = "/opt/milvus/logs/milvus-%datetime{%H:%m}-fatal.log"
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
server_config:
|
|
||||||
address: 0.0.0.0
|
|
||||||
port: 19530
|
|
||||||
deploy_mode: single
|
|
||||||
time_zone: UTC+8
|
|
||||||
|
|
||||||
db_config:
|
|
||||||
primary_path: /opt/milvus
|
|
||||||
secondary_path:
|
|
||||||
backend_url: sqlite://:@:/
|
|
||||||
insert_buffer_size: 4
|
|
||||||
build_index_gpu: 0
|
|
||||||
preload_table:
|
|
||||||
|
|
||||||
metric_config:
|
|
||||||
enable_monitor: true
|
|
||||||
collector: prometheus
|
|
||||||
prometheus_config:
|
|
||||||
port: 8080
|
|
||||||
|
|
||||||
cache_config:
|
|
||||||
cpu_cache_capacity: 8
|
|
||||||
cpu_cache_threshold: 0.85
|
|
||||||
cache_insert_data: false
|
|
||||||
|
|
||||||
engine_config:
|
|
||||||
use_blas_threshold: 20
|
|
||||||
|
|
||||||
resource_config:
|
|
||||||
resource_pool:
|
|
||||||
- cpu
|
|
||||||
- gpu0
|
|
||||||
@ -12,6 +12,7 @@ index_file_size = 10
|
|||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
parser.addoption("--ip", action="store", default="localhost")
|
parser.addoption("--ip", action="store", default="localhost")
|
||||||
parser.addoption("--port", action="store", default=19530)
|
parser.addoption("--port", action="store", default=19530)
|
||||||
|
parser.addoption("--internal", action="store", default=False)
|
||||||
|
|
||||||
|
|
||||||
def check_server_connection(request):
|
def check_server_connection(request):
|
||||||
@ -76,7 +77,10 @@ def dis_connect(request):
|
|||||||
def args(request):
|
def args(request):
|
||||||
ip = request.config.getoption("--ip")
|
ip = request.config.getoption("--ip")
|
||||||
port = request.config.getoption("--port")
|
port = request.config.getoption("--port")
|
||||||
|
internal = request.config.getoption("--internal")
|
||||||
args = {"ip": ip, "port": port}
|
args = {"ip": ip, "port": port}
|
||||||
|
if internal:
|
||||||
|
args = {"ip": ip, "port": port, "internal": internal}
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -108,8 +108,11 @@ class TestDeleteVectorsBase:
|
|||||||
scope="function",
|
scope="function",
|
||||||
params=gen_index_params()
|
params=gen_index_params()
|
||||||
)
|
)
|
||||||
def get_index_params(self, request):
|
def get_index_params(self, request, args):
|
||||||
yield request.param
|
if "internal" not in args:
|
||||||
|
if request.param["index_type"] == IndexType.IVF_SQ8H:
|
||||||
|
pytest.skip("sq8h not support in open source")
|
||||||
|
return request.param
|
||||||
|
|
||||||
@pytest.mark.timeout(DELETE_TIMEOUT)
|
@pytest.mark.timeout(DELETE_TIMEOUT)
|
||||||
def test_delete_vectors_valid_range_index_created(self, connect, table, get_index_params):
|
def test_delete_vectors_valid_range_index_created(self, connect, table, get_index_params):
|
||||||
@ -291,8 +294,11 @@ class TestDeleteVectorsIP:
|
|||||||
scope="function",
|
scope="function",
|
||||||
params=gen_index_params()
|
params=gen_index_params()
|
||||||
)
|
)
|
||||||
def get_index_params(self, request):
|
def get_index_params(self, request, args):
|
||||||
yield request.param
|
if "internal" not in args:
|
||||||
|
if request.param["index_type"] == IndexType.IVF_SQ8H:
|
||||||
|
pytest.skip("sq8h not support in open source")
|
||||||
|
return request.param
|
||||||
|
|
||||||
@pytest.mark.timeout(DELETE_TIMEOUT)
|
@pytest.mark.timeout(DELETE_TIMEOUT)
|
||||||
def test_delete_vectors_valid_range_index_created(self, connect, ip_table, get_index_params):
|
def test_delete_vectors_valid_range_index_created(self, connect, ip_table, get_index_params):
|
||||||
|
|||||||
@ -26,8 +26,11 @@ class TestIndexBase:
|
|||||||
scope="function",
|
scope="function",
|
||||||
params=gen_index_params()
|
params=gen_index_params()
|
||||||
)
|
)
|
||||||
def get_index_params(self, request):
|
def get_index_params(self, request, args):
|
||||||
yield request.param
|
if "internal" not in args:
|
||||||
|
if request.param["index_type"] == IndexType.IVF_SQ8H:
|
||||||
|
pytest.skip("sq8h not support in open source")
|
||||||
|
return request.param
|
||||||
|
|
||||||
@pytest.fixture(
|
@pytest.fixture(
|
||||||
scope="function",
|
scope="function",
|
||||||
@ -501,8 +504,11 @@ class TestIndexIP:
|
|||||||
scope="function",
|
scope="function",
|
||||||
params=gen_index_params()
|
params=gen_index_params()
|
||||||
)
|
)
|
||||||
def get_index_params(self, request):
|
def get_index_params(self, request, args):
|
||||||
yield request.param
|
if "internal" not in args:
|
||||||
|
if request.param["index_type"] == IndexType.IVF_SQ8H:
|
||||||
|
pytest.skip("sq8h not support in open source")
|
||||||
|
return request.param
|
||||||
|
|
||||||
@pytest.fixture(
|
@pytest.fixture(
|
||||||
scope="function",
|
scope="function",
|
||||||
|
|||||||
@ -43,8 +43,11 @@ class TestSearchBase:
|
|||||||
scope="function",
|
scope="function",
|
||||||
params=gen_index_params()
|
params=gen_index_params()
|
||||||
)
|
)
|
||||||
def get_index_params(self, request):
|
def get_index_params(self, request, args):
|
||||||
yield request.param
|
if "internal" not in args:
|
||||||
|
if request.param["index_type"] == IndexType.IVF_SQ8H:
|
||||||
|
pytest.skip("sq8h not support in open source")
|
||||||
|
return request.param
|
||||||
|
|
||||||
"""
|
"""
|
||||||
generate top-k params
|
generate top-k params
|
||||||
|
|||||||
@ -590,8 +590,11 @@ class TestTable:
|
|||||||
scope="function",
|
scope="function",
|
||||||
params=gen_index_params()
|
params=gen_index_params()
|
||||||
)
|
)
|
||||||
def get_index_params(self, request):
|
def get_index_params(self, request, args):
|
||||||
yield request.param
|
if "internal" not in args:
|
||||||
|
if request.param["index_type"] == IndexType.IVF_SQ8H:
|
||||||
|
pytest.skip("sq8h not support in open source")
|
||||||
|
return request.param
|
||||||
|
|
||||||
@pytest.mark.level(1)
|
@pytest.mark.level(1)
|
||||||
def test_preload_table(self, connect, table, get_index_params):
|
def test_preload_table(self, connect, table, get_index_params):
|
||||||
|
|||||||
@ -38,8 +38,11 @@ class TestTableCount:
|
|||||||
scope="function",
|
scope="function",
|
||||||
params=gen_index_params()
|
params=gen_index_params()
|
||||||
)
|
)
|
||||||
def get_index_params(self, request):
|
def get_index_params(self, request, args):
|
||||||
yield request.param
|
if "internal" not in args:
|
||||||
|
if request.param["index_type"] == IndexType.IVF_SQ8H:
|
||||||
|
pytest.skip("sq8h not support in open source")
|
||||||
|
return request.param
|
||||||
|
|
||||||
def test_table_rows_count(self, connect, table, add_vectors_nb):
|
def test_table_rows_count(self, connect, table, add_vectors_nb):
|
||||||
'''
|
'''
|
||||||
@ -179,8 +182,11 @@ class TestTableCountIP:
|
|||||||
scope="function",
|
scope="function",
|
||||||
params=gen_index_params()
|
params=gen_index_params()
|
||||||
)
|
)
|
||||||
def get_index_params(self, request):
|
def get_index_params(self, request, args):
|
||||||
yield request.param
|
if "internal" not in args:
|
||||||
|
if request.param["index_type"] == IndexType.IVF_SQ8H:
|
||||||
|
pytest.skip("sq8h not support in open source")
|
||||||
|
return request.param
|
||||||
|
|
||||||
def test_table_rows_count(self, connect, ip_table, add_vectors_nb):
|
def test_table_rows_count(self, connect, ip_table, add_vectors_nb):
|
||||||
'''
|
'''
|
||||||
|
|||||||
@ -461,6 +461,7 @@ def gen_simple_index_params():
|
|||||||
|
|
||||||
return gen_params(index_types, nlists)
|
return gen_params(index_types, nlists)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import numpy
|
import numpy
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user