Skip to content

Add IPv6 validation within python and node apps#1535

Merged
jochenehret merged 8 commits intocloudfoundry:developfrom
sap-contributions:CFDEPLOY-213-add-ipv6-validation
May 13, 2025
Merged

Add IPv6 validation within python and node apps#1535
jochenehret merged 8 commits intocloudfoundry:developfrom
sap-contributions:CFDEPLOY-213-add-ipv6-validation

Conversation

@Milena-Encheva
Copy link
Copy Markdown
Contributor

@Milena-Encheva Milena-Encheva commented Apr 23, 2025

Are you submitting this PR against the develop branch?

Yes.

All PR's to CATs should be submitted to develop and will be merged to main once they've passed acceptance.

What is this change about?

The change is related to IPv6 support validation. The main purpose of the newly created ipv6 test group is to test IPv6 egress calls using different buildpacks, including Java, Python, and others relevant to our ecosystem which will be added later on.

Please provide contextual information.

https://github.com/cloudfoundry/community/blob/main/toc/rfc/rfc-0038-ipv6-dual-stack-for-cf.md

What version of cf-deployment have you run this cf-acceptance-test change against?

v48.9.0

Please check all that apply for this PR:

  • introduces a new test --- Are you sure everyone should be running this test?
  • changes an existing test
  • requires an update to a CATs integration-config (must set new flag if you want to run the test)

Did you update the README as appropriate for this change?

  • YES
  • N/A

If you are introducing a new acceptance test, what is your rationale for including it CATs rather than your own acceptance test suite?

_CATs should validate IPv6 egress calls after support of the protocol is provided.

How many more (or fewer) seconds of runtime will this change introduce to CATs?

Around 90 seconds per test.

What is the level of urgency for publishing this change?

  • Urgent - unblocks current or future work
  • Slightly Less than Urgent

Tag your pair, your PM, and/or team!

@oliver-heinrich

Copy link
Copy Markdown

@peanball peanball left a comment

Choose a reason for hiding this comment

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

The biggest request is to not make the app crash (sys.exit(1)) when the IPv6 test fails.

A more fine-grained response from the test endpoint with all the details (IPv4 tests success or failed, what IP was seen, same for v6 and) would be really helpful to see what failed when the test fails. Otherwise you just see "the test failed" without any indication why.

Please run go fmt on all Go files.

IncludeV3 *bool `json:"include_v3"`
IncludeVolumeServices *bool `json:"include_volume_services"`
IncludeZipkin *bool `json:"include_zipkin"`
IncludeIpv6 *bool `json:"include_ipv6"`
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I would prefer IncludeIPv6 (see also other acronyms such as IncludeHTTP2Routingm IncludeTCPRouting, etc).

'api64.ipify.org': "Dual stack"
}

PORT = '8080'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

maybe this could be called DEFAULT_PORT, as it is the fallback when there is no PORT env variable (e.g. when debugging locally)

logging.info("Test execution has completed. IPv6 validation is successful.")
else:
logging.error("Test execution has completed. IPv6 validation failed.")
sys.exit(1)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This will just kill the server process outright. You might want to return a boolean here and check it where it's called.

It would be good to collect and return all results as well, so they can be passed on to the response output, so the curl client in the test can read the details also.

self.end_headers()
message = "Hello python, world!"
tester = IPv6Tester(list(ENDPOINT_TYPE_MAP.keys()))
tester.test_all_addresses()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Here you could have a boolean and output information, and potentially even the status code (e.g. not 200) when the conditions of the test fail.

Additionally, the output of what was provided back from the egress calls, i.e. IPv4, IPv6 addresses, or what failed would be really nice for debugging when the test actually fails.

IncludeVolumeServices *bool `json:"include_volume_services,omitempty"`
IncludeZipkin *bool `json:"include_zipkin,omitempty"`
IncludeWindows *bool `json:"include_windows,omitempty"`
IncludeIpv6 *bool `json:"include_ipv6,omitempty"`
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The indentation is off because tabs are used and above spaces are used. This can be avoided by using go fmt.

const SkipFileBasedServiceBindingsBuildpackApp = `Skipping this test because config.IncludeFileBasedServiceBindings is set to 'false'.`
const SkipFileBasedServiceBindingsCnbApp = `Skipping this test because config.IncludeFileBasedServiceBindings and/or config.IncludeCNB are set to 'false'.`
const SkipFileBasedServiceBindingsDockerApp = `Skipping this test because config.IncludeFileBasedServiceBindings and/or config.IncludeDocker are set to 'false'.`
const SkipIncludeIpv6 = `Skipping this test because config.IncludeIpv6 is set to 'false'.`
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I suggest calling this SkipIPv6, which makes it clearer what is actually skipped.

ipv6/ipv6.go Outdated

Eventually(func() string {
return helpers.CurlApp(Config, appName, "/ipv6-test")
}).Should(ContainSubstring("IPv6 tests executed"))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There is output for IPv4 tests succeeded, IPv6 tests succeeded, Dual stack tests succeeded. It would be good to have all of those as part of the response and not (just) the stdout of the test app.

They could then be explicit assertions in the test. This makes it easier to see what exactly failed and why, when something failed.

ipv6/ipv6.go Outdated
It examines that after making a request to a predifined route,
IPv6 tests are executed successfully */

Eventually(func() string {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There should not be a need for the Eventually. It is needed above to make sure that the app is up and running, and retry if it's not yet. But at that point the app is up and running and you can for the call right away.

Accordingly you can then store the response and have multiple response.Should(ContainSubstring("... tests succeeded")) calls (see comment below).

@Milena-Encheva Milena-Encheva changed the base branch from main to develop April 24, 2025 12:41
@Milena-Encheva Milena-Encheva changed the title Add IPv6 validation within python app Add IPv6 validation within python and node apps Apr 29, 2025
@Milena-Encheva Milena-Encheva marked this pull request as ready for review May 9, 2025 09:19
@Milena-Encheva Milena-Encheva requested a review from peanball May 9, 2025 09:19
@jochenehret jochenehret requested review from a team and removed request for peanball May 9, 2025 10:49
ipv6/ipv6.go Outdated

Describe("Egress Capability in Apps", func() {
for _, stack := range Config.GetStacks() {
stack := stack
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.

That's not needed.

@jochenehret jochenehret requested review from a team and removed request for peanball May 12, 2025 13:44
@jochenehret jochenehret merged commit 787ed43 into cloudfoundry:develop May 13, 2025
3 checks passed
@oliver-heinrich
Copy link
Copy Markdown

oliver-heinrich commented May 13, 2025 via email

Copy link
Copy Markdown
Contributor

@dimivel dimivel left a comment

Choose a reason for hiding this comment

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

LGTM

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.

5 participants