diff --git a/.github/workflows/cluster.yml b/.github/workflows/cluster.yml deleted file mode 100644 index b2f8dd843f8f38626a401c27c307ddffb3a2a718..0000000000000000000000000000000000000000 --- a/.github/workflows/cluster.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: cluster - -on: - schedule: - - cron: '0 20 * * *' - -defaults: - run: - shell: bash - -jobs: - k8s: - name: k8s - runs-on: [self-hosted, k8s-master] - steps: - - uses: actions/checkout@v2 - - name: Upgrade and test in cluster - run: sudo ./ci/test-k8s-cluster.sh diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 4dd571eb521b3270c92ef1857975f6c144663bcc..59565ee7b45386b572ed77a680a04abf96ab36a6 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -13,12 +13,13 @@ jobs: name: build package runs-on: ubuntu-latest strategy: + fail-fast: false matrix: os: - ubuntu1604 - ubuntu1804 - ubuntu2004 - - centos6 + # - centos6 - centos7 - centos8 container: diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 3fbc636e227c7af26373dcd5c4b7ae63844d15f8..62a16bcadec99e11993ed8aa8fa9fc49683b8fce 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -102,6 +102,7 @@ jobs: -DCMAKE_BUILD_TYPE=Debug \ -DENABLE_TESTING=on \ -DENABLE_BUILD_STORAGE=on \ + -DNEBULA_USE_LINKER=lld \ -B build echo "::set-output name=j::10" ;; @@ -116,6 +117,7 @@ jobs: -DENABLE_ASAN=on \ -DENABLE_TESTING=on \ -DENABLE_BUILD_STORAGE=on \ + -DNEBULA_USE_LINKER=lld \ -B build echo "::set-output name=j::6" ;; diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8acb134e6a5455825ca58807eee4ee18bbfb3633..48104bbf0ea5306a441dcbb08a15c3f4d5301010 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: - ubuntu1604 - ubuntu1804 - ubuntu2004 - - centos6 + # - centos6 - centos7 - centos8 container: diff --git a/ci/nebula-test-job.yml b/ci/nebula-test-job.yml deleted file mode 100644 index 452e3756b71f48bbbf731f173286b22d936cf31b..0000000000000000000000000000000000000000 --- a/ci/nebula-test-job.yml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: nebula-test -spec: - template: - metadata: - name: nebula-test - spec: - containers: - - name: nebula-test - image: vesoft/nebula-dev:centos7 - command: ["bash", "-c"] - args: - - "git clone --single-branch -b master https://github.com/vesoft-inc/nebula-graph && ./nebula-graph/ci/test.sh k8s" - restartPolicy: Never - ttlSecondsAfterFinished: 2 - backoffLimit: 0 - activeDeadlineSeconds: 1800 diff --git a/ci/test-k8s-cluster.sh b/ci/test-k8s-cluster.sh deleted file mode 100755 index 0db12af0feee2eb90ea300146264e54a6832f435..0000000000000000000000000000000000000000 --- a/ci/test-k8s-cluster.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (c) 2020 vesoft inc. All rights reserved. -# -# This source code is licensed under Apache 2.0 License, -# attached with Common Clause Condition 1.0, found in the LICENSES directory. - -set -e -o pipefail - -PROJ_DIR="$(cd "$(dirname "$0")" && pwd)/.." - -kubectl get pods - -kubectl delete sts.apps.nebula.io nebulaclusters-metad -kubectl delete sts.apps.nebula.io nebulaclusters-storaged -kubectl delete sts.apps.nebula.io nebulaclusters-graphd - -sleep 15 - -while true; do - status=$(kubectl get nebulaclusters -o jsonpath='{.items[0].status.conditions[?(@.type=="Ready")].status}') - if [[ "$status" == "True" ]]; then - break - fi - sleep 1 -done - -echo "Upgrade nebula cluster successfully." - -kubectl delete job nebula-test || true - -sleep 10 # wait graphd service starting -kubectl apply -f $PROJ_DIR/ci/nebula-test-job.yml -sleep 5 # wait nebula-test job dumping logs -kubectl logs -f jobs/nebula-test diff --git a/ci/test.sh b/ci/test.sh deleted file mode 100755 index ee341929078523c15994e28211ea3bb70212a0ec..0000000000000000000000000000000000000000 --- a/ci/test.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (c) 2020 vesoft inc. All rights reserved. -# -# This source code is licensed under Apache 2.0 License, -# attached with Common Clause Condition 1.0, found in the LICENSES directory. - -set -e -o pipefail - -PROJ_DIR="$(cd "$(dirname "$0")" && pwd)/.." -BUILD_DIR=$PROJ_DIR/build -TOOLSET_DIR=/opt/vesoft/toolset/clang/9.0.0 - -mkdir -p $BUILD_DIR - -function get_py_client() { - git clone https://github.com/vesoft-inc/nebula-python.git - pushd nebula-python - python3 setup.py install --user - popd - rm -rf nebula-python -} - -function prepare() { - pip3 install --user -U setuptools -i https://mirrors.aliyun.com/pypi/simple/ - pip3 install --user -r $PROJ_DIR/tests/requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ - get_py_client -} - -function lint() { - cd $PROJ_DIR - ln -snf $PROJ_DIR/.linters/cpp/hooks/pre-commit.sh $PROJ_DIR/.linters/cpp/pre-commit.sh - $PROJ_DIR/.linters/cpp/pre-commit.sh $(git --no-pager diff --diff-filter=d --name-only HEAD^ HEAD) -} - -function build_common() { - cmake --build $BUILD_DIR/modules/common -j$(nproc) -} - -function build_storage() { - cmake --build $BUILD_DIR/modules/storage --target nebula-storaged -j$(nproc) - cmake --build $BUILD_DIR/modules/storage --target nebula-metad -j$(nproc) -} - -function gcc_compile() { - cd $PROJ_DIR - cmake \ - -DCMAKE_EXPORT_COMPILE_COMMANDS=on \ - -DCMAKE_CXX_COMPILER=$TOOLSET_DIR/bin/g++ \ - -DCMAKE_C_COMPILER=$TOOLSET_DIR/bin/gcc \ - -DCMAKE_BUILD_TYPE=Release \ - -DENABLE_TESTING=on \ - -DENABLE_BUILD_STORAGE=on \ - -DNEBULA_STORAGE_REPO_URL=$NEBULA_STORAGE_REPO_URL \ - -DNEBULA_COMMON_REPO_URL=$NEBULA_COMMON_REPO_URL \ - -B $BUILD_DIR - build_common - build_storage - cmake --build $BUILD_DIR -j$(nproc) -} - -function configure_clang() { - cd $PROJ_DIR - cmake \ - -DCMAKE_EXPORT_COMPILE_COMMANDS=on \ - -DCMAKE_CXX_COMPILER=$TOOLSET_DIR/bin/clang++ \ - -DCMAKE_C_COMPILER=$TOOLSET_DIR/bin/clang \ - -DCMAKE_BUILD_TYPE=Debug \ - -DENABLE_ASAN=on \ - -DENABLE_TESTING=on \ - -DENABLE_BUILD_STORAGE=on \ - -DNEBULA_STORAGE_REPO_URL=$NEBULA_STORAGE_REPO_URL \ - -DNEBULA_COMMON_REPO_URL=$NEBULA_COMMON_REPO_URL \ - -B $BUILD_DIR -} - -function clang_compile() { - configure_clang - cd $PROJ_DIR - build_common - build_storage - cmake --build $BUILD_DIR -j$(nproc) -} - -function run_ctest() { - cd $BUILD_DIR - ctest -j$(nproc) \ - --timeout 400 \ - --output-on-failure -} - -function test_in_cluster() { - cd $BUILD_DIR/tests - export PYTHONPATH=$PROJ_DIR:$PYTHONPATH - testpath=$(cat $PROJ_DIR/ci/tests.txt | sed "s|\(.*\)|$PROJ_DIR/tests/\1|g" | tr '\n' ' ') - ./ntr \ - -n=8 \ - --dist=loadfile \ - --address="nebulaclusters-graphd:3699" \ - $testpath - - ./ntr --address="nebulaclusters-graphd:3699" $PROJ_DIR/tests/job/* -} - -case "$1" in - prepare) - prepare - ;; - lint) - lint - ;; - clang) - clang_compile - ;; - gcc) - gcc_compile - ;; - ctest) - run_ctest - ;; - k8s) - prepare - configure_clang - test_in_cluster - ;; - *) - prepare - gcc_compile - run_ctest - run_test - ;; -esac diff --git a/ci/tests.txt b/ci/tests.txt deleted file mode 100644 index 247797734b635ca932651a022cd0f0eb5969456a..0000000000000000000000000000000000000000 --- a/ci/tests.txt +++ /dev/null @@ -1,13 +0,0 @@ -admin/* -maintain/* -mutate/* -query/v1/* -query/v2/* -query/stateless/test_schema.py -query/stateless/test_admin.py -query/stateless/test_if_exists.py -query/stateless/test_range.py -query/stateless/test_go.py -query/stateless/test_simple_query.py -query/stateless/test_keyword.py -query/stateless/test_lookup.py diff --git a/tests/query/stateless/test_range.py b/tests/query/stateless/test_range.py index dd1f815267b5897a912138f3ccb04c99c381967e..657d306a415a2539f2b06db9965f28b42ce1e5e4 100644 --- a/tests/query/stateless/test_range.py +++ b/tests/query/stateless/test_range.py @@ -31,7 +31,6 @@ class TestRangeChecking(NebulaTestSuite): resp = self.execute('CREATE TAG test(id int)') self.check_resp_succeeded(resp) - time.sleep(self.delay+1) def gen_name(self, length: int) -> str: return ''.join(random.choice(string.ascii_letters) for i in range(length)) @@ -48,53 +47,6 @@ class TestRangeChecking(NebulaTestSuite): resp = self.execute(query) self.check_resp_failed(resp, ttypes.ErrorCode.E_SYNTAX_ERROR) - @pytest.mark.parametrize('number', [-9223372036854775808, -1, 0, 1, 9223372036854775807]) - def test_integer_range_valid(self, number): - # integer bound checking - resp = self.execute("INSERT VERTEX test(id) VALUES '100':({})".format(number)) - self.check_resp_succeeded(resp) - - # hex bound checking - resp = self.execute("INSERT VERTEX test(id) VALUES '100':({:#x})".format(number)) - self.check_resp_succeeded(resp) - - # oct bound checking - # TODO(shylock) Trick to make oct number valid - # I don't think the zero prefix oct number is good design - # plan to change to `0o' prefix - if (number < 0): - query = "INSERT VERTEX test(id) VALUES '100':(-0{:o})".format(abs(number)) - else: - query = "INSERT VERTEX test(id) VALUES '100':(0{:o})".format(abs(number)) - resp = self.execute(query) - self.check_resp_succeeded(resp) - - @pytest.mark.parametrize('number', [-9223372036854999999, -9223372036854775809, 9223372036854775808, 9223372036899999999]) - def test_integer_range_invalid(self, number): - # integer bound - resp = self.execute("INSERT VERTEX test(id) VALUES '100':({})".format(number)); - self.check_resp_failed(resp, ttypes.ErrorCode.E_SYNTAX_ERROR) - error = "SyntaxError: Out of range: near "; - assert resp.error_msg().find(error) == 0 - - # hex bound - resp = self.execute("INSERT VERTEX test(id) VALUES '100':({:#x})".format(number)); - self.check_resp_failed(resp, ttypes.ErrorCode.E_SYNTAX_ERROR) - error = "SyntaxError: Out of range: near "; - assert resp.error_msg().find(error) == 0 - - # oct bound - # TODO(shylock) Trick to make oct number valid - # I don't think the zero prefix oct number is good design - # plan to change to `0o' prefix - if number < 0: - query = "INSERT VERTEX test(id) VALUES '100':(-0{:o})".format(abs(number)) - else: - query = "INSERT VERTEX test(id) VALUES '100':(0{:o})".format(abs(number)) - resp = self.execute(query); - self.check_resp_failed(resp, ttypes.ErrorCode.E_SYNTAX_ERROR) - assert resp.error_msg().find(error) == 0 - @classmethod def cleanup(self): resp = self.execute('DROP SPACE test_range_checking') diff --git a/tests/tck/features/insert/BoundCheck.feature b/tests/tck/features/insert/BoundCheck.feature new file mode 100644 index 0000000000000000000000000000000000000000..f26b321594437ffd528ba164d24d4236ea28b9b3 --- /dev/null +++ b/tests/tck/features/insert/BoundCheck.feature @@ -0,0 +1,64 @@ +# Copyright (c) 2020 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License, +# attached with Common Clause Condition 1.0, found in the LICENSES directory. +Feature: Bound integer insertion test + + Background: + Given an empty graph + And create a space with following options: + | partition_num | 9 | + | replica_factor | 1 | + | vid_type | FIXED_STRING(20) | + And having executed: + """ + CREATE TAG test(id int) + """ + + Scenario Outline: insert bound integer value + When try to execute query: + """ + INSERT VERTEX test(id) VALUES '100':(<num>); + INSERT VERTEX test(id) VALUES '100':(<hex>); + INSERT VERTEX test(id) VALUES '100':(<oct>); + """ + Then the execution should be successful + And drop the used space + + Examples: + | num | hex | oct | + | 9223372036854775807 | 0x7fffffffffffffff | 0777777777777777777777 | + | 1 | 0x1 | 01 | + | 0 | 0x0 | 00 | + | -1 | -0x1 | -01 | + | -9223372036854775808 | -0x8000000000000000 | -01000000000000000000000 | + + Scenario Outline: insert invalid bound integer value + When try to execute query: + """ + INSERT VERTEX test(id) VALUES '100':(1); + """ + Then the execution should be successful + When executing query: + """ + INSERT VERTEX test(id) VALUES '100':(<num>); + """ + Then a SyntaxError should be raised at compile time: Out of range + When executing query: + """ + INSERT VERTEX test(id) VALUES '100':(<hex>); + """ + Then a SyntaxError should be raised at compile time: Out of range + When executing query: + """ + INSERT VERTEX test(id) VALUES '100':(<oct>); + """ + Then a SyntaxError should be raised at compile time: Out of range + And drop the used space + + Examples: + | num | hex | oct | + | -9223372036854999999 | -0x8000000000036bbf | -01000000000000000665677 | + | -9223372036854775809 | -0x8000000000000001 | -01000000000000000000001 | + | 9223372036854775808 | 0x8000000000000000 | 01000000000000000000000 | + | 9223372036899999999 | 0x8000000002b210ff | 01000000000000254410377 |