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 functionality to parse multiple prefixes #35

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

mproffitt
Copy link
Contributor

This change introduces a new function multiprefixloop as a convenience function for splitting multiple cidr prefixes govorned by the number of bits and required offset inside each prefix.

This function might be used in instances such as dividing additional VPC cidrs into subnets without requiring multiple instances of the funtion to be declared in a given composition.

Additionally this PR:

  • Contributes towards issue Unit tests #2 by introducing happy path unit tests for each function.
  • Offers additional documentation for the function input definition
  • Introduces the missing make debug command referenced in the readme

Description of your changes

Fixes #

I have:

  • Read and followed Upbound's contribution process.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR, as appropriate.

How has this code been tested

By introducing tests that contribute towards ensuring stability of the function

go test -timeout 30s -run ^TestRunFunction$ github.com/upbound/function-cidr -v -count=1 -timeout=30s -parallel=4 -cover
=== RUN   TestRunFunction
=== RUN   TestRunFunction/cidr-host
=== RUN   TestRunFunction/cidr-subnet
=== RUN   TestRunFunction/cidr-netmask
=== RUN   TestRunFunction/cidr-subnets
=== RUN   TestRunFunction/cidr-subnetloop
=== RUN   TestRunFunction/multi-prefix-loop
--- PASS: TestRunFunction (0.00s)
    --- PASS: TestRunFunction/cidr-host (0.00s)
    --- PASS: TestRunFunction/cidr-subnet (0.00s)
    --- PASS: TestRunFunction/cidr-netmask (0.00s)
    --- PASS: TestRunFunction/cidr-subnets (0.00s)
    --- PASS: TestRunFunction/cidr-subnetloop (0.00s)
    --- PASS: TestRunFunction/multi-prefix-loop (0.00s)
PASS
coverage: 52.4% of statements
ok      github.com/upbound/function-cidr        0.015s  coverage: 52.4% of statements

Additionally by validating that there is no change to execution through crossplane beta render using make debug and make render commands

This change introduces a new function `multiprefixloop` as a convenience
function for splitting multiple cidr prefixes govorned by the number of
bits and required offset inside each prefix.

This function might be used in instances such as dividing additional VPC
cidrs into subnets without requiring multiple instances of the funtion
to be declared in a given composition.

Additionally this contributes towards issue upbound#2 by introducing happy path
unit tests for each function.
@haarchri haarchri merged commit 0800924 into upbound:main Aug 23, 2024
5 checks passed
@haarchri haarchri mentioned this pull request Aug 23, 2024
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.

2 participants