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

Adds unit test for fqdn.go #4582

Merged
merged 1 commit into from
Feb 8, 2023
Merged

Adds unit test for fqdn.go #4582

merged 1 commit into from
Feb 8, 2023

Conversation

urharshitha
Copy link
Contributor

@urharshitha urharshitha commented Jan 23, 2023

Adds the unit test for pkg/agent/controller/networkpolicy/fqdn.go
for #4142
Signed-off-by: Harshitha U R harshithaur1611@gmail.com

@codecov
Copy link

codecov bot commented Jan 23, 2023

Codecov Report

Merging #4582 (e6bf9f7) into main (a63314f) will decrease coverage by 0.08%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4582      +/-   ##
==========================================
- Coverage   69.58%   69.50%   -0.08%     
==========================================
  Files         400      400              
  Lines       59122    59122              
==========================================
- Hits        41141    41095      -46     
- Misses      15175    15219      +44     
- Partials     2806     2808       +2     
Flag Coverage Δ *Carryforward flag
e2e-tests 38.34% <ø> (ø) Carriedforward from a63314f
integration-tests 34.53% <ø> (+0.04%) ⬆️
kind-e2e-tests 46.70% <ø> (-0.99%) ⬇️
unit-tests 59.61% <ø> (-0.01%) ⬇️

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
pkg/agent/controller/networkpolicy/packetin.go 58.78% <0.00%> (-11.49%) ⬇️
pkg/agent/flowexporter/exporter/exporter.go 64.70% <0.00%> (-10.30%) ⬇️
pkg/controller/networkpolicy/tier.go 53.84% <0.00%> (-4.62%) ⬇️
pkg/agent/cniserver/ipam/antrea_ipam.go 75.75% <0.00%> (-4.33%) ⬇️
.../flowexporter/connections/conntrack_connections.go 77.61% <0.00%> (-3.34%) ⬇️
pkg/controller/ipam/antrea_ipam_controller.go 75.25% <0.00%> (-3.02%) ⬇️
pkg/ipam/ipallocator/allocator.go 88.14% <0.00%> (-1.55%) ⬇️
...gent/controller/noderoute/node_route_controller.go 61.71% <0.00%> (-1.49%) ⬇️
pkg/ipam/poolallocator/allocator.go 73.57% <0.00%> (-1.43%) ⬇️
pkg/controller/networkpolicy/status_controller.go 70.77% <0.00%> (-1.06%) ⬇️
... and 21 more

@Atish-iaf
Copy link
Contributor

@urharshitha Unit test failed, please check.

@urharshitha urharshitha force-pushed the fqdnTesting branch 3 times, most recently from 85b6c83 to 3f04497 Compare January 25, 2023 12:49
existingDNSCache: map[string]dnsMeta{
"test.antrea.io": {
responseIPs: map[string]net.IP{
"IP": net.ParseIP("127.0.0.1"),
Copy link
Member

Choose a reason for hiding this comment

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

The key doesn't match the data in real world. It should be the string format of the IP.
And please use more than one IP to cover multiple response IPs case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

LGTM

f.dnsEntryCache = tc.existingDNSCache
}
gotOutput := f.getIPsForFQDNSelectors(tc.fqdns)
assert.Equal(t, tc.expectedMatchedIPs, gotOutput)
Copy link
Member

Choose a reason for hiding this comment

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

Use ElementsMatch to avoid order mismatch.
The unit test failed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Signed-off-by: Harshitha U R <harshithaur1611@gmail.com>
@tnqn
Copy link
Member

tnqn commented Feb 8, 2023

/skip-all

@tnqn tnqn merged commit 64612e2 into antrea-io:main Feb 8, 2023
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.

3 participants