From ff4d5bfc6e63775dd5b429c466178479ad2254e3 Mon Sep 17 00:00:00 2001 From: deepthi Date: Sat, 30 May 2020 15:54:09 -0700 Subject: [PATCH 1/2] region_sharding example: add CI test Signed-off-by: deepthi --- .github/workflows/region_example.yml | 54 ++++++++++++++++++++++++++++ test/region_example.sh | 39 ++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 .github/workflows/region_example.yml create mode 100755 test/region_example.sh diff --git a/.github/workflows/region_example.yml b/.github/workflows/region_example.yml new file mode 100644 index 00000000000..a758427b328 --- /dev/null +++ b/.github/workflows/region_example.yml @@ -0,0 +1,54 @@ +name: region_example +on: [push, pull_request] +jobs: + + build: + name: Region Sharding example using ${{ matrix.topo }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + topo: [etcd] + + steps: + + - name: Set up Go + uses: actions/setup-go@v1 + with: + go-version: 1.13 + + - name: Check out code + uses: actions/checkout@v2 + + - name: Get dependencies + run: | + if [ ${{matrix.os}} = "ubuntu-latest" ]; then + sudo apt-get update + sudo apt-get install -y mysql-server mysql-client make unzip g++ etcd curl git wget eatmydata + sudo service mysql stop + sudo service etcd stop + sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ + sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld + elif [ ${{matrix.os}} = "macos-latest" ]; then + brew install mysql@5.7 make unzip etcd curl git wget + fi + go mod download + + - name: Run make minimaltools + run: | + make minimaltools + + - name: Build + run: | + make build + + - name: region_example + timeout-minutes: 30 + run: | + export TOPO=${{matrix.topo}} + if [ ${{matrix.os}} = "macos-latest" ]; then + export PATH="/usr/local/opt/mysql@5.7/bin:$PATH" + fi + # Make sure that testing is entirely non-reliant on config + mv config config-moved + eatmydata -- test/region_example.sh diff --git a/test/region_example.sh b/test/region_example.sh new file mode 100755 index 00000000000..20325392923 --- /dev/null +++ b/test/region_example.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Copyright 2020 The Vitess Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This test runs through the scripts in examples/region_sharding to make sure they work. +# It should be kept in sync with the steps in https://vitess.io/docs/user-guides/region-sharding/ +# So we can detect if a regression affecting a tutorial is introduced. + +source build.env + +set -xe + +cd "$VTROOT/examples/region_sharding" +unset VTROOT # ensure that the examples can run without VTROOT now. + +source ./env.sh # Required so that "mysql" works from alias + +sed -i 's/user\/my-vitess/runner\/work\/vitess\/vitess/g' main_vschema.json #set correct path to countries.json + +./101_initial_cluster.sh + +sleep 5 # Give vtgate time to really start. + +mysql < insert_customers.sql +mysql --table < show_data.sql + +./201_teardown.sh \ No newline at end of file From 3ec2689a6af45f7d7819ff73991472fe3a730041 Mon Sep 17 00:00:00 2001 From: deepthi Date: Fri, 5 Jun 2020 06:59:17 -0700 Subject: [PATCH 2/2] set correct path to config file in CI test config Signed-off-by: deepthi --- .github/workflows/region_example.yml | 1 + test/region_example.sh | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/region_example.yml b/.github/workflows/region_example.yml index a758427b328..0da77d8c89e 100644 --- a/.github/workflows/region_example.yml +++ b/.github/workflows/region_example.yml @@ -51,4 +51,5 @@ jobs: fi # Make sure that testing is entirely non-reliant on config mv config config-moved + sed -i 's/user\/my-vitess/runner\/work\/vitess\/vitess/g' examples/region_sharding/main_vschema.json #set correct path to countries.json eatmydata -- test/region_example.sh diff --git a/test/region_example.sh b/test/region_example.sh index 20325392923..2be46a597bb 100755 --- a/test/region_example.sh +++ b/test/region_example.sh @@ -27,8 +27,6 @@ unset VTROOT # ensure that the examples can run without VTROOT now. source ./env.sh # Required so that "mysql" works from alias -sed -i 's/user\/my-vitess/runner\/work\/vitess\/vitess/g' main_vschema.json #set correct path to countries.json - ./101_initial_cluster.sh sleep 5 # Give vtgate time to really start.