Skip to content
This repository has been archived by the owner on Oct 29, 2023. It is now read-only.

Commit

Permalink
General availability: version 1.0.0
Browse files Browse the repository at this point in the history
- General Availability.
- Fixed bug with single deployment and --force. On the second deployment,
  the port was changed.
- More tests added. The test suite now runs a total of 3,013
  tests (MacOS) and 3,143 (Linux). A total of 6,156 tests that ran at least
  twice (once with concurrency and once without)
  • Loading branch information
datacharmer committed Mar 28, 2018
1 parent fccec59 commit 03e3922
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 22 deletions.
7 changes: 7 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
1.0.0 26-Mar-2018
- General Availability.
- Fixed bug with single deployment and --force. On the second deployment,
the port was changed.
- More tests added. The test suite now runs a total of 3,013 tests (MacOS)
and 3,143 (Linux). A total of 6,156 tests that ran at least twice (once
with concurrency and once without)
0.3.9 25-Mar-2018
- Added version detection to *unpack* command. now --unpack-version
becomes mandatory only if a version is not detected from the tarball
Expand Down
4 changes: 2 additions & 2 deletions common/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

package common

var VersionDef string = "0.3.9" // 2018-03-25
var VersionDef string = "1.0.0" // 2018-03-26

// Compatible version is the version used to mark compatible archives (templates, configuration).
// It is usually major.minor.0, except when we are at version 0.x, when
// every revision may bring incompatibility
var CompatibleVersion string = "0.3.7" // 2018-03-24
var CompatibleVersion string = "1.0.0" // 2018-03-26
2 changes: 1 addition & 1 deletion sandbox/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func CreateSingleSandbox(sdef SandboxDef, origin string) (exec_list []concurrent
}
}
//fmt.Printf("%#v\n", sdef)
if sdef.NodeNum == 0 {
if sdef.NodeNum == 0 && !sdef.Force {
sdef.Port = FindFreePort(sdef.Port, sdef.InstalledPorts, 1)
}
timestamp := time.Now()
Expand Down
59 changes: 50 additions & 9 deletions sandbox/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -787,46 +787,87 @@ pass=0
TIMEOUT=180
expected_port={{.Port}}
expected_version=$(echo "{{.Version}}" | tr -d 'A-Z,a-z,_-')
if [ -f sbdescription.json ]
then
sb_single=$(grep 'type' sbdescription.json| grep 'single')
fi
function test_query {
user=$1
query="$2"
expected=$3
./use -BN -u $user -e "$query" > /dev/null 2>&1
exit_code=$?
if [ "$exit_code" == "$expected" ]
then
msg="was successful"
if [ "$expected" != "0" ]
then
msg="failed as expected"
fi
echo "ok - query $msg for user $user: '$query'"
pass=$((pass+1))
else
echo "not ok - query failed for user $user: '$query'"
fail=$((fail+1))
fi
}
if [ -z "$(is_running)" ]
then
echo "not ok - server stopped"
fail=$(($fail+1))
fail=$((fail+1))
else
version=$(./use -BN -e "select version()")
port=$(./use -BN -e "show variables like 'port'" | awk '{print $2}')
if [ -n "$version" ]
then
echo "ok - version '$version'"
pass=$(($pass+1))
pass=$((pass+1))
else
echo "not ok - no version detected"
fail=$(($fail+1))
fail=$((fail+1))
fi
if [ -n "$port" ]
then
echo "ok - port detected: $port"
pass=$(($pass+1))
pass=$((pass+1))
else
echo "not ok - no port detected"
fail=$(($fail+1))
fail=$((fail+1))
fi
if [ -n "$( echo $version| grep $expected_version)" ]
then
echo "ok - version is $version as expected"
pass=$(($pass+1))
pass=$((pass+1))
else
echo "not ok - version detected ($version) but expected was $expected_version"
fail=$(($fail+1))
fail=$((fail+1))
fi
if [ "$port" == "$expected_port" ]
then
echo "ok - port is $port as expected"
pass=$(($pass+1))
pass=$((pass+1))
else
echo "not ok - port detected ($port) but expected was $expected_port"
fail=$(($fail+1))
fail=$((fail+1))
fi
ro_query='use mysql; select count(*) from information_schema.tables where table_schema=schema()'
create_query='create table if not exists test.txyz(i int)'
drop_query='drop table if exists test.txyz'
test_query msandbox_ro 'select 1' 0
test_query msandbox_rw 'select 1' 0
test_query msandbox_ro "$ro_query" 0
test_query msandbox_rw "$ro_query" 0
if [ -n "$sb_single" ]
then
test_query msandbox_ro "$create_query" 1
test_query msandbox_rw "$create_query" 0
test_query msandbox_rw "$drop_query" 0
fi
fi
fail_label="fail"
pass_label="PASS"
Expand Down
20 changes: 20 additions & 0 deletions test/common.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

export CATALOG=$HOME/.dbdeployer/sandboxes.json
export dash_line="# ----------------------------------------------------------------"
export double_dash_line="# ================================================================"

if [ -n "$SKIP_DBDEPLOYER_CATALOG" ]
then
Expand All @@ -18,6 +19,25 @@ fi

[ -z "$results_log" ] && export results_log=results-$(uname).txt

function test_header {
func_name=$1
arg=$2
double_line=$3
if [ -n "$double_line" ]
then
echo $double_dash_line
else
echo $dash_line
fi
echo "# $func_name $arg"
if [ -n "$double_line" ]
then
echo $double_dash_line
else
echo $dash_line
fi
}

function start_timer {
start=$(date)
start_sec=$(date +%s)
Expand Down
44 changes: 34 additions & 10 deletions test/functional-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ function test_completeness {
running_version=$1
dir_name=$2
mode=$3
test_header test_completeness $running_version
version_path=$(echo $running_version| tr '.' '_')
if [ -d $SANDBOX_HOME/$dir_name ]
then
Expand Down Expand Up @@ -199,6 +200,7 @@ function test_start_restart {
running_version=$1
dir_name=$2
mode=$3
test_header test_start_restart $running_version
use_name=use
start_name=start
stop_name=stop
Expand Down Expand Up @@ -248,6 +250,7 @@ function test_start_restart {
function test_semi_sync {
running_version=$1
group_dir_name=$2
test_header test_semi_sync $running_version
version_path=$(echo $running_version| tr '.' '_')
sbdir=$SANDBOX_HOME/$group_dir_name$version_path
master_enabled=$($sbdir/m -BN -e 'select @@rpl_semi_sync_master_enabled' | tr -d ' ' )
Expand All @@ -265,10 +268,23 @@ function test_semi_sync {
ok_greater "Bigger number of sync trx" $master_yes_trx_after $master_yes_trx_before
}

function test_force {
running_version=$1
dir_name=$2
test_header test_force $running_version
version_path=$(echo $running_version| tr '.' '_')
sandbox_dir=$dir_name$version_path
port_before=$($SANDBOX_HOME/$sandbox_dir/use -BN -e 'show variables like "port"' | awk '{print $2}')
run dbdeployer deploy single $running_version --force
port_after=$($SANDBOX_HOME/$sandbox_dir/use -BN -e 'show variables like "port"' | awk '{print $2}')
ok_equal "Port before and after --force redeployment" $port_after $port_before
}

function test_uuid {
running_version=$1
group_dir_name=$2
must_exist=$3
test_header test_uuid $running_version
version_path=$(echo $running_version| tr '.' '_')
count=0
if [ -d $SANDBOX_HOME/$group_dir_name$version_path/master ]
Expand Down Expand Up @@ -306,6 +322,7 @@ function test_uuid {
function test_deletion {
del_version=$1
expected_items=$2
test_header test_deletion $del_version
# test lock: sandboxes become locked against deletion
num_sandboxes_before=$(dbdeployer sandboxes | wc -l)
run dbdeployer admin lock ALL
Expand Down Expand Up @@ -379,7 +396,7 @@ installed_sandboxes=$(dbdeployer sandboxes --catalog)
if [ -n "$installed_sandboxes" ]
then
(set -x
dbdeployer sandboxes --catalog
dbdeployer sandboxes
)
echo "One or more sandboxes are already deployed. "
echo "Please remove (or move) the sandboxes and try again"
Expand All @@ -393,6 +410,7 @@ then
dbdeployer sandboxes --catalog
)
echo "Found $catalog_items items in the catalog. Expected: 0"
echo "Check the file ${CATALOG}: it should be empty."
exit 1
fi

Expand Down Expand Up @@ -504,6 +522,7 @@ echo "Will test: [${all_versions[*]}]"

function main_deployment_methods {
current_test=main_deployment_methods
test_header main_deployment_methods "" double
for V in ${all_versions[*]}
do
# We test the main deployment methods
Expand All @@ -521,6 +540,7 @@ function main_deployment_methods {
sleep 2
# Runs basic tests
run dbdeployer global status
test_force $V msb_
test_uuid $V multi_msb_
test_uuid $V rsandbox_
test_completeness $V msb_ single
Expand All @@ -535,6 +555,7 @@ function main_deployment_methods {
}

function pre_post_operations {
test_header pre_post_operations "" double
current_test=pre_post_operations
# This test checks the following:
# * we can run a SQL command before the grants are loaded
Expand Down Expand Up @@ -577,6 +598,7 @@ function pre_post_operations {

function semisync_operations {
current_test=semisync_operations
test_header semisync_operations "" double
for V in ${semisync_versions[*]}
do
echo "# semisync operations $V"
Expand All @@ -598,6 +620,7 @@ function semisync_operations {

function group_operations {
current_test=group_operations
test_header group_operations "" double
for V in ${group_versions[*]}
do
echo "# Group operations $V"
Expand All @@ -617,6 +640,7 @@ function group_operations {

function multi_source_operations {
current_test=multi_source_operations
test_header multi_source_operations "" double
for V in ${group_versions[*]}
do
echo "# Multi-source operations $V"
Expand All @@ -625,23 +649,23 @@ function multi_source_operations {
run dbdeployer deploy replication $V --topology=fan-in \
--sandbox-directory=fan_in_msb2_$v_path \
--base-port=24000 \
--nodes=5 \
--nodes=4 \
--master-list='1,2' \
--slave-list='3,4,5'
run dbdeployer deploy replication $V --topology=fan-in \
--sandbox-directory=fan_in_msb3_$v_path \
--base-port=25000 \
--nodes=5 \
--master-list='1.2.3' \
--slave-list='4:5'
--slave-list='3:4'
#run dbdeployer deploy replication $V --topology=fan-in \
# --sandbox-directory=fan_in_msb3_$v_path \
# --base-port=25000 \
# --nodes=5 \
# --master-list='1.2.3' \
# --slave-list='4:5'
run dbdeployer deploy replication $V --topology=all-masters
results "multi-source"

capture_test run dbdeployer global test
capture_test run dbdeployer global test-replication
test_uuid $V fan_in_msb_ 1
test_uuid $V all_masters_msb_ 1
test_deletion $V 4
test_deletion $V 3
results "multi-source - after deletion"
done
}
Expand Down
12 changes: 12 additions & 0 deletions test/mock/port-clash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@ do
run dbdeployer deploy replication $version --topology=group --single-primary
run dbdeployer deploy replication $version --topology=all-masters
run dbdeployer deploy replication $version --topology=fan-in
run dbdeployer deploy replication $version --topology=fan-in \
--sandbox-directory=fan_in_msb2_$version_name \
--base-port=24000 \
--nodes=5 \
--master-list='1,2' \
--slave-list='3:4:5'
run dbdeployer deploy replication $version --topology=fan-in \
--sandbox-directory=fan_in_msb3_$version_name \
--base-port=25000 \
--nodes=5 \
--master-list='1.2.3' \
--slave-list='4,5'
fi
results "$version"
right_installer1=$(grep mysqld $SANDBOX_HOME/msb_${version_name}/init_db )
Expand Down

0 comments on commit 03e3922

Please sign in to comment.