X-lab2017 / open-digger

Open source analysis tools
https://open-digger.cn
Apache License 2.0
291 stars 86 forks source link

add the test data and script #1359

Closed Zzzzzhuzhiwei closed 1 year ago

Zzzzzhuzhiwei commented 1 year ago

In this issue #1266, I get the data of these seven metrics, and write the script to make sure the data is right.

Zzzzzhuzhiwei commented 1 year ago

Now I put the testdata folder under the test folder and first generate the SQL and results of issueClosed.

frank-zsy commented 1 year ago

Yes, this is exactly that I mean. And we definitely should design the naming rule here. I think we can all use underscore naming style. And all the parameters should be included in the file name to make sure no file data conflicts.

Zzzzzhuzhiwei commented 1 year ago

Do the file names and parameters in the file both need to use underscore naming style,and does the file name need to contain the parameters: OrgID, limit, startyear, startmonth, endyear, endmonth and groupTimeRange?

frank-zsy commented 1 year ago

Do the file names and parameters in the file both need to use underscore naming style,and does the file name need to contain the parameters: OrgID, limit, startyear, startmonth, endyear, endmonth and groupTimeRange?

It depends on what we need to test. Org id is not necessary, year and month may not need to be included, just set to a constant is OK. But groupTimeRange is surely needed, and order, limit, limit type, group type(repo, org, label) are all needed.

Zzzzzhuzhiwei commented 1 year ago

issueClosed_desc_3_all_repo_month.json ,from front to back are metric, order, limit, limitoption, groupby, groupTimeRange. Is this file naming format acceptable?

frank-zsy commented 1 year ago

issue_closed_... is better, I think the metrics naming can be changed to underscore style too.

Zzzzzhuzhiwei commented 1 year ago

I will temporarily set the order to desc and the limitOption to all to generate the metric results, in order to avoid uncertainty in the results.

frank-zsy commented 1 year ago

That's OK, actually for some metrics with the problem, we can skip for now.

Zzzzzhuzhiwei commented 1 year ago

I have added the testdata with determined results into files.

Zzzzzhuzhiwei commented 1 year ago

Hi @frank-zsy , could you please review my PR? Your feedback would be greatly appreciated!

frank-zsy commented 1 year ago

@Zzzzzhuzhiwei Sure, I will review this PR today.

frank-zsy commented 1 year ago

@Zzzzzhuzhiwei Actually we are already now using mocha and ts extension to run the unit tests, so can you change the js file to ts, because right now your test file are not running in npm test command.

Zzzzzhuzhiwei commented 1 year ago

Thank you for your suggestion, I will change the js file to ts today.

Zzzzzhuzhiwei commented 1 year ago

hi @frank-zsy, I have changed the js file to ts, and my test file are running in npm test command. Thank you for your guidance very much!

frank-zsy commented 1 year ago

@Zzzzzhuzhiwei The result looks good, I think you can delete the old metrics.test.ts and rename the new file to metrics.test.ts.

frank-zsy commented 1 year ago

All looks good now, thanks for the contribution~

/approve