Skip to content

chore: add configmgr basic tests #88

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

Merged
merged 1 commit into from
Apr 4, 2025
Merged

Conversation

leoparente
Copy link
Contributor

This pull request introduces new test cases for the configmgr package, focusing on the gitConfigManager, localConfigManager, and the manager.New function. The changes primarily involve adding comprehensive unit tests to ensure the proper functioning of these components.

New Tests for configmgr Package:

  • Tests for gitConfigManager:

    • Added a test case TestGitStart to validate the Start method of gitConfigManager. This test includes setting up a temporary Git repository, committing files, and verifying the start process without errors.
  • Tests for localConfigManager:

    • Introduced a test case TestLocalConfigManager to ensure the localConfigManager behaves correctly under different scenarios, including starting with policies, no policies, and missing backend.
  • Tests for manager.New Function:

    • Added a test case TestManagerNew to verify that the New function returns the correct manager implementation based on the configuration. This includes tests for LocalManager, GitManager, and defaulting to LocalManager when an unknown type is provided.

@leoparente leoparente self-assigned this Apr 3, 2025
Copy link

github-actions bot commented Apr 3, 2025

Go test coverage

STATUS ELAPSED PACKAGE COVER PASS FAIL SKIP
🟢 PASS 1.02s github.com/netboxlabs/orb-agent/agent 0.0% 1 0 0
🟢 PASS 0.01s github.com/netboxlabs/orb-agent/agent/backend 0.0% 0 0 0
🟢 PASS 0.01s github.com/netboxlabs/orb-agent/agent/backend/devicediscovery 0.0% 0 0 0
🟢 PASS 0.01s github.com/netboxlabs/orb-agent/agent/backend/networkdiscovery 0.0% 0 0 0
🟢 PASS 0.01s github.com/netboxlabs/orb-agent/agent/backend/otel 0.0% 0 0 0
🟢 PASS 0.00s github.com/netboxlabs/orb-agent/agent/backend/pktvisor 0.0% 0 0 0
🟢 PASS 0.01s github.com/netboxlabs/orb-agent/agent/backend/worker 0.0% 0 0 0
🟢 PASS 1.05s github.com/netboxlabs/orb-agent/agent/configmgr 47.7% 9 0 0
🟢 PASS 1.02s github.com/netboxlabs/orb-agent/agent/policies 100.0% 15 0 0
🟢 PASS 1.03s github.com/netboxlabs/orb-agent/agent/policymgr 70.3% 10 0 0
🟢 PASS 2.48s github.com/netboxlabs/orb-agent/agent/secretsmgr 51.8% 45 0 0
🟢 PASS 1.01s github.com/netboxlabs/orb-agent/agent/version 100.0% 1 0 0

Total coverage: 26.8%

Copy link
Contributor

@jajeffries jajeffries left a comment

Choose a reason for hiding this comment

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

These look like a good starting point. I think we could later build on these to handle more edge cases. Eg. when the selector.yaml file is missing etc

@leoparente leoparente merged commit 3fe7e5b into develop Apr 4, 2025
5 checks passed
@leoparente leoparente deleted the chore/configmgr-test branch April 4, 2025 12:23
Copy link

🎉 This PR is included in version 2.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

2 participants