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

*: make TestConfig stable #7463

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/dashboard/adapter/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"sync"
"time"

"github.com/pingcap/failpoint"
"github.com/pingcap/kvproto/pkg/pdpb"
"github.com/pingcap/log"
"github.com/pingcap/tidb-dashboard/pkg/apiserver"
Expand Down Expand Up @@ -75,6 +76,10 @@ func (m *Manager) Stop() {
func (m *Manager) serviceLoop() {
defer logutil.LogPanic()
defer m.wg.Done()
// TODO: After we fix the atomic problem of config, we can remove this failpoint.
failpoint.Inject("skipDashboardLoop", func() {
failpoint.Return()
})

ticker := time.NewTicker(CheckInterval)
defer ticker.Stop()
Expand Down
3 changes: 3 additions & 0 deletions tests/pdctl/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"time"

"github.com/coreos/go-semver/semver"
"github.com/pingcap/failpoint"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
Expand Down Expand Up @@ -60,8 +61,10 @@ func TestConfigTestSuite(t *testing.T) {
}

func (suite *configTestSuite) TestConfig() {
suite.NoError(failpoint.Enable("github.com/tikv/pd/pkg/dashboard/adapter/skipDashboardLoop", `return(true)`))
env := tests.NewSchedulingTestEnvironment(suite.T())
env.RunTestInTwoModes(suite.checkConfig)
suite.NoError(failpoint.Disable("github.com/tikv/pd/pkg/dashboard/adapter/skipDashboardLoop"))
}

func (suite *configTestSuite) checkConfig(cluster *tests.TestCluster) {
Expand Down
Loading