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

Tests for reconcilers #35

Closed
jpkrohling opened this issue Aug 19, 2020 · 7 comments · Fixed by #250 or #261
Closed

Tests for reconcilers #35

jpkrohling opened this issue Aug 19, 2020 · 7 comments · Fixed by #250 or #261
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest

Comments

@jpkrohling
Copy link
Member

The reconcilers (pkg/collector/reconcile) are currently untested. This issue is to track building the unit tests for them.

@jpkrohling jpkrohling added enhancement New feature or request good first issue Good for newcomers labels Aug 19, 2020
@jpkrohling jpkrohling assigned jpkrohling and unassigned jpkrohling Aug 19, 2020
@jpkrohling
Copy link
Member Author

@treasurechristain, would you like to give this one a try?

@amadikwajoyn
Copy link
Contributor

OK, let me try it out

@amadikwajoyn
Copy link
Contributor

@jpkrohling please what are my expected to do here.

@jpkrohling
Copy link
Member Author

We have a package that has no test coverage at all:

https://github.com/open-telemetry/opentelemetry-operator/blob/master/pkg/collector/reconcile/

This task here is about creating tests for the code in that package. For instance, for pkg/collector/reconcile/configmap.go, we'll need to:

  1. test that desiredConfigMap() returns a config map with a collector.yaml entry in it (you can/should also assert that it contains a label with the component's name)
  2. test that expectedConfigMaps() creates new config maps if they don't exist yet in the cluster
  3. test that expectedConfigMaps() updates an existing configmap if it exists already in the cluster
  4. test the error conditions that can be reached by expectedConfigMaps
  5. test that deleteConfigMaps() deletes configmaps that might have been part of a previous state
  6. test one or two of the scenarios above in a bigger context (ConfigMaps())

You can take a look at the tests in pkg/collector/upgrade/upgrade_test.go for reference for tests that need to interact with the underlying Kubernetes events (save/delete/update/list).

Let me know if you need further clarification.

@amadikwajoyn
Copy link
Contributor

I'm currently working on it. I will notify you when i'm done

@gramidt
Copy link
Member

gramidt commented Jan 23, 2021

@amadikwajoyn - Any progress on this?

@bhiravabhatla
Copy link
Contributor

@jpkrohling I would like to take a stab at this after I am done with reload config PR if it's ok?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest
Projects
None yet
4 participants