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

Fix some tests that would fail with existing env vars #772

Merged

Conversation

bcrochet
Copy link
Contributor

Some of the unit tests would fail if KUBECONFIG or PFLT_INDEXIMAGE
were already present in the environment. This patch cleans those up
a bit by checking for the existence, clearing them when required, and
cleaning up appropriately after the test is run.

This also includes minor renaming of some of the test suites, as they
overlapped, and it was confusing where the error was actually coming
from.

Signed-off-by: Brad P. Crochet brad@redhat.com

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 22, 2022
@coveralls
Copy link

coveralls commented Aug 22, 2022

Coverage Status

Coverage remained the same at 84.494% when pulling 41725c6 on bcrochet:fix-kubeconfig-test into 4c11c2a on redhat-openshift-ecosystem:main.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 22, 2022
@@ -15,6 +16,10 @@ var _ = Describe("Viper to Runtime Config", func() {
baseViperCfg = viper.New()
expectedRuntimeCfg = &Config{}

if val, ok := os.LookupEnv("KUBECONFIG"); ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: good to merge without this change.

Suggested change
if val, ok := os.LookupEnv("KUBECONFIG"); ok {
if val, isSet := os.LookupEnv("KUBECONFIG"); isSet {

Copy link
Contributor

Choose a reason for hiding this comment

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

Happens in a couple of places, but because it's a nit, I'm only mentioning it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

Copy link
Contributor

@komish komish left a comment

Choose a reason for hiding this comment

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

/lgtm

Some of the unit tests would fail if KUBECONFIG or PFLT_INDEXIMAGE
were already present in the environment. This patch cleans those up
a bit by checking for the existence, clearing them when required, and
cleaning up appropriately after the test is run.

This also includes minor renaming of some of the test suites, as they
overlapped, and it was confusing where the error was actually coming
from.

Signed-off-by: Brad P. Crochet <brad@redhat.com>
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 22, 2022
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 22, 2022
@openshift-ci
Copy link

openshift-ci bot commented Aug 22, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: acornett21, bcrochet, komish, skattoju

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:
  • OWNERS [acornett21,bcrochet,komish,skattoju]

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

@bcrochet bcrochet merged commit c5b1bce into redhat-openshift-ecosystem:main Aug 22, 2022
@bcrochet bcrochet deleted the fix-kubeconfig-test branch June 6, 2023 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants