linode / linodego

Go client for Linode REST v4 API
MIT License
138 stars 81 forks source link

IP Reservation Support for New Endpoints #570

Closed AniJ98 closed 3 weeks ago

AniJ98 commented 3 weeks ago

šŸ“ Description

This PR introduces comprehensive functionality and tests for Reserved IP Addresses in the Linodego client. The changes are necessary to provide robust support for managing Reserved IP addresses through the Linode API. The changes include:

  1. Implementation of core Reserved IP operations:

    • Listing Reserved IPs
    • Getting a specific Reserved IP
    • Reserving a new IP
    • Deleting a Reserved IP
  2. Test coverage:

    • TestReservedIPAddresses_InsufficientPermissions: Verifies behavior when the user lacks necessary permissions.
    • TestReservedIPAddresses_EndToEndTest: Performs a complete workflow test for users with proper permissions.
    • TestReservedIPAddresses_ListIPAddressesVariants: Tests various scenarios for listing IP addresses.
    • TestReservedIPAddresses_GetIPAddressVariants: Covers different cases for retrieving a specific IP address.
    • TestReservedIPAddresses_ReserveIPVariants: Tests multiple scenarios for reserving an IP, including edge cases.
    • TestReservedIPAddresses_DeleteIPAddressVariants: Verifies deletion functionality under various conditions.

āœ”ļø How to Test

What are the steps to reproduce the issue or verify the changes?

To verify the changes related to Reserved IP functionality, follow these steps:

  1. Ensure you have a valid Linode API token with the "can_reserve_ip" permission enabled.

    Set up your environment:

    export LINODE_TOKEN="your_token_here"

    Additionally you need to set the following if you want to test it in a different environment:

      export LINODE_URL="https://api.linode.com"
      export LINODE_API_VERSION="v4beta"
  2. Navigate to the test directory within the linodego project.

    Update the LINODE_TOKEN in the Makefile: makefile LINODE_TOKEN="your_token_here"

  3. Run the tests using one of the following commands:

    To run all integration tests:

    make testint

    To run only Reserved IP related tests:

    go test -v ./integration -run TestReservedIPAddresses

    To run a specific test:

    go test -v ./integration -run TestReservedIPAddresses_EndToEndTest

Verify the test output for any failures or unexpected behavior.

Note:

lgarber-akamai commented 3 weeks ago

Hey @AniJ98, thanks for the contribution! Is there any particular reason this PR was closed? Otherwise we'd be happy to review and merge it.

AniJ98 commented 3 weeks ago

The PR needed some changes. My team is currently reviewing it. I will reopen once they approve the changes.