Skip to content

Commit

Permalink
fix failpoint interm.
Browse files Browse the repository at this point in the history
  • Loading branch information
3AceShowHand committed Nov 9, 2021
1 parent 99b1612 commit 40d54e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cdc/sink/mq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (s mqSinkSuite) TestKafkaSink(c *check.C) {
opts := map[string]string{}
errCh := make(chan error, 1)

c.Assert(failpoint.Enable("github.com/pingcap/ticdc/cdc/sink/producer/kafka/workaround4Test", "return(nil)"), check.IsNil)
c.Assert(failpoint.Enable("github.com/pingcap/ticdc/cdc/sink/producer/kafka/workaround4Test", "return(true)"), check.IsNil)
defer func() {
_ = failpoint.Disable("github.com/pingcap/ticdc/cdc/sink/producer/kafka/workaround4Test")
}()
Expand Down Expand Up @@ -168,7 +168,7 @@ func (s mqSinkSuite) TestKafkaSinkFilter(c *check.C) {
opts := map[string]string{}
errCh := make(chan error, 1)

c.Assert(failpoint.Enable("github.com/pingcap/ticdc/cdc/sink/producer/kafka/workaround4Test", "return(nil)"), check.IsNil)
c.Assert(failpoint.Enable("github.com/pingcap/ticdc/cdc/sink/producer/kafka/workaround4Test", "return(true)"), check.IsNil)
defer func() {
_ = failpoint.Disable("github.com/pingcap/ticdc/cdc/sink/producer/kafka/workaround4Test")
}()
Expand Down
8 changes: 4 additions & 4 deletions cdc/sink/producer/kafka/kafka_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (s *kafkaSuite) TestSaramaProducer(c *check.C) {
cfg.Producer.Flush.MaxMessages = 1
return cfg, err
}
c.Assert(failpoint.Enable("github.com/pingcap/ticdc/cdc/sink/producer/kafka/workaround4Test", "return(nil)"), check.IsNil)
c.Assert(failpoint.Enable("github.com/pingcap/ticdc/cdc/sink/producer/kafka/workaround4Test", "return(true)"), check.IsNil)
defer func() {
newSaramaConfigImpl = newSaramaConfigImplBak
_ = failpoint.Disable("github.com/pingcap/ticdc/cdc/sink/producer/kafka/workaround4Test")
Expand Down Expand Up @@ -407,7 +407,7 @@ func (s *kafkaSuite) TestCreateProducerFailed(c *check.C) {
config.Version = "invalid"
config.BrokerEndpoints = []string{"127.0.0.1:1111"}
config.TopicName = "topic"
c.Assert(failpoint.Enable("github.com/pingcap/ticdc/cdc/sink/producer/kafka/workaround4Test", "return(nil)"), check.IsNil)
c.Assert(failpoint.Enable("github.com/pingcap/ticdc/cdc/sink/producer/kafka/workaround4Test", "return(true)"), check.IsNil)
_, err := NewKafkaSaramaProducer(ctx, config, errCh)
c.Assert(errors.Cause(err), check.ErrorMatches, "invalid version.*")
_ = failpoint.Disable("github.com/pingcap/ticdc/cdc/sink/producer/kafka/workaround4Test")
Expand Down Expand Up @@ -438,7 +438,7 @@ func (s *kafkaSuite) TestProducerSendMessageFailed(c *check.C) {
config.BrokerEndpoints = strings.Split(leader.Addr(), ",")
config.TopicName = topic

c.Assert(failpoint.Enable("github.com/pingcap/ticdc/cdc/sink/producer/kafka/workaround4Test", "return(nil)"), check.IsNil)
c.Assert(failpoint.Enable("github.com/pingcap/ticdc/cdc/sink/producer/kafka/workaround4Test", "return(true)"), check.IsNil)

newSaramaConfigImplBak := newSaramaConfigImpl
newSaramaConfigImpl = func(ctx context.Context, config *Config) (*sarama.Config, error) {
Expand Down Expand Up @@ -517,7 +517,7 @@ func (s *kafkaSuite) TestProducerDoubleClose(c *check.C) {
config.BrokerEndpoints = strings.Split(leader.Addr(), ",")
config.TopicName = topic

c.Assert(failpoint.Enable("github.com/pingcap/ticdc/cdc/sink/producer/kafka/workaround4Test", "return(nil)"), check.IsNil)
c.Assert(failpoint.Enable("github.com/pingcap/ticdc/cdc/sink/producer/kafka/workaround4Test", "return(true)"), check.IsNil)

errCh := make(chan error, 1)
producer, err := NewKafkaSaramaProducer(ctx, config, errCh)
Expand Down

0 comments on commit 40d54e2

Please sign in to comment.