Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

release mysql dependence in syncer test (1) #209

Merged
merged 8 commits into from
Aug 1, 2019

Conversation

3pointer
Copy link
Contributor

@3pointer 3pointer commented Jul 19, 2019

What problem does this PR solve?

Release mysql dependencies in syncer test, this is the first part change, there are 4 syncer tests remain mysql dependencies need to realease, and I'll finish them in other PR.

What is changed and how it works?

use sql mock and mock binlog events in pkg/binlog/event

Check List

Tests

  • Unit test
  • Integration test

@3pointer
Copy link
Contributor Author

/run-all-tests

@3pointer 3pointer added priority/unimportant Really minor change, requires approval from secondary reviewers type/qa relate to quality assurance status/PTAL This PR is ready for review. Add this label back after committing new changes type/test Changes related to test cases labels Jul 19, 2019
@3pointer
Copy link
Contributor Author

/run-all-tests

1 similar comment
@3pointer
Copy link
Contributor Author

/run-all-tests

@codecov
Copy link

codecov bot commented Jul 19, 2019

Codecov Report

Merging #209 into master will decrease coverage by 0.1053%.
The diff coverage is 66.6666%.

@@              Coverage Diff               @@
##             master     #209        +/-   ##
==============================================
- Coverage   58.9954%   58.89%   -0.1054%     
==============================================
  Files           123      123                
  Lines         14335    14055       -280     
==============================================
- Hits           8457     8277       -180     
+ Misses         5008     4948        -60     
+ Partials        870      830        -40

@3pointer
Copy link
Contributor Author

/run-all-tests

3 similar comments
@3pointer
Copy link
Contributor Author

/run-all-tests

@3pointer
Copy link
Contributor Author

/run-all-tests

@3pointer
Copy link
Contributor Author

/run-all-tests

@3pointer
Copy link
Contributor Author

/run-all-tests

previousGTIDSetStr := "3ccc475b-2343-11e7-be21-6c0b84d59f30:1-14,406a3f61-690d-11e7-87c5-6c92bf46f384:1-94321383"
previousGTIDSet, err := gtid.ParserGTID(s.cfg.Flavor, previousGTIDSetStr)
if err != nil {
log.L().Fatal("", zap.Error(err))
Copy link
Collaborator

@IANTHEREAL IANTHEREAL Jul 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better to use check.FailNow/Fatalf to stop unit test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -80,11 +84,26 @@ func (s *testSyncerSuite) SetUpSuite(c *C) {

s.resetMaster()
Copy link
Collaborator

@IANTHEREAL IANTHEREAL Jul 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still need to leave them?

s.resetMaster()
s.resetBinlogSyncer()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some tests still use them, but I will remove them eventually in other PRs

@@ -222,33 +243,117 @@ func (s *testSyncerSuite) TestSelectTable(c *C) {
{Schema: "~^ptest*", Name: "~^t.*"},
},
}
s.resetEventsGenerator()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can define a more generic object to represent the test case, like

type binlogEvents []binlogEvent
type binlogEvent struct {
  typ string
  arguments []interface{}
}

and an events generation function

function testGenerateEvent(binlogEvents) []*replication.BinlogEvent

they would save many codes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@IANTHEREAL
Copy link
Collaborator

Rest LGTM

syncer/syncer_test.go Outdated Show resolved Hide resolved
syncer/syncer_test.go Outdated Show resolved Hide resolved
@3pointer
Copy link
Contributor Author

/run-all-tests

@3pointer
Copy link
Contributor Author

/run-all-tests

syncer/syncer_test.go Outdated Show resolved Hide resolved
syncer/syncer_test.go Outdated Show resolved Hide resolved
syncer/syncer_test.go Outdated Show resolved Hide resolved
syncer/syncer_test.go Outdated Show resolved Hide resolved
syncer/syncer_test.go Outdated Show resolved Hide resolved
@3pointer
Copy link
Contributor Author

/run-all-tests

2 similar comments
@3pointer
Copy link
Contributor Author

/run-all-tests

@3pointer
Copy link
Contributor Author

/run-all-tests

Copy link
Contributor

@amyangfei amyangfei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@amyangfei amyangfei added status/LGT1 One reviewer already commented LGTM and removed status/PTAL This PR is ready for review. Add this label back after committing new changes labels Aug 1, 2019
@IANTHEREAL
Copy link
Collaborator

Good Job!LGTM

@IANTHEREAL IANTHEREAL merged commit 6956e53 into pingcap:master Aug 1, 2019
@IANTHEREAL IANTHEREAL added status/LGT2 Two reviewers already commented LGTM, ready for merge and removed status/LGT1 One reviewer already commented LGTM labels Aug 1, 2019
@3pointer 3pointer deleted the syncer_mock_test branch August 1, 2019 02:27
lichunzhu pushed a commit to lichunzhu/dm that referenced this pull request Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority/unimportant Really minor change, requires approval from secondary reviewers status/LGT2 Two reviewers already commented LGTM, ready for merge type/qa relate to quality assurance type/test Changes related to test cases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants