-
Notifications
You must be signed in to change notification settings - Fork 287
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
script(cdc): don't check line width for test files #4872
Conversation
Signed-off-by: lance6716 <[email protected]>
[REVIEW NOTIFICATION] This pull request has not been approved. To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally feel that the test needs to be kept at normal width as well. It is no different from the core code. Both need to ensure good readability. But if you have a strong opinion about it, I'm ok with that.
I made some test file changes like this expected: &preparedDMLs{
- sqls: []string{"DELETE FROM `common_1`.`uk_without_pk` WHERE `a1` = ? AND `a3` = ? LIMIT 1;"},
+ sqls: []string{"DELETE FROM `common_1`.`uk_without_pk` WHERE `a1` = ? AND `a3` = ? LIMIT 1"},
values: [][]interface{}{{1, 1}},
rowCount: 1,
}, That's not very easy to find a good layout to pass the CI |
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## master #4872 +/- ##
================================================
+ Coverage 55.6402% 56.0251% +0.3849%
================================================
Files 494 522 +28
Lines 61283 65160 +3877
================================================
+ Hits 34098 36506 +2408
- Misses 23750 25084 +1334
- Partials 3435 3570 +135 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally feel that the test needs to be kept at normal width as well. It is no different from the core code. Both need to ensure good readability. But if you have a strong opinion about it, I'm ok with that.
Agree, without width limit, we may write tests like crazy long, see
tiflow/dm/loader/convert_data_test.go
Lines 64 to 69 in 1e8f99f
expected := []string{ | |
// nolint:stylecheck | |
`INSERT INTO t VALUES(585520728116297738,1,9223372036854775807,123.123,123456789012.1234567890120000000,"\0\0\0\0\0\0\0A","1000-01-01","9999-12-31 23:59:59","1973-12-30 15:30:00","23:59:59",1970,"x","x\"x","blob","text","enum2","a,b"),(585520728116297737,1,9223372036854775807,123.123,123456789012.1234567890120000000,"\0\0\0\0\0\0\0A","1000-01-01","9999-12-31 23:59:59","1973-12-30 15:30:00","23:59:59",1970,"x","x\",\nx","blob","text","enum2","a,b"),(585520728116297736,1,9223372036854775807,123.123,123456789012.1234567890120000000,"\0\0\0\0\0\0\0A","1000-01-01","9999-12-31 23:59:59","1973-12-30 15:30:00","23:59:59",1970,"x","x\",\nx","blob","�text\n","enum2"," a,b ");`, | |
// nolint:stylecheck | |
`INSERT INTO t VALUES(10,1,9223372036854775807,123.123,123456789012.1234567890120000000,"\0\0\0\0\0\0\0A","1000-01-01","9999-12-31 23:59:59","1973-12-30 15:30:00","23:59:59",1970,"test:x","x\"x","blob","text","enum2","a,b"),(9,1,9223372036854775807,123.123,123456789012.1234567890120000000,"\0\0\0\0\0\0\0A","1000-01-01","9999-12-31 23:59:59","1973-12-30 15:30:00","23:59:59",1970,"test:x","x\",\nx","blob","text","enum2","a,b"),(8,1,9223372036854775807,123.123,123456789012.1234567890120000000,"\0\0\0\0\0\0\0A","1000-01-01","9999-12-31 23:59:59","1973-12-30 15:30:00","23:59:59",1970,"test:x","x\",\nx","blob","�text\n","enum2"," a,b ");`, | |
} |
tiflow/pkg/orchestrator/reactor_state_test.go
Lines 61 to 68 in 1e8f99f
updateValue: []string{ | |
`{"sink-uri":"blackhole://","opts":{},"create-time":"2020-02-02T00:00:00.000000+00:00","start-ts":421980685886554116,"target-ts":0,"admin-job-type":0,"sort-engine":"memory","sort-dir":"","config":{"case-sensitive":true,"enable-old-value":false,"force-replicate":false,"check-gc-safe-point":true,"filter":{"rules":["*.*"],"ignore-txn-start-ts":null,"ddl-allow-list":null},"mounter":{"worker-num":16},"sink":{"dispatchers":null,"protocol":"open-protocol"},"cyclic-replication":{"enable":false,"replica-id":0,"filter-replica-ids":null,"id-buckets":0,"sync-ddl":false},"scheduler":{"type":"table-number","polling-time":-1},"consistent":{"level":"normal","storage":"local"}},"state":"normal","history":null,"error":null,"sync-point-enabled":false,"sync-point-interval":600000000000}`, | |
`{"resolved-ts":421980720003809281,"checkpoint-ts":421980719742451713,"admin-job-type":0}`, | |
`{"checkpoint-ts":421980720003809281,"resolved-ts":421980720003809281,"count":0,"error":null}`, | |
`{"tables":{"45":{"start-ts":421980685886554116,"mark-table-id":0}},"operation":null,"admin-job-type":0}`, | |
`{"45":{"workload":1}}`, | |
`{"id":"6bbc01c8-0605-4f86-a0f9-b3119109b225","address":"127.0.0.1:8300"}`, | |
}, |
ok, I will use str+str to split the long string literal in my original pr. |
try SQL formatter https://www.dpriver.com/pp/sqlformat.htm longLongLongSQL := `
DELETE FROM `common_1`.`uk_without_pk`
WHERE `a1` = ?
AND `a3` = ?
LIMIT 1` |
Signed-off-by: lance6716 [email protected]
What problem does this PR solve?
Issue Number: ref #4287
What is changed and how it works?
When I write tests, I think a long string literal (like generated SQL) is good to read. But it can't pass CI.
Check List
Tests
Release note