Skip to content

feat: Enabled virtual-circuit sub commands in metal-cli#369

Merged
ctreatma merged 1 commit intoequinix:mainfrom
codinja1188:virtual-circuit
Jan 19, 2024
Merged

feat: Enabled virtual-circuit sub commands in metal-cli#369
ctreatma merged 1 commit intoequinix:mainfrom
codinja1188:virtual-circuit

Conversation

@codinja1188
Copy link
Copy Markdown
Contributor

@codinja1188 codinja1188 commented Oct 20, 2023

  • Enabled virtual-circuit subcommands in metal-cli
  • Improved Virtual network E2E test cases as per new cases

Part of #307

@codinja1188 codinja1188 temporarily deployed to external October 20, 2023 16:30 — with GitHub Actions Inactive
@codinja1188 codinja1188 marked this pull request as draft October 20, 2023 16:32
Comment thread internal/virtualcircuit/create.go Outdated
Comment thread internal/virtualcircuit/create.go Outdated
Comment thread internal/virtualcircuit/create.go Outdated
Comment thread internal/virtualcircuit/create.go Outdated
Comment thread internal/virtualcircuit/update.go Outdated
Comment thread internal/virtualcircuit/update.go Outdated
@codinja1188 codinja1188 temporarily deployed to external October 26, 2023 14:12 — with GitHub Actions Inactive
@codinja1188 codinja1188 temporarily deployed to external October 27, 2023 12:34 — with GitHub Actions Inactive
Comment thread internal/virtualcircuit/retrieve.go Outdated
@codinja1188
Copy link
Copy Markdown
Contributor Author


Vasubabus-MacBook-Pro:bin vasubabu$ ./metal conn create -n "test-intconn" -m da -r "primary" -t "dedicated" -p b4673e33-0f48-4948-961a-c31d6edf64f8
+--------------------------------------+--------------+-----------+-------------------------------+
|                  ID                  |     NAME     |   TYPE    |            CREATED            |
+--------------------------------------+--------------+-----------+-------------------------------+
| e5b04a4a-1dad-4b87-a5a0-53ee3488d1cf | test-intconn | dedicated | 2023-11-13 16:24:50 +0000 UTC |
+--------------------------------------+--------------+-----------+-------------------------------+

Vasubabus-MacBook-Pro:bin vasubabu$ ./metal conn get -i e5b04a4a-1dad-4b87-a5a0-53ee3488d1cf
+--------------------------------------+--------------+-----------+-------------------------------+
|                  ID                  |     NAME     |   TYPE    |            CREATED            |
+--------------------------------------+--------------+-----------+-------------------------------+
| e5b04a4a-1dad-4b87-a5a0-53ee3488d1cf | test-intconn | dedicated | 2023-11-13 16:24:50 +0000 UTC |
+--------------------------------------+--------------+-----------+-------------------------------+


Vasubabus-MacBook-Pro:bin vasubabu$ ./metal vc create -P b4673e33-0f48-4948-961a-c31d6edf64f8 -V 1010 -v aab35458-2fff-4204-af62-a75d684d7576 -n vc-test-vlan2 -s 100 -p 0fc33c4b-5ed3-4443-845a-e5d643fd6ee3 -i e5b04a4a-1dad-4b87-a5a0-53ee3488d1cf
set any VLAN only things
+--------------------------------------+---------------+-------------+-------------------------------+
|                  ID                  |     NAME      | DESCRIPTION |            CREATED            |
+--------------------------------------+---------------+-------------+-------------------------------+
| 519fe0d1-170c-4c7d-aaab-63f190f8fe5e | vc-test-vlan2 |             | 2023-11-13 16:37:32 +0000 UTC |
+--------------------------------------+---------------+-------------+-------------------------------+


Vasubabus-MacBook-Pro:bin vasubabu$ ./metal vc get -i 519fe0d1-170c-4c7d-aaab-63f190f8fe5e
+--------------------------------------+---------------+-------+-------------------------------+
|                  ID                  |     NAME      | SPEED |            CREATED            |
+--------------------------------------+---------------+-------+-------------------------------+
| 519fe0d1-170c-4c7d-aaab-63f190f8fe5e | vc-test-vlan2 | 100   | 2023-11-13 16:37:32 +0000 UTC |
+--------------------------------------+---------------+-------+-------------------------------+

Try to update VLAN from different METRO : AM

Vasubabus-MacBook-Pro:bin vasubabu$ ./metal vc update -i 519fe0d1-170c-4c7d-aaab-63f190f8fe5e -v 7128a3d8-b715-4fa4-bc12-ce15c2a6f2c2
Error: could not update virtual-circuit: 422 Unprocessable Entity
Vasubabus-MacBook-Pro:bin vasubabu$ export PACKNGO_DEBUG=1
Vasubabus-MacBook-Pro:bin vasubabu$ ./metal vc update -i 519fe0d1-170c-4c7d-aaab-63f190f8fe5e -v 7128a3d8-b715-4fa4-bc12-ce15c2a6f2c2
2023/11/13 22:24:22
PUT /metal/v1/virtual-circuits/519fe0d1-170c-4c7d-aaab-63f190f8fe5e HTTP/1.1
Host: api.equinix.com
User-Agent: metal-cli/12a370d metal-go/0.26.0
Content-Length: 59
Accept: application/json
Content-Type: application/json
X-Auth-Token: **REDACTED**
Accept-Encoding: gzip

{"speed":"","vnid":"7128a3d8-b715-4fa4-bc12-ce15c2a6f2c2"}

2023/11/13 22:24:23
HTTP/1.1 422 Unprocessable Entity
Connection: close
Content-Length: 73
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Mon, 13 Nov 2023 16:54:23 GMT
Referrer-Policy: strict-origin-when-cross-origin
Strict-Transport-Security: max-age=15724800; includeSubDomains
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-Request-Id: 8e2b2c1a8faaebc6d832049a0dc0ceca
X-Xss-Protection: 1; mode=block

{"errors":["Metro VLAN 7128a3d8-b715-4fa4-bc12-ce15c2a6f2c2 not found."]}
Error: could not update virtual-circuit: 422 Unprocessable Entity


Try to update VLAN from same METRO : DA


Vasubabus-MacBook-Pro:bin vasubabu$ ./metal vc update -i 519fe0d1-170c-4c7d-aaab-63f190f8fe5e -v 74f2b46b-e88d-4a2c-a3dc-884d3d12fe8c
2023/11/13 22:26:01
PUT /metal/v1/virtual-circuits/519fe0d1-170c-4c7d-aaab-63f190f8fe5e HTTP/1.1
Host: api.equinix.com
User-Agent: metal-cli/12a370d metal-go/0.26.0
Content-Length: 59
Accept: application/json
Content-Type: application/json
X-Auth-Token: **REDACTED**
Accept-Encoding: gzip

{"speed":"","vnid":"74f2b46b-e88d-4a2c-a3dc-884d3d12fe8c"}

2023/11/13 22:26:03
HTTP/1.1 200 OK
Content-Length: 562
Cache-Control: max-age=0, private, must-revalidate
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Mon, 13 Nov 2023 16:56:03 GMT
Etag: W/"ad6339b2cb8a1316b521d3960141f3c9"
Referrer-Policy: strict-origin-when-cross-origin
Strict-Transport-Security: max-age=15724800; includeSubDomains
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-Request-Id: b920b9090eb0a1643c250053f31c8cef
X-Xss-Protection: 1; mode=block

{"id":"519fe0d1-170c-4c7d-aaab-63f190f8fe5e","name":"vc-test-vlan2","description":null,"bill":false,"status":"pending","nni_vnid":1010,"nni_vlan":1010,"speed":null,"tags":[],"created_at":"2023-11-13T16:37:32Z","updated_at":"2023-11-13T16:56:02Z","project":{"href":"/metal/v1/projects/b4673e33-0f48-4948-961a-c31d6edf64f8"},"virtual_network":{"href":"/metal/v1/virtual-networks/74f2b46b-e88d-4a2c-a3dc-884d3d12fe8c"},"type":"vlan","vnid":2023,"port":{"href":"/metal/v1/connections/e5b04a4a-1dad-4b87-a5a0-53ee3488d1cf/ports/0fc33c4b-5ed3-4443-845a-e5d643fd6ee3"}}
+--------------------------------------+---------------+------+-------------------------------+
|                  ID                  |     NAME      | TYPE |            CREATED            |
+--------------------------------------+---------------+------+-------------------------------+
| 519fe0d1-170c-4c7d-aaab-63f190f8fe5e | vc-test-vlan2 | vlan | 2023-11-13 16:37:32 +0000 UTC |
+--------------------------------------+---------------+------+-------------------------------+


Delete Virtual-circuit
=======================

Vasubabus-MacBook-Pro:bin vasubabu$ ./metal vc delete -i 519fe0d1-170c-4c7d-aaab-63f190f8fe5e
virtual-circuit deletion initiated. Please check 'metal virtual-circuit get -i 519fe0d1-170c-4c7d-aaab-63f190f8fe5e ' for status

@codinja1188 codinja1188 requested a deployment to external November 14, 2023 21:56 — with GitHub Actions Abandoned
@ctreatma
Copy link
Copy Markdown
Contributor

The commands in your example output look like a good basis for e2e tests on the new subcommands. Could you add those?

@ctreatma
Copy link
Copy Markdown
Contributor

@codinja1188 this looks good from a testing perspective but I see a bunch of un-addressed review comments from @aayushrangwala.

Comment thread internal/virtualcircuit/create.go Outdated
Comment thread internal/virtualcircuit/retrieve.go Outdated

inc := []string{}
header := []string{"ID", "Name", "Speed", "Created"}
if vcID == "" {
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.

I think @aayushrangwala is suggesting that the param should be marked required using MarkFlagRequired as done in other cases in this PR, rather than with an explicit check for an empty string.

Comment thread internal/virtualcircuit/create.go
Comment thread internal/virtualcircuit/delete.go Outdated
},
}

deleteVirtualcircuitCmd.Flags().StringVarP(&vcID, "id", "i", "", "The UUID of the virtual-circuit.")
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.

Within the virtual-circuit subcommand, the id string should refer to the same ID. It is confusing if metal vc create -i <id> expects a connection ID and metal vc update -i <id> expects a vc ID. The create command should use a different flag for the connection ID.

Comment thread internal/virtualcircuit/delete.go Outdated
Comment thread internal/virtualcircuit/virtualcircuit.go
Comment thread internal/virtualcircuit/create.go Outdated
Comment thread internal/virtualcircuit/create.go Outdated
Comment thread internal/virtualcircuit/create.go Outdated
Comment thread internal/virtualcircuit/update.go Outdated
@codinja1188
Copy link
Copy Markdown
Contributor Author

Vasubabus-MacBook-Pro:metal-cli vasubabu$ make test
go test -v ./... -timeout 1000s
=== RUN   TestCli_RegisterCommands
=== RUN   TestCli_RegisterCommands/test
--- PASS: TestCli_RegisterCommands (0.00s)
    --- PASS: TestCli_RegisterCommands/test (0.00s)
PASS
ok  	github.com/equinix/metal-cli/cmd	(cached)
?   	github.com/equinix/metal-cli/cmd/metal	[no test files]
?   	github.com/equinix/metal-cli/internal/capacity	[no test files]
?   	github.com/equinix/metal-cli/internal/cli	[no test files]
?   	github.com/equinix/metal-cli/internal/completion	[no test files]
?   	github.com/equinix/metal-cli/internal/devices	[no test files]
?   	github.com/equinix/metal-cli/internal/docs	[no test files]
?   	github.com/equinix/metal-cli/internal/emdocs	[no test files]
?   	github.com/equinix/metal-cli/internal/env	[no test files]
?   	github.com/equinix/metal-cli/internal/events	[no test files]
?   	github.com/equinix/metal-cli/internal/facilities	[no test files]
?   	github.com/equinix/metal-cli/internal/gateway	[no test files]
?   	github.com/equinix/metal-cli/internal/hardware	[no test files]
?   	github.com/equinix/metal-cli/internal/init	[no test files]
?   	github.com/equinix/metal-cli/internal/interconnections	[no test files]
?   	github.com/equinix/metal-cli/internal/ips	[no test files]
?   	github.com/equinix/metal-cli/internal/metros	[no test files]
?   	github.com/equinix/metal-cli/internal/organizations	[no test files]
?   	github.com/equinix/metal-cli/internal/os	[no test files]
?   	github.com/equinix/metal-cli/internal/outputs	[no test files]
?   	github.com/equinix/metal-cli/internal/pagination	[no test files]
?   	github.com/equinix/metal-cli/internal/plans	[no test files]
?   	github.com/equinix/metal-cli/internal/ports	[no test files]
?   	github.com/equinix/metal-cli/internal/projects	[no test files]
?   	github.com/equinix/metal-cli/internal/ssh	[no test files]
?   	github.com/equinix/metal-cli/internal/twofa	[no test files]
?   	github.com/equinix/metal-cli/internal/users	[no test files]
?   	github.com/equinix/metal-cli/internal/virtualcircuit	[no test files]
?   	github.com/equinix/metal-cli/internal/vlan	[no test files]
?   	github.com/equinix/metal-cli/internal/vrf	[no test files]
=== RUN   TestCli_Capacity
=== RUN   TestCli_Capacity/get
=== RUN   TestCli_Capacity/get_by_plan_1
=== RUN   TestCli_Capacity/get_by_plan_2
=== RUN   TestCli_Capacity/check_by_multi_metro
=== RUN   TestCli_Capacity/check_by_multi_plan
=== RUN   TestCli_Capacity/check_by_multi_metro_and_plan
--- PASS: TestCli_Capacity (4.93s)
    --- PASS: TestCli_Capacity/get (1.03s)
    --- PASS: TestCli_Capacity/get_by_plan_1 (1.07s)
    --- PASS: TestCli_Capacity/get_by_plan_2 (0.87s)
    --- PASS: TestCli_Capacity/check_by_multi_metro (0.56s)
    --- PASS: TestCli_Capacity/check_by_multi_plan (0.65s)
    --- PASS: TestCli_Capacity/check_by_multi_metro_and_plan (0.74s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/capacitytest	5.075s
=== RUN   TestCli_Devices_Create_Flags
=== RUN   TestCli_Devices_Create_Flags/create_device
--- PASS: TestCli_Devices_Create_Flags (133.99s)
    --- PASS: TestCli_Devices_Create_Flags/create_device (133.99s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/devicecreateflagstest	(cached)
=== RUN   TestCli_Devices_Create
=== RUN   TestCli_Devices_Create/create_device
--- PASS: TestCli_Devices_Create (154.24s)
    --- PASS: TestCli_Devices_Create/create_device (154.24s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/devicecreatetest	(cached)
=== RUN   TestCli_Devices_Get
=== RUN   TestCli_Devices_Get/get_by_device_id
--- PASS: TestCli_Devices_Get (197.00s)
    --- PASS: TestCli_Devices_Get/get_by_device_id (197.00s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/devicegettest	(cached)
=== RUN   TestCli_Devices_Update
=== RUN   TestCli_Devices_Update/reinstall_device
--- PASS: TestCli_Devices_Update (736.43s)
    --- PASS: TestCli_Devices_Update/reinstall_device (736.43s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/devicereinstalltest	(cached)
=== RUN   TestCli_Devices_Update
=== RUN   TestCli_Devices_Update/start_device
--- PASS: TestCli_Devices_Update (165.34s)
    --- PASS: TestCli_Devices_Update/start_device (165.34s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/devicestarttest	165.695s
=== RUN   TestCli_Devices_Update
=== RUN   TestCli_Devices_Update/stop_device
--- PASS: TestCli_Devices_Update (213.22s)
    --- PASS: TestCli_Devices_Update/stop_device (213.22s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/devicestoptest	(cached)
=== RUN   TestCli_Devices_Update
=== RUN   TestCli_Devices_Update/update_device
--- PASS: TestCli_Devices_Update (192.76s)
    --- PASS: TestCli_Devices_Update/update_device (192.76s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/deviceupdatetest	(cached)
=== RUN   TestCli_Events_Get
=== RUN   TestCli_Events_Get/get_events_by_dev_id
--- PASS: TestCli_Events_Get (156.23s)
    --- PASS: TestCli_Events_Get/get_events_by_dev_id (156.23s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/events/deviceeventstest	(cached)
=== RUN   TestCli_Events_Get
=== RUN   TestCli_Events_Get/get_events_by_proj_id
--- PASS: TestCli_Events_Get (6.30s)
    --- PASS: TestCli_Events_Get/get_events_by_proj_id (6.30s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/events/projecteventstest	(cached)
=== RUN   TestGateways_Create
=== RUN   TestGateways_Create/create_gateways
--- PASS: TestGateways_Create (8.74s)
    --- PASS: TestGateways_Create/create_gateways (1.61s)
=== RUN   TestGateways_Delete
=== RUN   TestGateways_Delete/delete_gateways
--- PASS: TestGateways_Delete (4.22s)
    --- PASS: TestGateways_Delete/delete_gateways (0.97s)
=== RUN   TestGateways_Retrieve
=== RUN   TestGateways_Retrieve/retrieve_gateways_by_projectId
--- PASS: TestGateways_Retrieve (8.06s)
    --- PASS: TestGateways_Retrieve/retrieve_gateways_by_projectId (0.49s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/gateways	21.481s
=== RUN   TestCli_Ips_Get
=== RUN   TestCli_Ips_Get/get_ip_reservations
    ips_get_test.go:38: Skipping this test because someCondition is true
--- PASS: TestCli_Ips_Get (0.00s)
    --- SKIP: TestCli_Ips_Get/get_ip_reservations (0.00s)
=== RUN   TestCli_Vlan_Create
=== RUN   TestCli_Vlan_Create/Request_NewIP
    ips_request_test.go:36: Skipping temporarily for now
--- PASS: TestCli_Vlan_Create (0.00s)
    --- SKIP: TestCli_Vlan_Create/Request_NewIP (0.00s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/ipstest	(cached)
=== RUN   TestCli_Metros
=== RUN   TestCli_Metros/get
--- PASS: TestCli_Metros (0.49s)
    --- PASS: TestCli_Metros/get (0.49s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/metrotest	(cached)
=== RUN   TestCli_Organization
=== RUN   TestCli_Organization/get
+--------------------------------------+---------------------------------+-------------------------------+
|                  ID                  |              NAME               |            CREATED            |
+--------------------------------------+---------------------------------+-------------------------------+
| 4d12f460-8c5e-43ea-986d-529d328815ee | DevRel Engineering (Playground) | 2023-08-03 20:50:33 +0000 UTC |
+--------------------------------------+---------------------------------+-------------------------------+
--- PASS: TestCli_Organization (0.58s)
    --- PASS: TestCli_Organization/get (0.58s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/organizationtest	(cached)
=== RUN   TestCli_OperatingSystem
=== RUN   TestCli_OperatingSystem/get
--- PASS: TestCli_OperatingSystem (0.94s)
    --- PASS: TestCli_OperatingSystem/get (0.94s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/ostest	(cached)
=== RUN   TestCli_Plans
=== RUN   TestCli_Plans/get
=== RUN   TestCli_Plans/get_by_slug
=== RUN   TestCli_Plans/get_by_type
--- PASS: TestCli_Plans (2.80s)
    --- PASS: TestCli_Plans/get (1.59s)
    --- PASS: TestCli_Plans/get_by_slug (0.46s)
    --- PASS: TestCli_Plans/get_by_type (0.74s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/plantest	(cached)
=== RUN   TestPorts_Convert
=== RUN   TestPorts_Convert/convert_port_layer-2_bonded_false
=== RUN   TestPorts_Convert/convert_port_layer-2_bonded_true
=== RUN   TestPorts_Convert/convert_port_layer-3_bonded_true
2024/01/16 19:28:21 Converting port 59536d99-9c42-4e23-919f-6d4f826052ad to layer-3
--- PASS: TestPorts_Convert (232.53s)
    --- PASS: TestPorts_Convert/convert_port_layer-2_bonded_false (21.74s)
    --- PASS: TestPorts_Convert/convert_port_layer-2_bonded_true (10.21s)
    --- PASS: TestPorts_Convert/convert_port_layer-3_bonded_true (10.95s)
=== RUN   TestPorts_Retrieve
    retrieve_test.go:19: Error when calling `DevicesApi.FindDeviceById`: 403 Forbidden You are not authorized to view this device

--- FAIL: TestPorts_Retrieve (90.21s)
=== RUN   TestPorts_VLANs
=== RUN   TestPorts_VLANs/vlan_assignment_port
--- PASS: TestPorts_VLANs (220.29s)
    --- PASS: TestPorts_VLANs/vlan_assignment_port (11.37s)
FAIL
FAIL	github.com/equinix/metal-cli/test/e2e/ports	543.257s
=== RUN   TestCli_Project_Tests
=== RUN   TestCli_Project_Tests/project-create-test
=== RUN   TestCli_Project_Tests/project-update-test
=== RUN   TestCli_Project_Tests/project-get-test
=== RUN   TestCli_Project_Tests/project-get-id-test
=== RUN   TestCli_Project_Tests/project-delete-test
=== RUN   TestCli_Project_Tests/project-bgpenbale-test
=== RUN   TestCli_Project_Tests/project-bgpconfig-test
--- PASS: TestCli_Project_Tests (28.49s)
    --- PASS: TestCli_Project_Tests/project-create-test (2.47s)
    --- PASS: TestCli_Project_Tests/project-update-test (1.70s)
    --- PASS: TestCli_Project_Tests/project-get-test (10.03s)
    --- PASS: TestCli_Project_Tests/project-get-id-test (1.39s)
    --- PASS: TestCli_Project_Tests/project-delete-test (4.87s)
    --- PASS: TestCli_Project_Tests/project-bgpenbale-test (5.94s)
    --- PASS: TestCli_Project_Tests/project-bgpconfig-test (2.09s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/projecttest	(cached)
=== RUN   TestCli_SshKey
=== RUN   TestCli_SshKey/get
--- PASS: TestCli_SshKey (0.59s)
    --- PASS: TestCli_SshKey/get (0.59s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/sshtest	(cached)
=== RUN   TestCli_Users
=== RUN   TestCli_Users/get
--- PASS: TestCli_Users (0.60s)
    --- PASS: TestCli_Users/get (0.60s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/usertest	(cached)
=== RUN   TestCli_Vc_Test
=== RUN   TestCli_Vc_Test/create-virtual-circuit
=== RUN   TestCli_Vc_Test/delete-virtual-circuit
=== RUN   TestCli_Vc_Test/get-virtual-circuit
=== RUN   TestCli_Vc_Test/update-virtual-circuit
--- PASS: TestCli_Vc_Test (26.87s)
    --- PASS: TestCli_Vc_Test/create-virtual-circuit (5.28s)
    --- PASS: TestCli_Vc_Test/delete-virtual-circuit (5.58s)
    --- PASS: TestCli_Vc_Test/get-virtual-circuit (9.27s)
    --- PASS: TestCli_Vc_Test/update-virtual-circuit (6.74s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/virtualcircuittest	(cached)
=== RUN   TestCli_Vlan_Test
=== RUN   TestCli_Vlan_Test/create_virtual_network
=== RUN   TestCli_Vlan_Test/delete_virtual_network
=== RUN   TestCli_Vlan_Test/get_virtual_network
--- PASS: TestCli_Vlan_Test (8.01s)
    --- PASS: TestCli_Vlan_Test/create_virtual_network (2.63s)
    --- PASS: TestCli_Vlan_Test/delete_virtual_network (2.52s)
    --- PASS: TestCli_Vlan_Test/get_virtual_network (2.86s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/vlan	(cached)
?   	github.com/equinix/metal-cli/test/helper	[no test files]
FAIL
make: *** [test] Error 1
Vasubabus-MacBook-Pro:metal-cli vasubabu$ go clean -testcache
Vasubabus-MacBook-Pro:metal-cli vasubabu$ go clean -testcache
Vasubabus-MacBook-Pro:metal-cli vasubabu$
Vasubabus-MacBook-Pro:metal-cli vasubabu$
Vasubabus-MacBook-Pro:metal-cli vasubabu$
Vasubabus-MacBook-Pro:metal-cli vasubabu$
Vasubabus-MacBook-Pro:metal-cli vasubabu$
Vasubabus-MacBook-Pro:metal-cli vasubabu$
Vasubabus-MacBook-Pro:metal-cli vasubabu$ git branch
  bgp
  capacity
  depre-promptui
  device-enhance
  events
  gateways
  hardware
  ipReservations
  main
  org-improvements
  organizations
  os-unit-improvement
  ports
  promptui-delete
  refine-tests
  twofa
* virtual-circuit
  vlans
  vrf-routes
  vrfs-test
Vasubabus-MacBook-Pro:metal-cli vasubabu$ make test
go test -v ./... -timeout 1000s
=== RUN   TestCli_RegisterCommands
=== RUN   TestCli_RegisterCommands/test
--- PASS: TestCli_RegisterCommands (0.00s)
    --- PASS: TestCli_RegisterCommands/test (0.00s)
PASS
ok  	github.com/equinix/metal-cli/cmd	0.556s
?   	github.com/equinix/metal-cli/cmd/metal	[no test files]
?   	github.com/equinix/metal-cli/internal/capacity	[no test files]
?   	github.com/equinix/metal-cli/internal/cli	[no test files]
?   	github.com/equinix/metal-cli/internal/completion	[no test files]
?   	github.com/equinix/metal-cli/internal/devices	[no test files]
?   	github.com/equinix/metal-cli/internal/docs	[no test files]
?   	github.com/equinix/metal-cli/internal/emdocs	[no test files]
?   	github.com/equinix/metal-cli/internal/env	[no test files]
?   	github.com/equinix/metal-cli/internal/events	[no test files]
?   	github.com/equinix/metal-cli/internal/facilities	[no test files]
?   	github.com/equinix/metal-cli/internal/gateway	[no test files]
?   	github.com/equinix/metal-cli/internal/hardware	[no test files]
?   	github.com/equinix/metal-cli/internal/init	[no test files]
?   	github.com/equinix/metal-cli/internal/interconnections	[no test files]
?   	github.com/equinix/metal-cli/internal/ips	[no test files]
?   	github.com/equinix/metal-cli/internal/metros	[no test files]
?   	github.com/equinix/metal-cli/internal/organizations	[no test files]
?   	github.com/equinix/metal-cli/internal/os	[no test files]
?   	github.com/equinix/metal-cli/internal/outputs	[no test files]
?   	github.com/equinix/metal-cli/internal/pagination	[no test files]
?   	github.com/equinix/metal-cli/internal/plans	[no test files]
?   	github.com/equinix/metal-cli/internal/ports	[no test files]
?   	github.com/equinix/metal-cli/internal/projects	[no test files]
?   	github.com/equinix/metal-cli/internal/ssh	[no test files]
?   	github.com/equinix/metal-cli/internal/twofa	[no test files]
?   	github.com/equinix/metal-cli/internal/users	[no test files]
?   	github.com/equinix/metal-cli/internal/virtualcircuit	[no test files]
?   	github.com/equinix/metal-cli/internal/vlan	[no test files]
?   	github.com/equinix/metal-cli/internal/vrf	[no test files]
=== RUN   TestCli_Capacity
=== RUN   TestCli_Capacity/get
=== RUN   TestCli_Capacity/get_by_plan_1
=== RUN   TestCli_Capacity/get_by_plan_2
=== RUN   TestCli_Capacity/check_by_multi_metro
=== RUN   TestCli_Capacity/check_by_multi_plan
=== RUN   TestCli_Capacity/check_by_multi_metro_and_plan
--- PASS: TestCli_Capacity (9.37s)
    --- PASS: TestCli_Capacity/get (3.33s)
    --- PASS: TestCli_Capacity/get_by_plan_1 (3.36s)
    --- PASS: TestCli_Capacity/get_by_plan_2 (0.89s)
    --- PASS: TestCli_Capacity/check_by_multi_metro (0.54s)
    --- PASS: TestCli_Capacity/check_by_multi_plan (0.58s)
    --- PASS: TestCli_Capacity/check_by_multi_metro_and_plan (0.67s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/capacitytest	11.848s
=== RUN   TestCli_Devices_Create_Flags
=== RUN   TestCli_Devices_Create_Flags/create_device
--- PASS: TestCli_Devices_Create_Flags (124.20s)
    --- PASS: TestCli_Devices_Create_Flags/create_device (124.20s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/devicecreateflagstest	127.708s
=== RUN   TestCli_Devices_Create
=== RUN   TestCli_Devices_Create/create_device
--- PASS: TestCli_Devices_Create (192.77s)
    --- PASS: TestCli_Devices_Create/create_device (192.77s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/devicecreatetest	194.107s
=== RUN   TestCli_Devices_Get
=== RUN   TestCli_Devices_Get/get_by_device_id
--- PASS: TestCli_Devices_Get (161.58s)
    --- PASS: TestCli_Devices_Get/get_by_device_id (161.58s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/devicegettest	164.707s
=== RUN   TestCli_Devices_Update
=== RUN   TestCli_Devices_Update/reinstall_device
--- PASS: TestCli_Devices_Update (695.27s)
    --- PASS: TestCli_Devices_Update/reinstall_device (695.27s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/devicereinstalltest	696.936s
=== RUN   TestCli_Devices_Update
=== RUN   TestCli_Devices_Update/start_device
--- PASS: TestCli_Devices_Update (192.62s)
    --- PASS: TestCli_Devices_Update/start_device (192.62s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/devicestarttest	194.614s
=== RUN   TestCli_Devices_Update
=== RUN   TestCli_Devices_Update/stop_device
--- PASS: TestCli_Devices_Update (192.73s)
    --- PASS: TestCli_Devices_Update/stop_device (192.73s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/devicestoptest	193.629s
=== RUN   TestCli_Devices_Update
=== RUN   TestCli_Devices_Update/update_device
--- PASS: TestCli_Devices_Update (193.89s)
    --- PASS: TestCli_Devices_Update/update_device (193.88s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/deviceupdatetest	196.679s
=== RUN   TestCli_Events_Get
=== RUN   TestCli_Events_Get/get_events_by_dev_id
--- PASS: TestCli_Events_Get (169.27s)
    --- PASS: TestCli_Events_Get/get_events_by_dev_id (169.27s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/events/deviceeventstest	173.126s
=== RUN   TestCli_Events_Get
=== RUN   TestCli_Events_Get/get_events_by_proj_id
--- PASS: TestCli_Events_Get (2.53s)
    --- PASS: TestCli_Events_Get/get_events_by_proj_id (2.53s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/events/projecteventstest	5.924s
=== RUN   TestGateways_Create
=== RUN   TestGateways_Create/create_gateways
--- PASS: TestGateways_Create (4.13s)
    --- PASS: TestGateways_Create/create_gateways (1.73s)
=== RUN   TestGateways_Delete
=== RUN   TestGateways_Delete/delete_gateways
--- PASS: TestGateways_Delete (4.46s)
    --- PASS: TestGateways_Delete/delete_gateways (0.94s)
=== RUN   TestGateways_Retrieve
=== RUN   TestGateways_Retrieve/retrieve_gateways_by_projectId
--- PASS: TestGateways_Retrieve (4.25s)
    --- PASS: TestGateways_Retrieve/retrieve_gateways_by_projectId (0.43s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/gateways	13.303s
=== RUN   TestCli_Ips_Get
=== RUN   TestCli_Ips_Get/get_ip_reservations
    ips_get_test.go:38: Skipping this test because someCondition is true
--- PASS: TestCli_Ips_Get (0.00s)
    --- SKIP: TestCli_Ips_Get/get_ip_reservations (0.00s)
=== RUN   TestCli_Vlan_Create
=== RUN   TestCli_Vlan_Create/Request_NewIP
    ips_request_test.go:36: Skipping temporarily for now
--- PASS: TestCli_Vlan_Create (0.00s)
    --- SKIP: TestCli_Vlan_Create/Request_NewIP (0.00s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/ipstest	0.429s
=== RUN   TestCli_Metros
=== RUN   TestCli_Metros/get
--- PASS: TestCli_Metros (0.49s)
    --- PASS: TestCli_Metros/get (0.49s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/metrotest	0.881s
=== RUN   TestCli_Organization
=== RUN   TestCli_Organization/get
+--------------------------------------+---------------------------------+-------------------------------+
|                  ID                  |              NAME               |            CREATED            |
+--------------------------------------+---------------------------------+-------------------------------+
| 4d12f460-8c5e-43ea-986d-529d328815ee | DevRel Engineering (Playground) | 2023-08-03 20:50:33 +0000 UTC |
+--------------------------------------+---------------------------------+-------------------------------+
--- PASS: TestCli_Organization (0.78s)
    --- PASS: TestCli_Organization/get (0.78s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/organizationtest	1.180s
=== RUN   TestCli_OperatingSystem
=== RUN   TestCli_OperatingSystem/get
--- PASS: TestCli_OperatingSystem (1.04s)
    --- PASS: TestCli_OperatingSystem/get (1.04s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/ostest	1.428s
=== RUN   TestCli_Plans
=== RUN   TestCli_Plans/get
=== RUN   TestCli_Plans/get_by_slug
=== RUN   TestCli_Plans/get_by_type
--- PASS: TestCli_Plans (3.19s)
    --- PASS: TestCli_Plans/get (1.84s)
    --- PASS: TestCli_Plans/get_by_slug (0.43s)
    --- PASS: TestCli_Plans/get_by_type (0.93s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/plantest	3.589s
=== RUN   TestPorts_Convert
=== RUN   TestPorts_Convert/convert_port_layer-2_bonded_false
=== RUN   TestPorts_Convert/convert_port_layer-2_bonded_true
=== RUN   TestPorts_Convert/convert_port_layer-3_bonded_true
2024/01/16 21:20:31 Converting port d63be07b-3e65-4713-9168-d6c115fd1626 to layer-3
--- PASS: TestPorts_Convert (217.89s)
    --- PASS: TestPorts_Convert/convert_port_layer-2_bonded_false (22.04s)
    --- PASS: TestPorts_Convert/convert_port_layer-2_bonded_true (7.68s)
    --- PASS: TestPorts_Convert/convert_port_layer-3_bonded_true (9.45s)
=== RUN   TestPorts_Retrieve
=== RUN   TestPorts_Retrieve/retrieve_port
--- PASS: TestPorts_Retrieve (180.76s)
    --- PASS: TestPorts_Retrieve/retrieve_port (0.44s)
=== RUN   TestPorts_VLANs
=== RUN   TestPorts_VLANs/vlan_assignment_port
--- PASS: TestPorts_VLANs (202.76s)
    --- PASS: TestPorts_VLANs/vlan_assignment_port (11.29s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/ports	601.843s
=== RUN   TestCli_Project_Tests
=== RUN   TestCli_Project_Tests/project-create-test
=== RUN   TestCli_Project_Tests/project-update-test
=== RUN   TestCli_Project_Tests/project-get-test
=== RUN   TestCli_Project_Tests/project-get-id-test
=== RUN   TestCli_Project_Tests/project-delete-test
=== RUN   TestCli_Project_Tests/project-bgpenbale-test
=== RUN   TestCli_Project_Tests/project-bgpconfig-test
--- PASS: TestCli_Project_Tests (14.12s)
    --- PASS: TestCli_Project_Tests/project-create-test (3.50s)
    --- PASS: TestCli_Project_Tests/project-update-test (1.81s)
    --- PASS: TestCli_Project_Tests/project-get-test (2.02s)
    --- PASS: TestCli_Project_Tests/project-get-id-test (1.73s)
    --- PASS: TestCli_Project_Tests/project-delete-test (1.63s)
    --- PASS: TestCli_Project_Tests/project-bgpenbale-test (1.52s)
    --- PASS: TestCli_Project_Tests/project-bgpconfig-test (1.92s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/projecttest	14.428s
=== RUN   TestCli_SshKey
=== RUN   TestCli_SshKey/get
--- PASS: TestCli_SshKey (0.58s)
    --- PASS: TestCli_SshKey/get (0.58s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/sshtest	1.250s
=== RUN   TestCli_Users
=== RUN   TestCli_Users/get
--- PASS: TestCli_Users (0.61s)
    --- PASS: TestCli_Users/get (0.61s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/usertest	1.021s
=== RUN   TestCli_Vc_Test
=== RUN   TestCli_Vc_Test/create-virtual-circuit
=== RUN   TestCli_Vc_Test/delete-virtual-circuit
=== RUN   TestCli_Vc_Test/get-virtual-circuit
=== RUN   TestCli_Vc_Test/update-virtual-circuit
--- PASS: TestCli_Vc_Test (21.65s)
    --- PASS: TestCli_Vc_Test/create-virtual-circuit (4.84s)
    --- PASS: TestCli_Vc_Test/delete-virtual-circuit (5.21s)
    --- PASS: TestCli_Vc_Test/get-virtual-circuit (5.34s)
    --- PASS: TestCli_Vc_Test/update-virtual-circuit (6.27s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/virtualcircuittest	22.205s
=== RUN   TestCli_Vlan_Test
=== RUN   TestCli_Vlan_Test/create_virtual_network
=== RUN   TestCli_Vlan_Test/delete_virtual_network
=== RUN   TestCli_Vlan_Test/get_virtual_network
--- PASS: TestCli_Vlan_Test (8.03s)
    --- PASS: TestCli_Vlan_Test/create_virtual_network (2.39s)
    --- PASS: TestCli_Vlan_Test/delete_virtual_network (2.70s)
    --- PASS: TestCli_Vlan_Test/get_virtual_network (2.93s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/vlan	8.492s
?   	github.com/equinix/metal-cli/test/helper	[no test files]
Vasubabus-MacBook-Pro:metal-cli vasubabu$ git branch
  bgp
  capacity
  depre-promptui
  device-enhance
  events
  gateways
  hardware
  ipReservations
  main
  org-improvements
  organizations
  os-unit-improvement
  ports
  promptui-delete
  refine-tests
  twofa
* virtual-circuit
  vlans
  vrf-routes
  vrfs-test

Comment thread docs/metal_virtual-circuit_update.md Outdated
@ctreatma
Copy link
Copy Markdown
Contributor

The latest test run failed during cleanup for a test:

=== RUN   TestCli_Vc_Test/update-virtual-circuit
    helper.go:327: Error when calling `VLANsApi.DeleteVirtualNetwork`` for cb196208-4d51-43fc-85a4-88b1dbe119cd: 422 Unprocessable Entity Cannot delete Virtual Network when associated to a virtual circuit
--- FAIL: TestCli_Vc_Test (10.89s)

A 422 on delete usually indicates that the code is doing something wrong (as opposed to an intermittent platform issue). Do these failures not happen when you run the tests locally?

@ctreatma
Copy link
Copy Markdown
Contributor

A 422 on delete usually indicates that the code is doing something wrong (as opposed to an intermittent platform issue). Do these failures not happen when you run the tests locally?

A re-run of the tests passed, so the failures do not happen consistently. I'm doing a 3rd run now to get a feel for the failure rate. I'm guessing this is some kind of timing issue: the tests pass if the platform happens to handle the cleanup requests quickly enough, but if there's a delay somewhere in the deletion process, the tests fail. If that's the case we can merge as-is and shore up the tests in a separate PR. Ideally that separate PR wouldn't come in until after all the other in-flight PRs are merged, but if the intermittent failures are causing too many problems for review we may need to fix them sooner.

@codinja1188
Copy link
Copy Markdown
Contributor Author

The latest test run failed during cleanup for a test:

=== RUN   TestCli_Vc_Test/update-virtual-circuit
    helper.go:327: Error when calling `VLANsApi.DeleteVirtualNetwork`` for cb196208-4d51-43fc-85a4-88b1dbe119cd: 422 Unprocessable Entity Cannot delete Virtual Network when associated to a virtual circuit
--- FAIL: TestCli_Vc_Test (10.89s)

A 422 on delete usually indicates that the code is doing something wrong (as opposed to an intermittent platform issue). Do these failures not happen when you run the tests locally?

Not observed in local run

Copy link
Copy Markdown
Contributor

@ctreatma ctreatma left a comment

Choose a reason for hiding this comment

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

Tests added in this PR passed 2 out of 3 times in CI, so this can go in as-is and we can improve the resilience of the tests later.

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