TPT-4463: Add integration tests for RDMA interfaces#999
Draft
mawilk90 wants to merge 19 commits into
Draft
Conversation
Current implementation of vpcCreateOptionsCheck verifies fields copied from VPC so comparing opts.Label == vpc.Label etc. is just comparing a value to itself —> good is always true.
…rfaceCreateOptions
…ceWithLinodeInterfaces
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the Linode Go client’s VPC + interface models to represent RDMA-capable VPCs/interfaces and adds unit + integration coverage (plus fixtures) to validate (un)marshalling and key RDMA workflows. It’s intended to pair with the feature work in #988 and adds the test/fixture layer around that functionality.
Changes:
- Add
VPCType(regular/rdma) to VPC and VPC subnet models and wire it into VPC create options. - Add RDMA VPC interface models/options plus a new instance-create interface option type that supports RDMA VPC interfaces, with
InstanceCreateOptionsmarshaling support. - Add unit tests + integration tests + VCR fixtures for RDMA VPCs and RDMA interfaces.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| vpc.go | Introduces VPCType and adds vpc_type support to VPC and create options. |
| vpc_subnet.go | Adds vpc_type to VPC subnet responses. |
| interfaces.go | Adds RDMA VPC interface models/options and instance-create interface option type. |
| instances.go | Adds LinodeInstanceInterfaces and extends InstanceCreateOptions.MarshalJSON conflict + serialization logic. |
| test/unit/rdma_vpc_test.go | Unit coverage for RDMA VPC type, RDMA interface (get/list/update), and marshaling semantics. |
| test/unit/fixtures/vpc_rdma_get.json | Unit fixture for RDMA VPC GET response. |
| test/unit/fixtures/vpc_rdma_create.json | Unit fixture for RDMA VPC create response/validation. |
| test/unit/fixtures/interface_update_rdma_vpc.json | Unit fixture for RDMA interface update response. |
| test/unit/fixtures/interface_list_with_rdma.json | Unit fixture for listing interfaces including RDMA entries. |
| test/unit/fixtures/interface_get_rdma_vpc.json | Unit fixture for RDMA interface GET response. |
| test/integration/vpc_test.go | Integration test refactor + adds RDMA VPC create/get/list filter coverage. |
| test/integration/vpc_subnet_test.go | Integration coverage for subnet vpc_type and RDMA subnet workflows. |
| test/integration/lke_clusters_test.go | Updates helper return signature usage due to createVPC refactor. |
| test/integration/instance_interfaces_test.go | Switches instance-create tests to LinodeInstanceInterfaces and adds RDMA interface integration test. |
| test/integration/fixtures/TestVPC_CreateGet.yaml | Updates recorded interactions to include vpc_type and devcloud URLs. |
| test/integration/fixtures/TestVPC_Create_Invalid.yaml | Updates recorded invalid-label interaction and message. |
| test/integration/fixtures/TestInstance_CreateWithLinodeInterfaces.yaml | Updates recorded instance-create interaction for updated VPC/subnet responses and devcloud URLs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| for i := 1; i <= amount; i++ { | ||
| interfaces = append(interfaces, linodego.LinodeInstanceInterfaceCreateOptions{ | ||
| LinodeInterfaceCreateOptions: linodego.LinodeInterfaceCreateOptions{ | ||
| FirewallID: linodego.Pointer(-1), |
Comment on lines
+254
to
+257
| updatedRDMAInterface, err := client.UpdateInterface(context.Background(), instance.ID, basicRDMAInterface.ID, updateOpts) | ||
| require.NoErrorf(t, err, "Error updating RDMA interface: %s", err) | ||
| assert.Equal(t, basicRDMAInterface.ID, updatedRDMAInterface.ID, "Expected RDMA interface ID to remain the same after update") | ||
| assert.Equal(t, basicRDMAInterface.RDMAVPC.SubnetID, vpcSubnetRDMAUpdate.ID, "Expected RDMA interface to be updated") |
Comment on lines
+263
to
+266
| e, _ := err.(*linodego.Error) | ||
| assert.Equal(t, 400, e.Code, "Expected error code 400, got: %d", e.Code) | ||
| expectedErrorMessage := "RDMA VPC Interfaces cannot be deleted" | ||
| assert.Contains(t, e.Message, expectedErrorMessage, "Expected error message to contain: %s, got: %s", expectedErrorMessage, e.Message) |
Comment on lines
+102
to
+105
| require.NotEmpty(t, vpc.Label, "VPC label should not be empty") | ||
| require.Equal(t, opts.Description, vpc.Description, "VPC description mismatch") | ||
| require.Equal(t, opts.Region, vpc.Region, "VPC region mismatch") | ||
| require.Equal(t, len(opts.Subnets), len(vpc.Subnets), "VPC subnet count mismatch") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
Integration tests for RDMA interfaces
Note:
It is dependent on #988 (when it is merged then a target branch above will be changed)
✔️ How to Test
Some local setup is needed before RDMA tests run.
RDMA integration tests:
make fixtures TEST_ARGS="-run TestVPC_WithRDMAType"make fixtures TEST_ARGS="-run TestVPC_Subnet_WithRDMAType"make fixtures TEST_ARGS="-run TestInstance_CreateWithRDMAVPCInterfaces"Related fixes and refactors:
DevCloud:
make test-int TEST_ARGS="-run TestVPC_CreateGet_smoke"make test-int TEST_ARGS="-run TestVPC_Subnet_Create"Prod:
make test-int TEST_ARGS="-run TestVPC_List"make test-int TEST_ARGS="-run TestVPC_Update"make test-int TEST_ARGS="-run TestVPC_Create_Invalid_data"make test-int TEST_ARGS="-run TestVPC_Update_Invalid"make test-int TEST_ARGS="-run TestVPC_Subnet_Create_Invalid_data"make test-int TEST_ARGS="-run TestVPC_Subnet_Update_Invalid_data"make test-int TEST_ARGS="-run TestLKECluster_Enterprise_BYOVPC_smoke"