Skip to content

Add Unit Tests for logs Package #1226

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

ravjot07
Copy link
Contributor

@ravjot07 ravjot07 commented Feb 6, 2025

  • Introduced logs_test.go to systematically validate core functions in logs.go.
  • Used httptest.NewServer to mock API responses for GetJson and SetLoggerLevel.
  • Captured os.Stdout to verify expected CLI outputs.

Contributes towards #991

@kmesh-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hzxuzhonghu for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@@ -0,0 +1,106 @@
package logs_test
Copy link
Collaborator

Choose a reason for hiding this comment

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

Need CopyRight

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okiee I will add copyright text

@YaoZengzeng
Copy link
Member

@ravjot07 please fix CI, it seems to be an issue with kmeshctl doc, which should be fixed in #1217

Also sign off every commits to make DOC happy :)

}

// TestSetLoggerLevel_Success checks the normal flow of SetLoggerLevel (no exit).
func TestSetLoggerLevel_Success(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

No TestSetLoggerLevel_Failure ? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup i am working on this

@ravjot07
Copy link
Contributor Author

ravjot07 commented Feb 9, 2025

@ravjot07 please fix CI, it seems to be an issue with kmeshctl doc, which should be fixed in #1217

Also sign off every commits to make DOC happy :)

sure i will fix this

@ravjot07
Copy link
Contributor Author

ravjot07 commented Feb 9, 2025

@ravjot07 please fix CI, it seems to be an issue with kmeshctl doc, which should be fixed in #1217

Also sign off every commits to make DOC happy :)

Hey, @YaoZengzeng, i am interested in eBPF unit test Project for LFX this term, can you guide me through process.. give me some resources so i can study this process... or provide some issue for me to work on so i can show my candidacy...

@YaoZengzeng
Copy link
Member

@ravjot07 please fix CI, it seems to be an issue with kmeshctl doc, which should be fixed in #1217
Also sign off every commits to make DOC happy :)

Hey, @YaoZengzeng, i am interested in eBPF unit test Project for LFX this term, can you guide me through process.. give me some resources so i can study this process... or provide some issue for me to work on so i can show my candidacy...

sorry, I'm responsible for e2e related lfx project, ref: #1210 .

If you're interested in eBPF unit test, you could ask @bitcoffeeiux ([email protected]) for help :)

@harshitghagre
Copy link

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants