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

chore: add unit testcases for files in Text format. #2274

Merged
merged 10 commits into from
Mar 12, 2024

Conversation

Electronic-Waste
Copy link
Member

What this PR does / why we need it:

Add unit test cases for files in Text format in file-metricscollector_test.go, including:

  1. "Positive case for logs in TEXT format" test case
  2. "Invalid file name" test case
  3. "Invalid file format" test case
  4. "Invalid timestamp for logs in TEXT format" test case
  5. "Missing objective metric in training logs" test case

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1756

Checklist:

  • Docs included if any changes are user facing

Signed-off-by: Electronic-Waste <2690692950@qq.com>
@Electronic-Waste
Copy link
Member Author

Electronic-Waste commented Mar 5, 2024

The newly added code obeys the rules in Developer Guide.

@Electronic-Waste
Copy link
Member Author

截屏2024-03-05 23 05 13

All unit test cases passed.

@tenzen-y
Copy link
Member

tenzen-y commented Mar 5, 2024

/cc @tenzen-y

@google-oss-prow google-oss-prow bot requested a review from tenzen-y March 5, 2024 15:07
Signed-off-by: Electronic-Waste <2690692950@qq.com>
Copy link
Member

@tenzen-y tenzen-y left a comment

Choose a reason for hiding this comment

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

My first pass.

Signed-off-by: Electronic-Waste <2690692950@qq.com>
"Positive case for logs in TEXT format": {
filePath: filepath.Join(testTextDataPath, "good.log"),
metrics: []string{"accuracy", "loss"},
filters: []string{"{metricName: ([\\w|-]+), metricValue: ((-?\\d+)(\\.\\d+)?)}"},
Copy link
Member

Choose a reason for hiding this comment

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

As we mentioned in the issue, our motivation is to verify if this filter works fine to avoid bugs like this: #1754

We should add unit test for our File Metrics Collector to verify log parsing.
That will help to avoid issues similar to: #1754

So, could you add more than valid and invalid cases?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I'll do it later.

Copy link
Member Author

Choose a reason for hiding this comment

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

Some new test cases similar to bugs in #1754 have been added to the test file.

Signed-off-by: Electronic-Waste <2690692950@qq.com>
Signed-off-by: Electronic-Waste <2690692950@qq.com>
Signed-off-by: Electronic-Waste <2690692950@qq.com>
Copy link
Member

@tenzen-y tenzen-y left a comment

Choose a reason for hiding this comment

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

LGTM
Thanks!

/lgtm
/approve
/hold
for Ci

@kubeflow/wg-automl-leads Could you approve CI?

@Electronic-Waste
Copy link
Member Author

Electronic-Waste commented Mar 10, 2024

It seems that CI does not start yet...Is it manipulated by someone?

@andreyvelich
Copy link
Member

Thank you for this @Electronic-Waste, I will review PR on Monday. I triggered CI.
/assign @andreyvelich

@Electronic-Waste
Copy link
Member Author

Thank you for this @Electronic-Waste, I will review PR on Monday. I triggered CI. /assign @andreyvelich

@andreyvelich Okay, thx for your clarification.

Signed-off-by: Electronic-Waste <2690692950@qq.com>
Comment on lines +56 to +59
if err := generateJSONTestFiles(); err != nil {
t.Fatal(err)
}
if err := generateTEXTTestFiles(); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Did you push the commit? I can still see 2 separate functions.

Copy link
Member Author

@Electronic-Waste Electronic-Waste Mar 12, 2024

Choose a reason for hiding this comment

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

Yes, I pushed the commit. I just integrated dir creation & deletion operations into functions. Test file generation is not included since it's not necessary.

Signed-off-by: Electronic-Waste <2690692950@qq.com>
@Electronic-Waste
Copy link
Member Author

@andreyvelich Is there anything else wrong with this PR? I can modify them soon.

Copy link
Member

@andreyvelich andreyvelich left a comment

Choose a reason for hiding this comment

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

Thank you for the updates @Electronic-Waste!
Congratulation with your first contribution to Kubeflow 🎉

/lgtm
/assign @tenzen-y @johnugeorge

@andreyvelich
Copy link
Member

andreyvelich commented Mar 12, 2024

/hold for CI/CD and review from @tenzen-y and @johnugeorge

@Electronic-Waste
Copy link
Member Author

I'm glad to see that my first PR is going to be merged!
It's a nice experience collaborating with you @andreyvelich @tenzen-y .

@andreyvelich
Copy link
Member

@google-oss-prow google-oss-prow bot removed the lgtm label Mar 12, 2024
@Electronic-Waste
Copy link
Member Author

@andreyvelich I see. The new commit is added to this PR.

Signed-off-by: Electronic-Waste <2690692950@qq.com>
@Electronic-Waste
Copy link
Member Author

@andreyvelich A new commit is added to the PR. Sorry for my mistake.

@andreyvelich
Copy link
Member

andreyvelich commented Mar 12, 2024

Tests were succeeded!
/lgtm
/assign @tenzen-y @johnugeorge

@google-oss-prow google-oss-prow bot added the lgtm label Mar 12, 2024
Copy link
Member

@tenzen-y tenzen-y left a comment

Choose a reason for hiding this comment

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

Generally, lgtm

Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Electronic-Waste, tenzen-y

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit 5837b8a into kubeflow:master Mar 12, 2024
59 checks passed
@Electronic-Waste Electronic-Waste deleted the issue-1756 branch March 14, 2024 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add unit tests for File Metrics Collector
4 participants