Skip to content

libnetwork: rewrite some tests to use gotest.tools#49329

Merged
thaJeztah merged 5 commits intomoby:masterfrom
thaJeztah:libnetwork_use_errdefs_step2
Jan 23, 2025
Merged

libnetwork: rewrite some tests to use gotest.tools#49329
thaJeztah merged 5 commits intomoby:masterfrom
thaJeztah:libnetwork_use_errdefs_step2

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

This does not yet include changes for error-assertions; pushing those separate for closer review

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah thaJeztah added status/2-code-review area/networking Networking area/testing kind/refactor PR's that refactor, or clean-up code labels Jan 22, 2025
@thaJeztah thaJeztah added this to the 28.0.0 milestone Jan 22, 2025
@thaJeztah

This comment was marked as resolved.

@thaJeztah thaJeztah force-pushed the libnetwork_use_errdefs_step2 branch from 4791392 to 952f7d4 Compare January 22, 2025 16:30
Copy link
Copy Markdown
Contributor

@robmry robmry left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +1211 to 1170
if iface.AddressIPv6() != nil {
assert.Check(t, iface.AddressIPv6().IP != nil, "Invalid IPv6 address returned: %v", iface.AddressIPv6())
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The old code did the same - but could align this with the IPv4 check, and make sure it is IPv6? ...

Suggested change
if iface.AddressIPv6() != nil {
assert.Check(t, iface.AddressIPv6().IP != nil, "Invalid IPv6 address returned: %v", iface.AddressIPv6())
}
if iface.AddressIPv6() != nil {
assert.Check(t, iface.AddressIPv6().IP.To6() != nil, "Invalid IPv6 address returned: %v", iface.AddressIPv6())
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hm.. there's no To6(). There' a To16(), but looking at that one again, it would be happy to return both IPv4 or IPv6 https://github.com/golang/go/blob/608acff8479640b00c85371d91280b64f5ec9594/src/net/ip.go#L226-L236

So I guess we need to do a To4() and check that it's nil (i.e., "not and IPv4 address, so IPv6")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh, sorry - yes.

First step; this is just a find and replace

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Prefering Check here over NilError so that all defers
wil be executed, instead of potentially failing on the
first one.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah force-pushed the libnetwork_use_errdefs_step2 branch from 952f7d4 to 2a8fe5e Compare January 22, 2025 21:11
Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah force-pushed the libnetwork_use_errdefs_step2 branch from 2a8fe5e to 203d653 Compare January 22, 2025 21:20
@thaJeztah
Copy link
Copy Markdown
Member Author

Rebased; minor conflict because TestBridgeIpv6FromMac was removed in bc130f3 (#48808)

@thaJeztah thaJeztah marked this pull request as ready for review January 22, 2025 21:21
@thaJeztah
Copy link
Copy Markdown
Member Author

Flaky test? (was updated in #49150 with some retries)

=== FAIL: amd64.integration.network TestMixL3IPVlanAndBridge/no_live_restore (1.49s)
    network_linux_test.go:489: assertion failed: error is not nil: Error response from daemon: failed to add interface veth002693c to sandbox: failed to advertise addresses: write ip ::1->ff02::1: sendmsg: network is unreachable
    --- FAIL: TestMixL3IPVlanAndBridge/no_live_restore (1.49s)

=== FAIL: amd64.integration.network TestMixL3IPVlanAndBridge (4.02s)

@robmry
Copy link
Copy Markdown
Contributor

robmry commented Jan 23, 2025

Still LGTM.

Flaky test? (was updated in #49150 with some retries)

Hmm, that's worrying. I don't think that update added any retries, it added a live-restore test case. But, I guess this means there's some race between interfaces coming up or being ready and sending the unsolicited NAs.

@thaJeztah
Copy link
Copy Markdown
Member Author

Let's keep an eye if we see it fail more often; my comment above should help find it back. It could still be a one-off!

@thaJeztah thaJeztah merged commit f2804e0 into moby:master Jan 23, 2025
@thaJeztah thaJeztah deleted the libnetwork_use_errdefs_step2 branch January 23, 2025 10:30
@robmry
Copy link
Copy Markdown
Contributor

robmry commented Jan 23, 2025

Let's keep an eye if we see it fail more often; my comment above should help find it back. It could still be a one-off!

Yes, I've been running the interesting part of test in a tight loop and haven't seen a failure. But perhaps it's a platform specific thing. I'll carry on investigating for a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants