Skip to content

Commit

Permalink
integration_tests(ticdc): move integration tests into integration_tes…
Browse files Browse the repository at this point in the history
…ts dir (#3646) (#3691)
  • Loading branch information
ti-chi-bot authored Dec 2, 2021
1 parent 3169b6e commit a4d46ee
Show file tree
Hide file tree
Showing 209 changed files with 26 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ integration_test_build: check_failpoint_ctl
integration_test: integration_test_mysql

integration_test_mysql:
tests/run.sh mysql "$(CASE)"
tests/integration_tests/run.sh mysql "$(CASE)"

integration_test_kafka: check_third_party_binary
tests/run.sh kafka "$(CASE)"
tests/integration_tests/run.sh kafka "$(CASE)"

fmt: tools/bin/gofumports tools/bin/shfmt
@echo "gofmt (simplify)"
Expand Down
8 changes: 4 additions & 4 deletions pkg/security/credential_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ import (

func TestGetCommonName(t *testing.T) {
cd := &Credential{
CAPath: "../../tests/_certificates/ca.pem",
CertPath: "../../tests/_certificates/server.pem",
KeyPath: "../../tests/_certificates/server-key.pem",
CAPath: "../../tests/integration_tests/_certificates/ca.pem",
CertPath: "../../tests/integration_tests/_certificates/server.pem",
KeyPath: "../../tests/integration_tests/_certificates/server-key.pem",
}
cn, err := cd.getSelfCommonName()
require.Nil(t, err)
require.Equal(t, "tidb-server", cn)

cd.CertPath = "../../tests/_certificates/server-key.pem"
cd.CertPath = "../../tests/integration_tests/_certificates/server-key.pem"
_, err = cd.getSelfCommonName()
require.NotNil(t, err)
require.Contains(t, err.Error(), "failed to decode PEM block to certificate")
Expand Down
7 changes: 4 additions & 3 deletions tests/README.md → tests/integration_tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@

2. Run `make integration_test` to execute the integration tests. This command will

1. Check that all required executables exist.
2. Execute `tests/run.sh`
1. Check that all required executables exist.
2. Execute `tests/integration_tests/run.sh`

> If want to run one integration test case only, just pass the CASE parameter, such as `make integration_test CASE=simple`.
Expand All @@ -50,4 +50,5 @@

## Writing new tests

New integration tests can be written as shell scripts in `tests/TEST_NAME/run.sh`. The script should exit with a nonzero error code on failure.
New integration tests can be written as shell scripts in `tests/integration_tests/TEST_NAME/run.sh`. The script should
exit with a nonzero error code on failure.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ while ! curl -o /dev/null -sf http://127.0.0.1:17000/metrics 1>/dev/null 2>&1; d
done

echo "Starting CDC state checker..."
cd $CUR/../../testing_utils/cdc_state_checker
cd $CUR/../../../testing_utils/cdc_state_checker
if [ ! -f ./cdc_state_checker ]; then
GO111MODULE=on go build
fi
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ run_sql "update mysql.tidb set variable_value='60m' where variable_name='tikv_gc
--ssl-key=$TLS_DIR/server-key.pem

echo "Starting CDC state checker..."
cd $CUR/../../testing_utils/cdc_state_checker
cd $CUR/../../../testing_utils/cdc_state_checker
if [ ! -f ./cdc_state_checker ]; then
GO111MODULE=on go build
fi
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/cdc/cdc.go → tests/integration_tests/cdc/cdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
_ "github.com/go-sql-driver/mysql"
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pingcap/ticdc/tests/dailytest"
"github.com/pingcap/ticdc/tests/util"
"github.com/pingcap/ticdc/tests/integration_tests/dailytest"
"github.com/pingcap/ticdc/tests/integration_tests/util"
)

func main() {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pingcap/parser/mysql"
"github.com/pingcap/ticdc/tests/util"
"github.com/pingcap/ticdc/tests/integration_tests/util"
"go.uber.org/zap/zapcore"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pingcap/ticdc/tests/util"
"github.com/pingcap/ticdc/tests/integration_tests/util"
)

func main() {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (

"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pingcap/ticdc/tests/util"
"github.com/pingcap/ticdc/tests/integration_tests/util"
"go.uber.org/zap"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pingcap/ticdc/pkg/quotes"
"github.com/pingcap/ticdc/tests/util"
"github.com/pingcap/ticdc/tests/integration_tests/util"
"go.uber.org/zap"
"golang.org/x/sync/errgroup"
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"github.com/pingcap/kvproto/pkg/kvrpcpb"
"github.com/pingcap/log"
"github.com/pingcap/parser/model"
"github.com/pingcap/ticdc/tests/util"
"github.com/pingcap/ticdc/tests/integration_tests/util"
"github.com/pingcap/tidb/kv"
"github.com/pingcap/tidb/store/driver"
"github.com/pingcap/tidb/tablecodec"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions tests/run.sh → tests/integration_tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ set -eu

OUT_DIR=/tmp/tidb_cdc_test
CUR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
export PATH=$PATH:$CUR/_utils:$CUR/../bin

echo $PATH
export PATH=$PATH:$CUR/_utils:$CUR/../../bin
mkdir -p $OUT_DIR || true

if [ "${1-}" = '--debug' ]; then
Expand All @@ -14,8 +14,8 @@ if [ "${1-}" = '--debug' ]; then

rm -rf $WORK_DIR && mkdir -p $WORK_DIR

PATH="$CUR/../bin:$CUR/_utils:$PATH" \
LD_LIBRARY_PATH="$CUR/../bin:$CUR/_utils:$PATH" \
PATH="$CUR/../../../bin:$CUR/_utils:$PATH" \
LD_LIBRARY_PATH="$CUR/../../../bin:$CUR/_utils:$PATH" \
OUT_DIR=$OUT_DIR \
TEST_NAME="debug" \
start_tidb_cluster --workdir $WORK_DIR
Expand All @@ -37,8 +37,8 @@ run_case() {
local script=$2
local sink_type=$3
echo "=================>> Running test $script using Sink-Type: $sink_type... <<================="
PATH="$CUR/../bin:$CUR/_utils:$PATH" \
LD_LIBRARY_PATH="$CUR/../bin:$CUR/_utils:$PATH" \
PATH="$CUR/../../../bin:$CUR/_utils:$PATH" \
LD_LIBRARY_PATH="$CUR/../../../bin:$CUR/_utils:$PATH" \
OUT_DIR=$OUT_DIR \
TEST_NAME=$case \
bash "$script" "$sink_type"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/util/db.go → tests/integration_tests/util/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func MustExecWithConn(ctx context.Context, conn *sql.Conn, sql string, args ...i
}

// CreateSourceDBs return source sql.DB for test
// we create two TiDB instance now in tests/run.sh, change it if needed
// we create two TiDB instance now in tests/integration_tests/run.sh, change it if needed
func CreateSourceDBs() (dbs []*sql.DB, err error) {
cfg := DBConfig{
Host: "127.0.0.1",
Expand Down

0 comments on commit a4d46ee

Please sign in to comment.