Skip to content

TPT-4368: Update integration tests due to deprecated "vpcs" for NB create#926

Open
mawilk90 wants to merge 5 commits intolinode:proj/nb-front-end-ip-in-vpcfrom
mawilk90:feature/TPT-4368-sdks-update-integration-tests-due-to-deprecated-vpcs-for-nb-create
Open

TPT-4368: Update integration tests due to deprecated "vpcs" for NB create#926
mawilk90 wants to merge 5 commits intolinode:proj/nb-front-end-ip-in-vpcfrom
mawilk90:feature/TPT-4368-sdks-update-integration-tests-due-to-deprecated-vpcs-for-nb-create

Conversation

@mawilk90
Copy link
Copy Markdown
Contributor

@mawilk90 mawilk90 commented Mar 31, 2026

📝 Description

Changes related to the fact that "vpcs" attribute is deprecated (but still valid) in favor of "backend_vpcs" in POST /nodebalancers

✔️ How to Test

Without fixtures:
go test -count=1 ./test/integration/ -v -run TestNodeBalancer_Create_With

With fixtures:
make test-int TEST_ARGS="-run TestNodeBalancer_Create_With"

@mawilk90 mawilk90 force-pushed the feature/TPT-4368-sdks-update-integration-tests-due-to-deprecated-vpcs-for-nb-create branch from 7c8d1ed to 33f7afa Compare April 2, 2026 08:07
…-update-integration-tests-due-to-deprecated-vpcs-for-nb-create
@mawilk90 mawilk90 marked this pull request as ready for review April 3, 2026 12:29
@mawilk90 mawilk90 requested a review from a team as a code owner April 3, 2026 12:29
@mawilk90 mawilk90 requested review from Copilot and ezilber-akamai and removed request for a team April 3, 2026 12:29
Copy link
Copy Markdown
Contributor

@dawiddzhafarov dawiddzhafarov left a comment

Choose a reason for hiding this comment

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

LGTM and tests pass!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Linodego integration tests/fixtures to account for the deprecation of the vpcs field on NodeBalancer create requests in favor of backend_vpcs, while also adding coverage to ensure the deprecated field remains accepted for now.

Changes:

  • Updated NodeBalancer integration test setup helpers to send backend_vpcs instead of vpcs.
  • Refreshed integration fixtures to match the new request payloads (backend_vpcs) and updated recorded responses.
  • Added a new integration test + fixture to validate the deprecated vpcs create attribute is still accepted.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
test/integration/nodebalancers_test.go Switches create options to BackendVPCs in helpers; adds a new test for deprecated VPCs usage.
test/integration/fixtures/TestNodeBalancer_Create_WithFrontendAndBackendInDifferentVPCs.yaml Updates recorded POST body from vpcs to backend_vpcs (plus re-recorded fixture deltas).
test/integration/fixtures/TestNodeBalancer_Create_WithDeprecatedVPCsAttribute.yaml New fixture for the deprecated vpcs attribute create path.
test/integration/fixtures/TestNodeBalancer_Create_WithBackendVPCOnly.yaml Updates recorded POST body from vpcs to backend_vpcs (plus re-recorded fixture deltas).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

nodebalancer, err := client.CreateNodeBalancer(context.Background(), createOpts)
require.NoErrorf(t, err, "Error creating NodeBalancer with VPCc attribute: %v", err)
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The failure message has a typo/inaccurate wording: "VPCc attribute" should be "VPCs attribute" (or "vpcs attribute"). This makes failures harder to interpret when the test breaks.

Suggested change
require.NoErrorf(t, err, "Error creating NodeBalancer with VPCc attribute: %v", err)
require.NoErrorf(t, err, "Error creating NodeBalancer with VPCs attribute: %v", err)

Copilot uses AI. Check for mistakes.
Comment on lines +305 to +309
createOpts := linodego.NodeBalancerCreateOptions{
Label: &label,
Region: vpc.Region,
Type: linodego.NBTypePremium,
VPCs: []linodego.NodeBalancerVPCOptions{{
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

This test is meant to validate the deprecated vpcs request field still behaves correctly, but it only asserts the NodeBalancer was created. Please also assert the backend VPC attachment was actually created (e.g., list NodeBalancer VPC configs and check subnet/purpose), otherwise a regression that silently ignores vpcs could still pass.

Copilot uses AI. Check for mistakes.
}

func TestNodeBalancer_Create_WithDeprecatedVPCsAttribute(t *testing.T) {
// To test that deprecated VPCs attribute is still valid - it will be deleted when it can no longer be used
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The comment has an odd leading tab and reads like a sentence fragment ("//\tTo test..."). Please reformat it as a standard Go comment sentence (single space after //, capitalized) for readability and consistency.

Suggested change
// To test that deprecated VPCs attribute is still valid - it will be deleted when it can no longer be used
// Test that the deprecated VPCs attribute is still valid; it will be deleted when it can no longer be used.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@ezilber-akamai ezilber-akamai left a comment

Choose a reason for hiding this comment

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

I get this error:

    nodebalancers_test.go:143: 
                Error Trace:    /Users/ezilber/Projects/dx-devenv/repos/linodego/test/integration/nodebalancers_test.go:566
                                                        /Users/ezilber/Projects/dx-devenv/repos/linodego/test/integration/nodebalancers_test.go:143
                Error:          Received unexpected error:
                                [400] [type] User doesn't have permissions to add the requested type of NodeBalancer
                Test:           TestNodeBalancer_Create_WithFrontendVPCOnly
                Messages:       Error listing nodebalancers, expected struct, got error [400] [type] User doesn't have permissions to add the requested type of NodeBalancer

despite having (I think) all required customer tags on my account.

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.

4 participants