-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ChenHuajun/main
优化归档逻辑和添加测试集等
- Loading branch information
Showing
29 changed files
with
7,171 additions
and
1,114 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# cigration | ||
# Cigration extension | ||
comment = 'Citus shards migration tool' | ||
default_version = '1.0' | ||
default_version = '1.1' | ||
requires = 'citus,dblink' | ||
superuser = true | ||
relocatable = true | ||
relocatable = false | ||
schema = pg_catalog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Local binaries | ||
/pg_regress | ||
|
||
# Generated subdirectories | ||
/tmp_check/ | ||
/tmp_upgrade/ | ||
/build/ | ||
/results/ | ||
/log/ | ||
/bin/test/results/ | ||
|
||
# Regression test output | ||
/regression.diffs | ||
/regression.out | ||
/test_times.log | ||
|
||
# Regression test timing | ||
/test_times.log | ||
|
||
# Failure test side effets | ||
/proxy.output | ||
|
||
# python | ||
*.pyc | ||
|
||
# output from diff normalization that shouldn't be commited | ||
*.unmodified | ||
*.modified |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pg_regress_multi.pl is come from Citus(https://github.com/citusdata/citus/), so follow the Citus's AGPL license, other files follow the Apache 2.0 license |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Makefile for tests of the Citus extension | ||
|
||
print-% : ; @echo $* = $($*) | ||
|
||
#citus_top_builddir = ../../.. | ||
|
||
#include Makefile.global | ||
cur_dir:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) | ||
|
||
citus_abs_srcdir:=${cur_dir} | ||
citus_abs_top_srcdir:=${cur_dir} | ||
#postgres_abs_srcdir:=/var/lib/pgsql/rpm10/BUILD/postgresql-10.2 | ||
#postgres_abs_builddir:=/var/lib/pgsql/rpm10/BUILD/postgresql-10.2 | ||
|
||
PG_CONFIG:=pg_config | ||
PGXS:=$(shell $(PG_CONFIG) --pgxs) | ||
|
||
# Citus is built using PostgreSQL's pgxs | ||
USE_PGXS=1 | ||
include $(PGXS) | ||
|
||
# ensure MAJORVERSION is defined (missing in older versions) | ||
ifndef MAJORVERSION | ||
MAJORVERSION := $(basename $(VERSION)) | ||
endif | ||
|
||
## | ||
## Citus regression support | ||
## | ||
MULTI_INSTALLDIR=$(CURDIR)/tmp_check/install | ||
pg_regress_multi_check = $(PERL) $(citus_abs_srcdir)/pg_regress_multi.pl --pgxsdir="$(pgxsdir)" --bindir="$(bindir)" --libdir="$(libdir)" --majorversion="$(MAJORVERSION)" --postgres-builddir="$(postgres_abs_builddir)" --postgres-srcdir="$(postgres_abs_srcdir)" | ||
MULTI_REGRESS_OPTS = --inputdir=$(citus_abs_srcdir) $(pg_regress_locale_flags) | ||
|
||
# XXX: Can't actually do useful testruns against install - $libdir | ||
# etc will point to the directory configured during postgres' | ||
# build. We could copy the installed tree around, but that's quite | ||
# likely to be mixed with other binaries and such... | ||
cleandir-main: | ||
### echo rm -rf '$(CURDIR)'/tmp_check/install | ||
### | ||
tempinstall-main: cleandir-main | ||
#### mkdir -p $(MULTI_INSTALLDIR) | ||
### $(MAKE) DESTDIR=$(MULTI_INSTALLDIR) -C $(citus_top_builddir) install > tmp_check/install.log 2>&1 | ||
|
||
# Test input and expected files. These are created by pg_regress itself, so we | ||
# don't have a rule to create them. We do need rules to clean them however. | ||
input_files := $(patsubst $(citus_abs_srcdir)/input/%.source,sql/%.sql, $(wildcard $(citus_abs_srcdir)/input/*.source)) | ||
output_files := $(patsubst $(citus_abs_srcdir)/output/%.source,expected/%.out, $(wildcard $(citus_abs_srcdir)/output/*.source)) | ||
|
||
# have make check actually run all tests, but keep check-full as an | ||
# intermediate, for muscle memory backward compatibility. | ||
check: all tempinstall-main | ||
$(pg_regress_multi_check) --load-extension=citus \ | ||
-- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/shard_migration $(EXTRA_TESTS) | ||
|
||
check_base: all tempinstall-main | ||
$(pg_regress_multi_check) --load-extension=citus \ | ||
-- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/check_base $(EXTRA_TESTS) | ||
|
||
clean distclean maintainer-clean: | ||
rm -f $(output_files) $(input_files) | ||
rm -rf tmp_check/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#Citus分片迁移测试说明 | ||
--- | ||
# 1. 环境准备 | ||
|
||
将postgrsql的安装目录加入到PATH环境变量,比如 | ||
|
||
``` | ||
export PATH=/usr/pgsql-12/bin:$PATH | ||
``` | ||
|
||
# 2. 执行回归测试 | ||
|
||
cd test | ||
make check | ||
|
||
# 3. 执行指定回归测试 | ||
|
||
通过`EXTRA_TESTS`代入要测试的case名称 | ||
|
||
``` | ||
make check_base EXTRA_TESTS=single_task_execute | ||
make check_base EXTRA_TESTS='single_task_execute replica_identity_check' | ||
``` | ||
|
||
注意:执行指定测试case时,可能由于序列值的差异,导致diff结果误判,需要人工判断。 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test: init |
Oops, something went wrong.