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] Add unit tests for the loadbalancer.go functions #2400

Closed
17 of 18 tasks
sakshi-1505 opened this issue Oct 6, 2023 · 14 comments
Closed
17 of 18 tasks

[tests] Add unit tests for the loadbalancer.go functions #2400

sakshi-1505 opened this issue Oct 6, 2023 · 14 comments
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@sakshi-1505
Copy link
Contributor

sakshi-1505 commented Oct 6, 2023

/kind feature

What happened:

The cloud-provider-openstack code most related to this project lives in loadbalancer.go which is lacking almost all unit tests. This task is to write tests for all of the functions there. Please note that it is untrivial to create tests for methods using gophercloud library, so calling the OpenStack APIs.

List of Tests:

  • getSecurityGroupName
  • getListenerProtocol
  • GetLoadBalancerName
  • nodeAddressForLB
  • getStringFromServiceAnnotation
  • getIntFromServiceAnnotation
  • getBoolFromServiceAnnotation
  • buildMonitorCreateOpts
  • buildPoolCreateOpt
  • buildBatchUpdateMemberOpts
  • buildListenerCreateOpt
  • getMemberSubnetID
  • getSubnetID
  • getNetworkID
  • checkListenerPorts
  • updateServiceAnnotations
  • createLoadBalancerStatus
  • GetLoadBalancerSourceRanges
@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 6, 2023
@sakshi-1505
Copy link
Contributor Author

/assign

@FavourEva
Copy link
Contributor

I am currently working on these functions:
getBoolFromServiceAnnotation
buildBatchUpdateMemberOpts
buildListenerCreateOpt
updateServiceAnnotations

@sakshi-1505
Copy link
Contributor Author

Working on getSecurityGroupName,GetLoadBalancerSourceRanges,getSubnetId

@dulek
Copy link
Contributor

dulek commented Oct 6, 2023

@sakshi-1505: I think getSecurityGroupName() is being done here: #2389. A bunch of PRs that are already opened: https://github.com/kubernetes/cloud-provider-openstack/pulls?q=is%3Apr+is%3Aopen+test

@sakshi-1505
Copy link
Contributor Author

Ugh, I had created a PR already for that #2401. I will close the PR since I guess there is one already created but needs some more changes.

@sakshi-1505
Copy link
Contributor Author

@dulek I guess there are multiple PRs created, out of which none is merged but those Prs occupy 50% of the function listed above. Do you think there is some other level 2 task I can pick? I have already built devstack on my local machine as was suggested in the Outreachy guide before I jumped on picking these issues.

@yorubad-dev
Copy link
Contributor

I already open a PR for

  • getSecurity group name
  • Getloadbalancername
  • nodeaddressforlb
  • GetStringfromserviceannotation
  • Updateserviceannotation
  • GetnetworkId
  • GetMembersubnetId

@yorubad-dev
Copy link
Contributor

And I am currently working on ‘Getloadbalancersourcerange’

@dulek
Copy link
Contributor

dulek commented Oct 6, 2023

@sakshi-1505: I'll try to find more functions that are lacking unit tests and allow writing tests fairly easily. The problem is that gophercloud is pretty hard to mock, so any functions actually making calls to OpenStack are problematic.

@KingDaemonX: I think it'll be better to make sure some of the functions can be worked on by the rest of the participants. You've definitely already proven your dedication and golang proficiency.

@yorubad-dev
Copy link
Contributor

Okay! I will drop this “Getloadbalancersourcerange” that isn’t in the PR and look into some other stuff

@sakshi-1505
Copy link
Contributor Author

@sakshi-1505: I'll try to find more functions that are lacking unit tests and allow writing tests fairly easily. The problem is that gophercloud is pretty hard to mock, so any functions actually making calls to OpenStack are problematic.

@dulek It's fine if there are not enough functions, I can try contributing to another issue.

The problem is that gophercloud is pretty hard to mock, so any functions actually making calls to OpenStack are problematic.

How about we run a devstack & prefer to run integration tests for such functions instead of unit tests?

@majorchork
Copy link
Contributor

Hello @dulek i'm currently working on
buildMonitorCreateOpts
buildPoolCreateOpt
getSubnetID

@sakshi-1505
Copy link
Contributor Author

I am working on checkListernerPorts, createLoadBalancerStatus, GetLBSourceRanges.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 29, 2024
@dulek dulek closed this as completed Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

7 participants