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

openstack: Fix nil HostManager in openstackContext #610

Merged

Conversation

zeeke
Copy link
Member

@zeeke zeeke commented Feb 1, 2024

Refactoring in [1] left the openstackContext uninitialized, making the config-daemon crash on OpenStack deployments.

This error has been caught in Openshift downstream CI [2]

[1] #553
[2] openshift/sriov-network-operator#882 (comment)

cc @SchSeba, @EmilienM

Copy link

github-actions bot commented Feb 1, 2024

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@coveralls
Copy link

coveralls commented Feb 1, 2024

Pull Request Test Coverage Report for Build 7755661276

  • -7 of 7 (0.0%) changed or added relevant lines in 2 files are covered.
  • 9 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.08%) to 25.831%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/platforms/platforms.go 0 3 0.0%
pkg/platforms/openstack/openstack.go 0 4 0.0%
Files with Coverage Reduction New Missed Lines %
pkg/platforms/openstack/openstack.go 1 19.12%
controllers/sriovibnetwork_controller.go 2 68.94%
api/v1/helper.go 6 42.16%
Totals Coverage Status
Change from base Build 7754000139: -0.08%
Covered Lines: 2905
Relevant Lines: 11246

💛 - Coveralls

@EmilienM
Copy link
Contributor

EmilienM commented Feb 1, 2024

nicely found, thanks @zeeke , as usual!
LGTM

@@ -103,7 +104,11 @@ type OSPDeviceInfo struct {
}

func New() OpenstackInterface {
Copy link
Collaborator

Choose a reason for hiding this comment

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

New should accept hostManager interface IMO.

similarly to what we do with interfaces and their impl in host pkg

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1 it will also help us if we need to pass a mock for unit-tests

you will only need to add the hostManager creation here

platformsHelper, err := platforms.NewDefaultPlatformHelper()

the other two places where we call the platform NewDefaultPlatformHelper() already have hostHelper created

Copy link
Member Author

Choose a reason for hiding this comment

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

In service.go and start.go we create the HostHelper, not the HostManager.

hostHelpers, err := helper.NewDefaultHostHelpers()

hostHelpers, err := helper.NewDefaultHostHelpers()

I'm not 100% getting the difference between these actors, but I'd leave the helpers's New function without arguments, and all the other interfaces get created by injecting the dependencies. WDYT?

Copy link
Collaborator

Choose a reason for hiding this comment

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

and all the other interfaces get created by injecting the dependencies. WDYT?

you will not be able to do so if the test is in a different package. e.g platform_test.
that said, this is not the case ATM. so im fine with either.
we can always change later.

Refactoring in [1] left the openstackContext uninitialized.

[1] k8snetworkplumbingwg#553

Signed-off-by: Andrea Panattoni <apanatto@redhat.com>
Copy link

github-actions bot commented Feb 2, 2024

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@adrianchiris adrianchiris merged commit f8405cf into k8snetworkplumbingwg:master Feb 8, 2024
11 checks passed
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.

5 participants