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

Add test for store helper ListIngresses #2399

Merged
merged 1 commit into from
Apr 22, 2018

Conversation

aledbf
Copy link
Member

@aledbf aledbf commented Apr 21, 2018

No description provided.

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 21, 2018
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 21, 2018
@aledbf aledbf mentioned this pull request Apr 21, 2018
6 tasks
@codecov-io
Copy link

codecov-io commented Apr 21, 2018

Codecov Report

Merging #2399 into master will increase coverage by 0.13%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2399      +/-   ##
==========================================
+ Coverage   39.45%   39.58%   +0.13%     
==========================================
  Files          73       73              
  Lines        5216     5216              
==========================================
+ Hits         2058     2065       +7     
+ Misses       2870     2862       -8     
- Partials      288      289       +1
Impacted Files Coverage Δ
internal/ingress/controller/store/store.go 58.12% <ø> (+4.37%) ⬆️
cmd/nginx/main.go 21.37% <0%> (-4.83%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8179dfe...c593236. Read the comment docs.

@aledbf aledbf force-pushed the add-tests branch 2 times, most recently from 539f470 to 996acf0 Compare April 21, 2018 22:06
@@ -740,3 +740,76 @@ func TestUpdateSecretIngressMap(t *testing.T) {
}
})
}

// Test to avoid regression fixed in https://github.com/kubernetes/ingress-nginx/pull/2361
func TestListIngressWithoutPath(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

From what I understand you're actually testing the function completely rather than one aspect of it, therefore I think this should just be called TestListIngresses.

IMHO the comment does not add any value.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

}
s.listers.Ingress.Add(ing1)

ing2 := &v1beta1.Ingress{
Copy link
Member

Choose a reason for hiding this comment

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

Could you call this ingressToIgnore or ingressWithDifferentClass that way the test case will also serve as a documentation and it will make it easier to figure out that this is the one that we are expecting to be ignored by ListIngresses function.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

},
}
s.listers.Ingress.Add(ing3)

Copy link
Member

Choose a reason for hiding this comment

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

For completeness I'd also add another ingress similar to ing2 but this time with the default supported class of nginx.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 21, 2018
}
s.listers.Ingress.Add(ingressWithoutPath)

ingressWithNginxClass := &v1beta1.Ingress{
Copy link
Member

Choose a reason for hiding this comment

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

I think the names got mixed between this and previous ingress. Since the previous ingress is the one with "kubernetes.io/ingress.class": "nginx",

s.listers.Ingress.Add(ingressWithNginxClass)

ingresses := s.ListIngresses()
if s := len(ingresses); s != 2 {
Copy link
Member

Choose a reason for hiding this comment

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

this should now be 3, no?

@aledbf
Copy link
Member Author

aledbf commented Apr 22, 2018

@ElvinEfendi tests updated

@ElvinEfendi
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 22, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aledbf, ElvinEfendi

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 merged commit 18a6a30 into kubernetes:master Apr 22, 2018
@aledbf aledbf deleted the add-tests branch April 22, 2018 03:49
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. 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants