Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci-subtask: exit ci-subtask.sh when execute ci failed #7766

Merged
merged 7 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ basic-test: install-tools

ci-test-job: install-tools dashboard-ui
@$(FAILPOINT_ENABLE)
./scripts/ci-subtask.sh $(JOB_COUNT) $(JOB_INDEX)
./scripts/ci-subtask.sh $(JOB_COUNT) $(JOB_INDEX) || { $(FAILPOINT_DISABLE); exit 1; }
@$(FAILPOINT_DISABLE)

TSO_INTEGRATION_TEST_PKGS := $(PD_PKG)/tests/server/tso
Expand Down
20 changes: 7 additions & 13 deletions scripts/ci-subtask.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,14 @@ if [[ $2 -gt 10 ]]; then
integrations_dir=./tests/integrations
integrations_tasks=($(find "$integrations_dir" -mindepth 1 -maxdepth 1 -type d))
# Currently, we only have 3 integration tests, so we can hardcode the task index.
for t in ${integrations_tasks[@]}; do
if [[ "$t" = "$integrations_dir/client" && "$2" = 11 ]]; then
for t in "${integrations_tasks[@]}"; do
if [[ "$t" = "$integrations_dir/client" && $2 -eq 11 ]]; then
cd ./client && make ci-test-job && cd .. && cat ./client/covprofile >> covprofile
HuSharp marked this conversation as resolved.
Show resolved Hide resolved
cd $integrations_dir && make ci-test-job test_name=client
cd $ROOT_PATH && cat $integrations_dir/client/covprofile >> covprofile
break
elif [[ "$t" = "$integrations_dir/tso" && "$2" = 12 ]]; then
cd $integrations_dir && make ci-test-job test_name=tso
cd $ROOT_PATH && cat $integrations_dir/tso/covprofile >> covprofile
break
elif [[ "$t" = "$integrations_dir/mcs" && "$2" = 13 ]]; then
cd $integrations_dir && make ci-test-job test_name=mcs
cd $ROOT_PATH && cat $integrations_dir/mcs/covprofile >> covprofile
break
cd $integrations_dir && make ci-test-job test_name=client && cat ./client/covprofile >> "$ROOT_PATH/covprofile" || exit 1
elif [[ "$t" = "$integrations_dir/tso" && $2 -eq 12 ]]; then
cd $integrations_dir && make ci-test-job test_name=tso && cat ./tso/covprofile >> "$ROOT_PATH/covprofile" || exit 1
elif [[ "$t" = "$integrations_dir/mcs" && $2 -eq 13 ]]; then
cd $integrations_dir && make ci-test-job test_name=mcs && cat ./mcs/covprofile >> "$ROOT_PATH/covprofile" || exit 1
fi
done
else
Expand Down
6 changes: 2 additions & 4 deletions tests/integrations/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,19 @@ func TestClientClusterIDCheck(t *testing.T) {
defer cluster2.Destroy()
endpoints2 := runServer(re, cluster2)
// Try to create a client with the mixed endpoints.
cli, err := pd.NewClientWithContext(
_, err = pd.NewClientWithContext(
ctx, append(endpoints1, endpoints2...),
pd.SecurityOption{}, pd.WithMaxErrorRetry(1),
)
re.Error(err)
defer cli.Close()
re.Contains(err.Error(), "unmatched cluster id")
// updateMember should fail due to unmatched cluster ID found.
re.NoError(failpoint.Enable("github.com/tikv/pd/client/skipClusterIDCheck", `return(true)`))
re.NoError(failpoint.Enable("github.com/tikv/pd/client/skipFirstUpdateMember", `return(true)`))
cli, err = pd.NewClientWithContext(ctx, []string{endpoints1[0], endpoints2[0]},
_, err = pd.NewClientWithContext(ctx, []string{endpoints1[0], endpoints2[0]},
pd.SecurityOption{}, pd.WithMaxErrorRetry(1),
)
re.Error(err)
defer cli.Close()
re.Contains(err.Error(), "ErrClientGetMember")
re.NoError(failpoint.Disable("github.com/tikv/pd/client/skipFirstUpdateMember"))
re.NoError(failpoint.Disable("github.com/tikv/pd/client/skipClusterIDCheck"))
Expand Down
2 changes: 1 addition & 1 deletion tests/integrations/client/client_tls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ func testTLSReload(
CertPath: testClientTLSInfo.CertFile,
KeyPath: testClientTLSInfo.KeyFile,
}, pd.WithGRPCDialOptions(grpc.WithBlock()))
cli.Close()
if err != nil {
errc <- err
dcancel()
return
}
cli.Close()
dcancel()
}
}()
Expand Down
12 changes: 9 additions & 3 deletions tests/integrations/client/http_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,12 @@ func (suite *httpClientTestSuite) checkConfig(mode mode, client pd.Client) {
resp, err := env.cluster.GetEtcdClient().Get(env.ctx, sc.TTLConfigPrefix+"/schedule.leader-schedule-limit")
re.NoError(err)
re.Equal([]byte("16"), resp.Kvs[0].Value)
// delete the config with TTL.
err = client.SetConfig(env.ctx, newConfig, 0)
re.NoError(err)
resp, err = env.cluster.GetEtcdClient().Get(env.ctx, sc.TTLConfigPrefix+"/schedule.leader-schedule-limit")
re.NoError(err)
re.Empty(resp.Kvs)
}

func (suite *httpClientTestSuite) TestScheduleConfig() {
Expand All @@ -520,14 +526,14 @@ func (suite *httpClientTestSuite) checkScheduleConfig(mode mode, client pd.Clien

config, err := client.GetScheduleConfig(env.ctx)
re.NoError(err)
re.Equal(float64(4), config["leader-schedule-limit"])
re.Equal(float64(4), config["hot-region-schedule-limit"])
HuSharp marked this conversation as resolved.
Show resolved Hide resolved
re.Equal(float64(2048), config["region-schedule-limit"])
config["leader-schedule-limit"] = float64(8)
config["hot-region-schedule-limit"] = float64(8)
err = client.SetScheduleConfig(env.ctx, config)
re.NoError(err)
config, err = client.GetScheduleConfig(env.ctx)
re.NoError(err)
re.Equal(float64(8), config["leader-schedule-limit"])
re.Equal(float64(8), config["hot-region-schedule-limit"])
re.Equal(float64(2048), config["region-schedule-limit"])
}

Expand Down