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

Refactor openstackCloud to be mockable, add a MockCloud #9645

Merged
merged 1 commit into from
Aug 3, 2020

Conversation

rifelpet
Copy link
Member

@rifelpet rifelpet commented Jul 29, 2020

This is the first step towards an Openstack implementation of cloudmock, allowing us to have Openstack integration tests.

This separates the majority of the logic from the live implementation of the OpenstackCloud interface, allowing us to reuse the logic in openstack.MockCloud.

This is the same pattern followed in the AWS package. example:

func (c *awsCloudImplementation) GetELBTags(loadBalancerName string) (map[string]string, error) {
return getELBTags(c, loadBalancerName)
}
func getELBTags(c AWSCloud, loadBalancerName string) (map[string]string, error) {
tags := map[string]string{}
request := &elb.DescribeTagsInput{
LoadBalancerNames: []*string{&loadBalancerName},
}
response, err := c.ELB().DescribeTags(request)
if err != nil {
return nil, fmt.Errorf("error listing tags on %v: %v", loadBalancerName, err)
}
for _, tagset := range response.TagDescriptions {
for _, tag := range tagset.Tags {
tags[aws.StringValue(tag.Key)] = aws.StringValue(tag.Value)
}
}
return tags, nil
}

func (c *MockAWSCloud) GetELBTags(loadBalancerName string) (map[string]string, error) {
return getELBTags(c, loadBalancerName)
}

This is the first step towards an openstack implementation of cloudmock, allowing us to have openstack integration tests.
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 29, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rifelpet

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:

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

@k8s-ci-robot k8s-ci-robot requested review from drekle and zetaab July 29, 2020 04:34
@k8s-ci-robot k8s-ci-robot added area/provider/openstack Issues or PRs related to openstack provider approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 29, 2020
@rifelpet
Copy link
Member Author

rifelpet commented Aug 3, 2020

/cc @olemarkus

I have a followup PR that creates a cloudmock implementation for openstack and sets up an integration test but I'd like to get this reviewed and merged first.

@k8s-ci-robot k8s-ci-robot requested a review from olemarkus August 3, 2020 02:02
@johngmyers
Copy link
Member

Were you planning on making that OpenStack integration test merge-blocking? I'm not sure how I would have managed to get that cert refactor accomplished with a blocking OpenStack test, given I have neither sufficient OpenStack expertise nor a test environment.

@olemarkus
Copy link
Member

I don't think I am a huge fan of this pattern, but at least it is consistent :)
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 3, 2020
@k8s-ci-robot k8s-ci-robot merged commit de37717 into kubernetes:master Aug 3, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.19 milestone Aug 3, 2020
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. area/provider/openstack Issues or PRs related to openstack provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants