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

fix: updated e2e test cases for VRFS #393

Merged
merged 1 commit into from
Jan 23, 2024
Merged

Conversation

codinja1188
Copy link
Contributor

@codinja1188 codinja1188 commented Nov 22, 2023

  • some Improvement in VRF sub-commands
  • Improved port e2e tests
  • E2E VRF test cases

Part of #436

@codinja1188 codinja1188 marked this pull request as ready for review November 22, 2023 16:52
test/helper/helper.go Outdated Show resolved Hide resolved
@ctreatma
Copy link
Contributor

ctreatma commented Jan 5, 2024

At least one VRF test is failing in the latest run; start of error output is Error: required flag(s) "project-id" not set: https://github.com/equinix/metal-cli/actions/runs/7412860080/job/20170604176?pr=393#step:5:230

cprivitere

This comment was marked as resolved.

@cprivitere
Copy link
Contributor

cprivitere commented Jan 19, 2024

Nevermind, everything with project delete is working fine after a rebase. Now the problems are in vrfs tests specifically.

Error: error when calling `VRFsApi.FindVrfById``: unsupported protocol scheme ""

Maybe the test project isn't allowed to have VRFs?

@codinja1188
Copy link
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	1.517s
?   	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 (7.10s)
    --- PASS: TestCli_Capacity/get (1.71s)
    --- PASS: TestCli_Capacity/get_by_plan_1 (2.65s)
    --- PASS: TestCli_Capacity/get_by_plan_2 (1.00s)
    --- PASS: TestCli_Capacity/check_by_multi_metro (0.54s)
    --- PASS: TestCli_Capacity/check_by_multi_plan (0.55s)
    --- PASS: TestCli_Capacity/check_by_multi_metro_and_plan (0.66s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/capacitytest	7.635s
=== RUN   TestCli_Devices_Create_Flags
=== RUN   TestCli_Devices_Create_Flags/create_device
--- PASS: TestCli_Devices_Create_Flags (101.37s)
    --- PASS: TestCli_Devices_Create_Flags/create_device (101.37s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/devicecreateflagstest	102.156s
=== RUN   TestCli_Devices_Create
=== RUN   TestCli_Devices_Create/create_device
--- PASS: TestCli_Devices_Create (176.61s)
    --- PASS: TestCli_Devices_Create/create_device (176.61s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/devicecreatetest	177.652s
=== RUN   TestCli_Devices_Get
=== RUN   TestCli_Devices_Get/get_by_device_id
--- PASS: TestCli_Devices_Get (176.00s)
    --- PASS: TestCli_Devices_Get/get_by_device_id (176.00s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/devicegettest	176.283s
=== RUN   TestCli_Devices_Update
=== RUN   TestCli_Devices_Update/reinstall_device
--- PASS: TestCli_Devices_Update (894.88s)
    --- PASS: TestCli_Devices_Update/reinstall_device (894.88s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/devicereinstalltest	896.135s
=== RUN   TestCli_Devices_Update
=== RUN   TestCli_Devices_Update/start_device
--- PASS: TestCli_Devices_Update (165.30s)
    --- PASS: TestCli_Devices_Update/start_device (165.30s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/devicestarttest	167.115s
=== RUN   TestCli_Devices_Update
=== RUN   TestCli_Devices_Update/stop_device
--- PASS: TestCli_Devices_Update (165.86s)
    --- PASS: TestCli_Devices_Update/stop_device (165.86s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/devicestoptest	167.914s
=== RUN   TestCli_Devices_Update
=== RUN   TestCli_Devices_Update/update_device
--- PASS: TestCli_Devices_Update (168.72s)
    --- PASS: TestCli_Devices_Update/update_device (168.72s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/devices/deviceupdatetest	171.000s
=== RUN   TestCli_Events_Get
=== RUN   TestCli_Events_Get/get_events_by_dev_id
--- PASS: TestCli_Events_Get (176.25s)
    --- PASS: TestCli_Events_Get/get_events_by_dev_id (176.25s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/events/deviceeventstest	178.757s
=== RUN   TestCli_Events_Get
=== RUN   TestCli_Events_Get/get_events_by_proj_id
--- PASS: TestCli_Events_Get (2.21s)
    --- PASS: TestCli_Events_Get/get_events_by_proj_id (2.21s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/events/projecteventstest	3.166s
=== RUN   TestGateways_Create
=== RUN   TestGateways_Create/create_gateways
--- PASS: TestGateways_Create (4.18s)
    --- PASS: TestGateways_Create/create_gateways (1.65s)
=== RUN   TestGateways_Delete
=== RUN   TestGateways_Delete/delete_gateways
--- PASS: TestGateways_Delete (4.36s)
    --- PASS: TestGateways_Delete/delete_gateways (0.88s)
=== RUN   TestGateways_Retrieve
=== RUN   TestGateways_Retrieve/retrieve_gateways_by_projectId
--- PASS: TestGateways_Retrieve (4.51s)
    --- PASS: TestGateways_Retrieve/retrieve_gateways_by_projectId (0.60s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/gateways	13.335s
=== RUN   TestCli_Hardware
=== RUN   TestCli_Hardware/get
--- PASS: TestCli_Hardware (1.29s)
    --- PASS: TestCli_Hardware/get (1.29s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/hardwaretest	1.602s
=== 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.303s
=== RUN   TestCli_Metros
=== RUN   TestCli_Metros/get
--- PASS: TestCli_Metros (0.60s)
    --- PASS: TestCli_Metros/get (0.60s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/metrotest	0.892s
=== 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.68s)
    --- PASS: TestCli_Organization/get (0.68s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/organizationtest	0.979s
=== RUN   TestCli_OperatingSystem
=== RUN   TestCli_OperatingSystem/get
--- PASS: TestCli_OperatingSystem (0.90s)
    --- PASS: TestCli_OperatingSystem/get (0.90s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/ostest	1.203s
=== RUN   TestCli_Plans
=== RUN   TestCli_Plans/get
=== RUN   TestCli_Plans/get_by_slug
=== RUN   TestCli_Plans/get_by_type
--- PASS: TestCli_Plans (2.83s)
    --- PASS: TestCli_Plans/get (1.62s)
    --- PASS: TestCli_Plans/get_by_slug (0.47s)
    --- PASS: TestCli_Plans/get_by_type (0.74s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/plantest	3.128s
=== 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/23 04:03:05 Converting port a6f37738-6cb9-4c8b-80ad-f88874f33ba8 to layer-3
--- PASS: TestPorts_Convert (206.80s)
    --- PASS: TestPorts_Convert/convert_port_layer-2_bonded_false (22.67s)
    --- PASS: TestPorts_Convert/convert_port_layer-2_bonded_true (8.73s)
    --- PASS: TestPorts_Convert/convert_port_layer-3_bonded_true (9.00s)
=== RUN   TestPorts_Retrieve
=== RUN   TestPorts_Retrieve/retrieve_port
--- PASS: TestPorts_Retrieve (155.56s)
    --- PASS: TestPorts_Retrieve/retrieve_port (0.43s)
=== RUN   TestPorts_VLANs
=== RUN   TestPorts_VLANs/vlan_assignment_port
--- PASS: TestPorts_VLANs (213.12s)
    --- PASS: TestPorts_VLANs/vlan_assignment_port (16.17s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/ports	575.799s
=== 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 (13.92s)
    --- PASS: TestCli_Project_Tests/project-create-test (2.51s)
    --- PASS: TestCli_Project_Tests/project-update-test (2.08s)
    --- PASS: TestCli_Project_Tests/project-get-test (2.02s)
    --- PASS: TestCli_Project_Tests/project-get-id-test (1.99s)
    --- PASS: TestCli_Project_Tests/project-delete-test (1.50s)
    --- PASS: TestCli_Project_Tests/project-bgpenbale-test (1.55s)
    --- PASS: TestCli_Project_Tests/project-bgpconfig-test (2.27s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/projecttest	14.228s
=== RUN   TestCli_SshKey
=== RUN   TestCli_SshKey/get
--- PASS: TestCli_SshKey (1.14s)
    --- PASS: TestCli_SshKey/get (1.14s)
PASS
1   fix: updated e2e test cases for VRFS
ok  	github.com/equinix/metal-cli/test/e2e/sshtest	1.456s
=== RUN   TestCli_Users
=== RUN   TestCli_Users/get
--- PASS: TestCli_Users (0.58s)
    --- PASS: TestCli_Users/get (0.58s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/usertest	0.881s
=== 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 (20.94s)
    --- PASS: TestCli_Vc_Test/create-virtual-circuit (5.29s)
    --- PASS: TestCli_Vc_Test/delete-virtual-circuit (5.01s)
    --- PASS: TestCli_Vc_Test/get-virtual-circuit (4.89s)
    --- PASS: TestCli_Vc_Test/update-virtual-circuit (5.75s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/virtualcircuittest	21.262s
=== 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 (7.31s)
    --- PASS: TestCli_Vlan_Test/create_virtual_network (2.13s)
    --- PASS: TestCli_Vlan_Test/delete_virtual_network (2.59s)
    --- PASS: TestCli_Vlan_Test/get_virtual_network (2.59s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/vlan	7.619s
=== RUN   TestCli_Vrf_Create
=== RUN   TestCli_Vrf_Create/vrf-create-test
=== RUN   TestCli_Vrf_Create/vrf-delete-test
=== RUN   TestCli_Vrf_Create/vrf-list-test
=== RUN   TestCli_Vrf_Create/vrf-get-test
--- PASS: TestCli_Vrf_Create (14.01s)
    --- PASS: TestCli_Vrf_Create/vrf-create-test (2.15s)
    --- PASS: TestCli_Vrf_Create/vrf-delete-test (6.74s)
    --- PASS: TestCli_Vrf_Create/vrf-list-test (2.66s)
    --- PASS: TestCli_Vrf_Create/vrf-get-test (2.46s)
PASS
ok  	github.com/equinix/metal-cli/test/e2e/vrfstest	14.321s
?   	github.com/equinix/metal-cli/test/helper	[no test files

@displague
Copy link
Member

displague commented Jan 23, 2024

Looks like this test is failing. Your local test probably didn't encounter this because metal init defines a default project_id in ~/.config/equinix/metal.yaml (you can comment project and organization out for local testing that better represents the GH Action testing). We'll want to make sure project_id is defined as optional when --id (VRF ID) is present.

metal vrf get [-p <project_id> | -i <vrf_id>] [flags]

=== RUN   TestCli_Vrf_Create/vrf-get-test
Error: required flag(s) "project-id" not set
Usage:
  metal vrf get -p <project_Id>  [flags]

Aliases:
  get, list

Examples:
 # Gets the details of the specified device
  metal vrf get -v 3b0795ba-ec9a-4a9e-83a7-043e7e11407c

  # Lists VRFs for project 3b0795ba-ec9a-4a9e-83a7-043e7e11407c:
  metal vrf list -p 3b0795ba-ec9a-4a9e-83a7-043e7e11407c

Flags:
  -h, --help                help for get
  -m, --metro string        Filter by Metro ID (uuid) or Metro Code
  -p, --project-id string   The project's UUID. This flag is required, unless specified in the config created by metal init or set as METAL_PROJECT_ID environment variable.
  -v, --vrf-id string       Specify the VRF UUID.

Global Flags:
      --config string         Path to JSON or YAML configuration file (METAL_CONFIG)
      --exclude strings       Comma separated Href references to collapse in results, may be dotted three levels deep
      --filter stringArray    Filter 'get' actions with name value pairs. Filter is not supported by all resources and is implemented as request query parameters.
      --http-header strings   Headers to add to requests (in format key=value)
      --include strings       Comma separated Href references to expand in results, may be dotted three levels deep
  -o, --output string         Output format (*table, json, yaml). env output formats are (*sh, terraform, capp).
      --search string         Search keyword for use in 'get' actions. Search is not supported by all resources.
      --sort-by string        Sort fields for use in 'get' actions. Sort is not supported by all resources.
      --sort-dir string       Sort field direction for use in 'get' actions. Sort is not supported by all resources.
      --token string          Metal API Token (METAL_AUTH_TOKEN)

    helper.go:564: required flag(s) "project-id" not set
--- FAIL: TestCli_Vrf_Create (5.75s)
    --- PASS: TestCli_Vrf_Create/vrf-create-test (1.08s)
    --- PASS: TestCli_Vrf_Create/vrf-delete-test (1.78s)
    --- PASS: TestCli_Vrf_Create/vrf-list-test (1.68s)
    --- FAIL: TestCli_Vrf_Create/vrf-get-test (1.21s)
FAIL

Also - there is a merge conflict in helper.go to resolve.

Copy link
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.

The only test failures in CI are platform issues affecting pre-existing tests.

@ctreatma ctreatma merged commit cd49f37 into equinix:main Jan 23, 2024
5 of 6 checks passed
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