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

test: ci unit test #4

Merged
merged 2 commits into from
Jan 6, 2025
Merged

test: ci unit test #4

merged 2 commits into from
Jan 6, 2025

Conversation

luohoufu
Copy link
Contributor

@luohoufu luohoufu commented Jan 6, 2025

What does this PR do

This pull request includes several changes to the GitHub Actions workflow and various improvements to the Go codebase, including bug fixes, code refactoring, and adding new functionality.

GitHub Actions Workflow:

  • Added a new GitHub Actions workflow to run unit tests on pull requests to the main branch. This workflow sets up the Go toolchain and runs unit tests using a make command. (.github/workflows/unit_test.yml)

Code Improvements:

  • Refactored error messages in the getAppConfig function to use formatted strings, improving readability and consistency. (plugin/api/discover.go)
  • Added a new function getPortByPid to retrieve listening ports for a given process ID, enhancing the functionality of the parseESPort function. (plugin/elastic/esinfo.go)

Code Cleanup:

  • Removed unused imports and reorganized import statements for better code clarity and maintainability. (plugin/api/discover.go, plugin/elastic/esinfo.go) [1] [2] [3]
  • Skipped a test in esinfo_test.go to prevent it from running, likely due to it being incomplete or not relevant for the current changes. (plugin/elastic/esinfo_test.go)

Rationale for this change

Standards checklist

  • The PR title is descriptive
  • The commit messages are semantic
  • Necessary tests are added
  • Updated the release notes
  • Necessary documents have been added if this is a new feature
  • Performance tests checked, no obvious performance degradation

@luohoufu luohoufu requested review from medcl and silenceqi and removed request for medcl January 6, 2025 07:08
@@ -154,6 +159,56 @@ func parseESPort(infos []string) []int {
return getPortByPid(pid)
}

func getPortByPid(pid string) []int {
Copy link
Member

Choose a reason for hiding this comment

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

this seems not related to test, if it is a feature or a fix, you should raise another PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just add the missing function to pass test. need check where use the esinfo

@luohoufu luohoufu merged commit b62994e into main Jan 6, 2025
3 checks passed
@luohoufu luohoufu deleted the unit_test branch January 6, 2025 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants