From 193060d6d76d88ff85e986bd744a068b9ec6b01d Mon Sep 17 00:00:00 2001 From: Simon Mayer Date: Wed, 4 Nov 2026 07:11:37 +0100 Subject: [PATCH 1/3] Refactor e2e tests to enable request validation --- cmd/admin/v2/switch.go | 2 + cmd/api/v2/project.go | 18 ++++--- cmd/api/v2/tenant.go | 1 + testing/e2e/test_cmd.go | 2 +- tests/e2e/admin/network_test.go | 64 ++++++++++++------------ tests/e2e/admin/partition_test.go | 62 ++++++++++++------------ tests/e2e/admin/switch_test.go | 3 ++ tests/e2e/admin/vpn_test.go | 4 +- tests/e2e/api/ip_test.go | 70 +++++++++++++-------------- tests/e2e/api/network_test.go | 66 ++++++++++++------------- tests/e2e/api/project_test.go | 19 ++++++-- tests/e2e/api/tenant_test.go | 39 +++++++++------ tests/e2e/testresources/audit.go | 6 +-- tests/e2e/testresources/images.go | 2 + tests/e2e/testresources/ips.go | 4 +- tests/e2e/testresources/networks.go | 2 +- tests/e2e/testresources/partitions.go | 4 +- tests/e2e/testresources/switch.go | 2 +- tests/e2e/testresources/tenants.go | 2 + 19 files changed, 203 insertions(+), 169 deletions(-) diff --git a/cmd/admin/v2/switch.go b/cmd/admin/v2/switch.go index bf04db1..68e336b 100644 --- a/cmd/admin/v2/switch.go +++ b/cmd/admin/v2/switch.go @@ -13,6 +13,7 @@ import ( "github.com/metal-stack/cli/cmd/config" "github.com/metal-stack/cli/cmd/sorters" "github.com/metal-stack/cli/cmd/tableprinters" + "github.com/metal-stack/cli/pkg/helpers" "github.com/metal-stack/metal-lib/pkg/genericcli" "github.com/metal-stack/metal-lib/pkg/genericcli/printers" "github.com/metal-stack/metal-lib/pkg/pointer" @@ -276,6 +277,7 @@ func (c *switchCmd) Convert(sw *apiv2.Switch) (string, any, *adminv2.SwitchServi ConsoleCommand: sw.ConsoleCommand, Nics: sw.Nics, Os: sw.Os, + UpdateMeta: helpers.UpdateMetaFromMeta(sw.Meta), }, nil } diff --git a/cmd/api/v2/project.go b/cmd/api/v2/project.go index 6c14735..6cc723f 100644 --- a/cmd/api/v2/project.go +++ b/cmd/api/v2/project.go @@ -242,14 +242,15 @@ func (c *project) Delete(id string) (*apiv2.Project, error) { func (c *project) Convert(r *apiv2.Project) (string, *apiv2.ProjectServiceCreateRequest, *apiv2.ProjectServiceUpdateRequest, error) { return r.Uuid, &apiv2.ProjectServiceCreateRequest{ - Login: r.Tenant, - Name: r.Name, - Description: r.Description, - }, &apiv2.ProjectServiceUpdateRequest{ - Project: r.Uuid, - Name: new(r.Name), - Description: new(r.Description), - }, nil + Login: r.Tenant, + Name: r.Name, + Description: r.Description, + }, &apiv2.ProjectServiceUpdateRequest{ + Project: r.Uuid, + Name: new(r.Name), + Description: new(r.Description), + UpdateMeta: helpers.UpdateMetaFromMeta(r.Meta), + }, nil } func (c *project) Update(rq *apiv2.ProjectServiceUpdateRequest) (*apiv2.Project, error) { @@ -300,6 +301,7 @@ func (c *project) updateRequestFromCLI(args []string) (*apiv2.ProjectServiceUpda Project: id, Name: pointer.PointerOrNil(viper.GetString("name")), Description: pointer.PointerOrNil(viper.GetString("description")), + UpdateMeta: &apiv2.UpdateMeta{LockingStrategy: apiv2.OptimisticLockingStrategy_OPTIMISTIC_LOCKING_STRATEGY_SERVER}, }, nil } diff --git a/cmd/api/v2/tenant.go b/cmd/api/v2/tenant.go index 2ffbef4..8fbb49f 100644 --- a/cmd/api/v2/tenant.go +++ b/cmd/api/v2/tenant.go @@ -254,6 +254,7 @@ func (c *tenant) Convert(r *apiv2.Tenant) (string, *apiv2.TenantServiceCreateReq Email: pointer.PointerOrNil(r.Email), Description: pointer.PointerOrNil(r.Description), AvatarUrl: pointer.PointerOrNil(r.AvatarUrl), + UpdateMeta: helpers.UpdateMetaFromMeta(r.Meta), }, nil } diff --git a/testing/e2e/test_cmd.go b/testing/e2e/test_cmd.go index 405464f..d624c26 100644 --- a/testing/e2e/test_cmd.go +++ b/testing/e2e/test_cmd.go @@ -28,8 +28,8 @@ type TestConfig struct { func NewRootCmd(t *testing.T, c *TestConfig) e2e_test.NewRootCmdFunc { return func() (*cobra.Command, *bytes.Buffer) { interceptors := []connect.Interceptor{ - client.NewTestInterceptor(t, c.ClientCalls), validate.NewInterceptor(), + client.NewTestInterceptor(t, c.ClientCalls), } cl, err := client.New(&client.DialConfig{ diff --git a/tests/e2e/admin/network_test.go b/tests/e2e/admin/network_test.go index d0e82f9..4be9291 100644 --- a/tests/e2e/admin/network_test.go +++ b/tests/e2e/admin/network_test.go @@ -44,7 +44,7 @@ func Test_AdminNetworkCmd_List(t *testing.T) { WantRequest: &adminv2.NetworkServiceListRequest{ Query: &apiv2.NetworkQuery{ Project: testresources.Network1().Project, - Id: &testresources.Network1().Id, + Id: new(testresources.Network1().Id), Name: testresources.Network1().Name, Description: testresources.Network1().Description, Partition: testresources.Network1().Partition, @@ -55,7 +55,7 @@ func Test_AdminNetworkCmd_List(t *testing.T) { Vrf: testresources.Network1().Vrf, ParentNetwork: testresources.Network2().ParentNetwork, AddressFamily: apiv2.NetworkAddressFamily_NETWORK_ADDRESS_FAMILY_DUAL_STACK.Enum(), - Type: &testresources.Network1().Type, + Type: new(testresources.Network1().Type), Labels: &apiv2.Labels{ Labels: map[string]string{"a": "b"}, }, @@ -73,14 +73,14 @@ func Test_AdminNetworkCmd_List(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 - └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private child f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c partition-1 ipv4-masq 192.168.1.0/24 + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 + └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private child f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 5711axzf0-4218-p7x9-3f8f-d34912dx190q ipv4-masq 192.168.1.0/24 `), WantWideTable: new(` - ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx - └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private network private child f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c partition-1 ipv4-masq 192.168.1.0/24 a=b + ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx + └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private network private child f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 5711axzf0-4218-p7x9-3f8f-d34912dx190q ipv4-masq 192.168.1.0/24 a=b `), Template: new("{{ .id }} {{ .name }}"), WantTemplate: new(` @@ -88,10 +88,10 @@ func Test_AdminNetworkCmd_List(t *testing.T) { d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private `), WantMarkdown: new(` - | ID | NAME | TYPE | PROJECT | PARTITION | NAT | PREFIXES | PREFIX USAGE | IP USAGE | - |-----------------------------------------|----------|----------|--------------------------------------|-------------|-----------|---------------------------|--------------|----------| - | 6988ebb0-9531-4f9b-a893-d7868258e2ef | internet | external | 0d81bca7-73f6-4da3-8397-4a8c52a0c583 | partition-1 | none | 10.0.0.0/16,2001:db8::/32 |   |   | - | └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 | private | child | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | partition-1 | ipv4-masq | 192.168.1.0/24 |   |   | + | ID | NAME | TYPE | PROJECT | PARTITION | NAT | PREFIXES | PREFIX USAGE | IP USAGE | + |-----------------------------------------|----------|----------|--------------------------------------|---------------------------------------|-----------|---------------------------|--------------|----------| + | 6988ebb0-9531-4f9b-a893-d7868258e2ef | internet | external | 0d81bca7-73f6-4da3-8397-4a8c52a0c583 | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | none | 10.0.0.0/16,2001:db8::/32 |   |   | + | └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 | private | child | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | ipv4-masq | 192.168.1.0/24 |   |   | `), }, } @@ -121,21 +121,21 @@ func Test_AdminNetworkCmd_Describe(t *testing.T) { }), WantProtoObject: testresources.Network1(), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 `), WantWideTable: new(` - ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx + ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx `), Template: new("{{ .id }} {{ .name }}"), WantTemplate: new(` 6988ebb0-9531-4f9b-a893-d7868258e2ef internet `), WantMarkdown: new(` - | ID | NAME | TYPE | PROJECT | PARTITION | NAT | PREFIXES | PREFIX USAGE | IP USAGE | - |--------------------------------------|----------|----------|--------------------------------------|-------------|------|---------------------------|--------------|----------| - | 6988ebb0-9531-4f9b-a893-d7868258e2ef | internet | external | 0d81bca7-73f6-4da3-8397-4a8c52a0c583 | partition-1 | none | 10.0.0.0/16,2001:db8::/32 |   |   | + | ID | NAME | TYPE | PROJECT | PARTITION | NAT | PREFIXES | PREFIX USAGE | IP USAGE | + |--------------------------------------|----------|----------|--------------------------------------|---------------------------------------|------|---------------------------|--------------|----------| + | 6988ebb0-9531-4f9b-a893-d7868258e2ef | internet | external | 0d81bca7-73f6-4da3-8397-4a8c52a0c583 | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | none | 10.0.0.0/16,2001:db8::/32 |   |   | `), }, } @@ -176,7 +176,7 @@ func Test_AdminNetworkCmd_Create(t *testing.T) { ClientCalls: []client.ClientCall{ { WantRequest: &adminv2.NetworkServiceCreateRequest{ - Id: &testresources.Network1().Id, + Id: new(testresources.Network1().Id), Name: testresources.Network1().Name, Partition: testresources.Network1().Partition, Project: testresources.Network1().Project, @@ -226,7 +226,7 @@ func Test_AdminNetworkCmd_Create(t *testing.T) { ClientCalls: []client.ClientCall{ { WantRequest: &adminv2.NetworkServiceCreateRequest{ - Id: &testresources.Network1().Id, + Id: new(testresources.Network1().Id), Name: testresources.Network1().Name, Description: testresources.Network1().Description, Partition: testresources.Network1().Partition, @@ -248,8 +248,8 @@ func Test_AdminNetworkCmd_Create(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 `), }, } @@ -279,8 +279,8 @@ func Test_AdminNetworkCmd_Delete(t *testing.T) { }), WantProtoObject: testresources.Network1(), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 `), }, { @@ -305,8 +305,8 @@ func Test_AdminNetworkCmd_Delete(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 `), }, } @@ -341,8 +341,8 @@ func Test_AdminNetworkCmd_Update(t *testing.T) { }), WantProtoObject: testresources.Network1(), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 `), }, { @@ -366,7 +366,7 @@ func Test_AdminNetworkCmd_Update(t *testing.T) { }, }, }, - NatType: &testresources.Network1().NatType, + NatType: new(testresources.Network1().NatType), Prefixes: testresources.Network1().Prefixes, UpdateMeta: &apiv2.UpdateMeta{ LockingStrategy: apiv2.OptimisticLockingStrategy_OPTIMISTIC_LOCKING_STRATEGY_SERVER, @@ -381,8 +381,8 @@ func Test_AdminNetworkCmd_Update(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 `), }, } diff --git a/tests/e2e/admin/partition_test.go b/tests/e2e/admin/partition_test.go index 2daac45..51335ea 100644 --- a/tests/e2e/admin/partition_test.go +++ b/tests/e2e/admin/partition_test.go @@ -36,25 +36,25 @@ func Test_AdminPartitionCmd_List(t *testing.T) { }, }), WantTable: new(` - ID DESCRIPTION - partition-1 partition 1 - partition-2 partition 2 + ID DESCRIPTION + 5711axzf0-4218-p7x9-3f8f-d34912dx190q partition 1 + d34912dx1-90qe-3jf8-1kd0-5711axzf08sj partition 2 `), WantWideTable: new(` - ID DESCRIPTION LABELS - partition-1 partition 1 a=b - partition-2 partition 2 + ID DESCRIPTION LABELS + 5711axzf0-4218-p7x9-3f8f-d34912dx190q partition 1 a=b + d34912dx1-90qe-3jf8-1kd0-5711axzf08sj partition 2 `), Template: new("{{ .id }} {{ .description }}"), WantTemplate: new(` -partition-1 partition 1 -partition-2 partition 2 +5711axzf0-4218-p7x9-3f8f-d34912dx190q partition 1 +d34912dx1-90qe-3jf8-1kd0-5711axzf08sj partition 2 `), WantMarkdown: new(` - | ID | DESCRIPTION | - |-------------|-------------| - | partition-1 | partition 1 | - | partition-2 | partition 2 | + | ID | DESCRIPTION | + |---------------------------------------|-------------| + | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | partition 1 | + | d34912dx1-90qe-3jf8-1kd0-5711axzf08sj | partition 2 | `), }, } @@ -103,7 +103,7 @@ func Test_AdminPartitionCmd_Capacity(t *testing.T) { return connect.NewResponse(&adminv2.PartitionServiceCapacityResponse{ PartitionCapacity: []*adminv2.PartitionCapacity{ { - Partition: "partition-1", + Partition: "5711axzf0-4218-p7x9-3f8f-d34912dx190q", MachineSizeCapacities: []*adminv2.MachineSizeCapacity{ { Size: "size-1", @@ -123,42 +123,42 @@ func Test_AdminPartitionCmd_Capacity(t *testing.T) { }, }), WantTable: new(` - PARTITION SIZE ALLOCATED FREE UNAVAILABLE RESERVATIONS | TOTAL | FAULTY - partition-1 size-1 1 3 0 2 (1/3 used) | 5 | 2 - Total 1 3 0 2 | 5 | 2 + PARTITION SIZE ALLOCATED FREE UNAVAILABLE RESERVATIONS | TOTAL | FAULTY + 5711axzf0-4218-p7x9-3f8f-d34912dx190q size-1 1 3 0 2 (1/3 used) | 5 | 2 + Total 1 3 0 2 | 5 | 2 `), WantWideTable: new(` - PARTITION SIZE ALLOCATED FREE UNAVAILABLE RESERVATIONS | TOTAL | FAULTY PHONED HOME WAITING OTHER - partition-1 size-1 1 3 0 2 (1/3 used) | 5 | 2 0 0 0 - Total 1 3 0 2 | 5 | 2 0 0 0 + PARTITION SIZE ALLOCATED FREE UNAVAILABLE RESERVATIONS | TOTAL | FAULTY PHONED HOME WAITING OTHER + 5711axzf0-4218-p7x9-3f8f-d34912dx190q size-1 1 3 0 2 (1/3 used) | 5 | 2 0 0 0 + Total 1 3 0 2 | 5 | 2 0 0 0 `), Template: new("{{ .partition }} {{ (index .machine_size_capacities 0).size }}"), WantTemplate: new(` -partition-1 size-1 +5711axzf0-4218-p7x9-3f8f-d34912dx190q size-1 `), WantMarkdown: new(` - | PARTITION | SIZE | ALLOCATED | FREE | UNAVAILABLE | RESERVATIONS | | | TOTAL | | | FAULTY | - |-------------|--------|-----------|------|-------------|--------------|---|-------|---|--------| - | partition-1 | size-1 | 1 | 3 | 0 | 2 (1/3 used) | | | 5 | | | 2 | - | Total | | 1 | 3 | 0 | 2 | | | 5 | | | 2 | + | PARTITION | SIZE | ALLOCATED | FREE | UNAVAILABLE | RESERVATIONS | | | TOTAL | | | FAULTY | + |---------------------------------------|--------|-----------|------|-------------|--------------|---|-------|---|--------| + | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | size-1 | 1 | 3 | 0 | 2 (1/3 used) | | | 5 | | | 2 | + | Total | | 1 | 3 | 0 | 2 | | | 5 | | | 2 | `), }, { Name: "capacity with filters", - CmdArgs: []string{"admin", "partition", "capacity", "--id", "partition-1", "--size", "size-1", "--project", "project-123"}, + CmdArgs: []string{"admin", "partition", "capacity", "--id", "5711axzf0-4218-p7x9-3f8f-d34912dx190q", "--size", "size-1", "--project", "0d81bca7-73f6-4da3-8397-4a8c52a0c583"}, NewRootCmd: e2erootcmd.NewRootCmd(t, &e2erootcmd.TestConfig{ ClientCalls: []client.ClientCall{ { WantRequest: &adminv2.PartitionServiceCapacityRequest{ - Id: new("partition-1"), + Id: new("5711axzf0-4218-p7x9-3f8f-d34912dx190q"), Size: new("size-1"), - Project: new("project-123"), + Project: new("0d81bca7-73f6-4da3-8397-4a8c52a0c583"), }, WantResponse: func() connect.AnyResponse { return connect.NewResponse(&adminv2.PartitionServiceCapacityResponse{ PartitionCapacity: []*adminv2.PartitionCapacity{ { - Partition: "partition-1", + Partition: "5711axzf0-4218-p7x9-3f8f-d34912dx190q", MachineSizeCapacities: []*adminv2.MachineSizeCapacity{ { Size: "size-1", @@ -178,9 +178,9 @@ partition-1 size-1 }, }), WantTable: new(` - PARTITION SIZE ALLOCATED FREE UNAVAILABLE RESERVATIONS | TOTAL | FAULTY - partition-1 size-1 1 3 0 2 (1/3 used) | 5 | 2 - Total 1 3 0 2 | 5 | 2 + PARTITION SIZE ALLOCATED FREE UNAVAILABLE RESERVATIONS | TOTAL | FAULTY + 5711axzf0-4218-p7x9-3f8f-d34912dx190q size-1 1 3 0 2 (1/3 used) | 5 | 2 + Total 1 3 0 2 | 5 | 2 `), }, } diff --git a/tests/e2e/admin/switch_test.go b/tests/e2e/admin/switch_test.go index b91de20..5a40307 100644 --- a/tests/e2e/admin/switch_test.go +++ b/tests/e2e/admin/switch_test.go @@ -150,6 +150,9 @@ func Test_AdminSwitchCmd_Update(t *testing.T) { ClientCalls: []client.ClientCall{ { WantRequest: &adminv2.SwitchServiceUpdateRequest{ + UpdateMeta: &apiv2.UpdateMeta{ + LockingStrategy: apiv2.OptimisticLockingStrategy_OPTIMISTIC_LOCKING_STRATEGY_SERVER, + }, Id: testresources.Switch2().Id, Description: new(testresources.Switch2().Description), ManagementIp: new(testresources.Switch2().ManagementIp), diff --git a/tests/e2e/admin/vpn_test.go b/tests/e2e/admin/vpn_test.go index 5fdec98..dfd3670 100644 --- a/tests/e2e/admin/vpn_test.go +++ b/tests/e2e/admin/vpn_test.go @@ -62,7 +62,7 @@ func Test_AdminVpnCmd_AuthKey(t *testing.T) { tests := []*e2e.Test[any, any]{ { Name: "list", - CmdArgs: []string{"admin", "vpn", "auth-key", "--project", testresources.Project1().Uuid}, + CmdArgs: []string{"admin", "vpn", "auth-key", "--reason", "some reason", "--project", testresources.Project1().Uuid}, NewRootCmd: e2erootcmd.NewRootCmd(t, &e2erootcmd.TestConfig{ ClientCalls: []client.ClientCall{ { @@ -70,7 +70,7 @@ func Test_AdminVpnCmd_AuthKey(t *testing.T) { Project: testresources.Project1().Uuid, Ephemeral: true, Expires: durationpb.New(1 * time.Hour), - Reason: "", + Reason: "some reason", }, WantResponse: func() connect.AnyResponse { return connect.NewResponse(&adminv2.VPNServiceAuthKeyResponse{ diff --git a/tests/e2e/api/ip_test.go b/tests/e2e/api/ip_test.go index e360f12..548bb32 100644 --- a/tests/e2e/api/ip_test.go +++ b/tests/e2e/api/ip_test.go @@ -38,13 +38,13 @@ func Test_IPCmd_List(t *testing.T) { }), WantTable: new(` IP PROJECT ID TYPE NAME ATTACHED SERVICE - 4.3.2.1 46bdfc45-9c8d-4268-b359-b40e3079d384 9cef40ec-29c6-4dfa-aee8-47ee1f49223d ephemeral b - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static a + 4.3.2.1 46bdfc45-9c8d-4268-b359-b40e3079d384 9cef40ec-29c6-4dfa-aee8-47ee1f49223d ephemeral bb + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static aa `), WantWideTable: new(` IP PROJECT ID TYPE NAME DESCRIPTION LABELS - 4.3.2.1 46bdfc45-9c8d-4268-b359-b40e3079d384 9cef40ec-29c6-4dfa-aee8-47ee1f49223d ephemeral b b description a=b - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static a a description cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx + 4.3.2.1 46bdfc45-9c8d-4268-b359-b40e3079d384 9cef40ec-29c6-4dfa-aee8-47ee1f49223d ephemeral bb b description a=b + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static aa a description cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx `), Template: new("{{ .ip }} {{ .project }}"), WantTemplate: new(` @@ -54,8 +54,8 @@ func Test_IPCmd_List(t *testing.T) { WantMarkdown: new(` | IP | PROJECT | ID | TYPE | NAME | ATTACHED SERVICE | |---------|--------------------------------------|--------------------------------------|-----------|------|------------------| - | 4.3.2.1 | 46bdfc45-9c8d-4268-b359-b40e3079d384 | 9cef40ec-29c6-4dfa-aee8-47ee1f49223d | ephemeral | b | | - | 1.1.1.1 | ce19a655-7933-4745-8f3e-9592b4a90488 | 2e0144a2-09ef-42b7-b629-4263295db6e8 | static | a | | + | 4.3.2.1 | 46bdfc45-9c8d-4268-b359-b40e3079d384 | 9cef40ec-29c6-4dfa-aee8-47ee1f49223d | ephemeral | bb | | + | 1.1.1.1 | ce19a655-7933-4745-8f3e-9592b4a90488 | 2e0144a2-09ef-42b7-b629-4263295db6e8 | static | aa | | `), }, } @@ -87,11 +87,11 @@ func Test_IPCmd_Describe(t *testing.T) { WantProtoObject: testresources.IP1(), WantTable: new(` IP PROJECT ID TYPE NAME ATTACHED SERVICE - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static a + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static aa `), WantWideTable: new(` IP PROJECT ID TYPE NAME DESCRIPTION LABELS - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static a a description cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static aa a description cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx `), Template: new("{{ .ip }} {{ .project }}"), WantTemplate: new(` @@ -100,7 +100,7 @@ func Test_IPCmd_Describe(t *testing.T) { WantMarkdown: new(` | IP | PROJECT | ID | TYPE | NAME | ATTACHED SERVICE | |---------|--------------------------------------|--------------------------------------|--------|------|------------------| - | 1.1.1.1 | ce19a655-7933-4745-8f3e-9592b4a90488 | 2e0144a2-09ef-42b7-b629-4263295db6e8 | static | a | | + | 1.1.1.1 | ce19a655-7933-4745-8f3e-9592b4a90488 | 2e0144a2-09ef-42b7-b629-4263295db6e8 | static | aa | | `), }, } @@ -120,7 +120,7 @@ func Test_IPCmd_Create(t *testing.T) { WantRequest: &apiv2.IPServiceCreateRequest{ Project: testresources.IP1().Project, Network: testresources.IP1().Network, - Type: &testresources.IP1().Type, + Type: new(testresources.IP1().Type), }, WantResponse: func() connect.AnyResponse { return connect.NewResponse(&apiv2.IPServiceCreateResponse{ @@ -143,13 +143,13 @@ func Test_IPCmd_Create(t *testing.T) { ClientCalls: []client.ClientCall{ { WantRequest: &apiv2.IPServiceCreateRequest{ - Ip: &testresources.IP1().Ip, + Ip: new(testresources.IP1().Ip), Project: testresources.IP1().Project, Network: testresources.IP1().Network, - Name: &testresources.IP1().Name, - Description: &testresources.IP1().Description, + Name: new(testresources.IP1().Name), + Description: new(testresources.IP1().Description), Labels: testresources.IP1().Meta.Labels, - Type: &testresources.IP1().Type, + Type: new(testresources.IP1().Type), AddressFamily: nil, }, WantResponse: func() connect.AnyResponse { @@ -162,7 +162,7 @@ func Test_IPCmd_Create(t *testing.T) { }), WantTable: new(` IP PROJECT ID TYPE NAME ATTACHED SERVICE - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static a + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static aa `), }, } @@ -218,7 +218,7 @@ func Test_IPCmd_Delete(t *testing.T) { ), WantTable: new(` IP PROJECT ID TYPE NAME ATTACHED SERVICE - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static a + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static aa `), }, } @@ -256,11 +256,11 @@ func Test_IPCmd_Update(t *testing.T) { WantProtoObject: testresources.IP1(), WantTable: new(` IP PROJECT ID TYPE NAME ATTACHED SERVICE - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static a + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static aa `), WantWideTable: new(` IP PROJECT ID TYPE NAME DESCRIPTION LABELS - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static a a description cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static aa a description cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx `), }, { @@ -276,7 +276,7 @@ func Test_IPCmd_Update(t *testing.T) { WantRequest: &apiv2.IPServiceUpdateRequest{ Ip: testresources.IP1().Ip, Project: testresources.IP1().Project, - Description: &testresources.IP1().Description, + Description: new(testresources.IP1().Description), Labels: &apiv2.UpdateLabels{ Strategy: &apiv2.UpdateLabels_Replace{ Replace: &apiv2.Labels{ @@ -284,8 +284,8 @@ func Test_IPCmd_Update(t *testing.T) { }, }, }, - Name: &testresources.IP1().Name, - Type: &testresources.IP1().Type, + Name: new(testresources.IP1().Name), + Type: new(testresources.IP1().Type), UpdateMeta: &apiv2.UpdateMeta{ LockingStrategy: apiv2.OptimisticLockingStrategy_OPTIMISTIC_LOCKING_STRATEGY_SERVER, }, @@ -301,7 +301,7 @@ func Test_IPCmd_Update(t *testing.T) { ), WantTable: new(` IP PROJECT ID TYPE NAME ATTACHED SERVICE - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static a + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static aa `), }, } @@ -323,13 +323,13 @@ func Test_IPCmd_Apply(t *testing.T) { ClientCalls: []client.ClientCall{ { WantRequest: &apiv2.IPServiceCreateRequest{ - Ip: &testresources.IP1().Ip, + Ip: new(testresources.IP1().Ip), Project: testresources.IP1().Project, Network: testresources.IP1().Network, - Name: &testresources.IP1().Name, - Description: &testresources.IP1().Description, + Name: new(testresources.IP1().Name), + Description: new(testresources.IP1().Description), Labels: testresources.IP1().Meta.Labels, - Type: &testresources.IP1().Type, + Type: new(testresources.IP1().Type), AddressFamily: nil, }, WantResponse: func() connect.AnyResponse { @@ -343,7 +343,7 @@ func Test_IPCmd_Apply(t *testing.T) { ), WantTable: new(` IP PROJECT ID TYPE NAME ATTACHED SERVICE - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static a + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static aa `), }, { @@ -357,13 +357,13 @@ func Test_IPCmd_Apply(t *testing.T) { ClientCalls: []client.ClientCall{ { WantRequest: &apiv2.IPServiceCreateRequest{ - Ip: &testresources.IP1().Ip, + Ip: new(testresources.IP1().Ip), Project: testresources.IP1().Project, Network: testresources.IP1().Network, - Name: &testresources.IP1().Name, - Description: &testresources.IP1().Description, + Name: new(testresources.IP1().Name), + Description: new(testresources.IP1().Description), Labels: testresources.IP1().Meta.Labels, - Type: &testresources.IP1().Type, + Type: new(testresources.IP1().Type), AddressFamily: nil, }, WantError: connect.NewError(connect.CodeAlreadyExists, fmt.Errorf("already exists")), @@ -372,15 +372,15 @@ func Test_IPCmd_Apply(t *testing.T) { WantRequest: &apiv2.IPServiceUpdateRequest{ Ip: testresources.IP1().Ip, Project: testresources.IP1().Project, - Description: &testresources.IP1().Description, + Description: new(testresources.IP1().Description), Labels: &apiv2.UpdateLabels{ Strategy: &apiv2.UpdateLabels_Replace{ Replace: &apiv2.Labels{ Labels: testresources.IP1().Meta.Labels.Labels, }, }}, - Name: &testresources.IP1().Name, - Type: &testresources.IP1().Type, + Name: new(testresources.IP1().Name), + Type: new(testresources.IP1().Type), UpdateMeta: &apiv2.UpdateMeta{ LockingStrategy: apiv2.OptimisticLockingStrategy_OPTIMISTIC_LOCKING_STRATEGY_SERVER, }, @@ -396,7 +396,7 @@ func Test_IPCmd_Apply(t *testing.T) { ), WantTable: new(` IP PROJECT ID TYPE NAME ATTACHED SERVICE - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static a + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static aa `), }, } diff --git a/tests/e2e/api/network_test.go b/tests/e2e/api/network_test.go index e7bc07e..f1a5f22 100644 --- a/tests/e2e/api/network_test.go +++ b/tests/e2e/api/network_test.go @@ -44,7 +44,7 @@ func Test_NetworkCmd_List(t *testing.T) { Project: *testresources.Network1().Project, Query: &apiv2.NetworkQuery{ Project: testresources.Network1().Project, - Id: &testresources.Network1().Id, + Id: new(testresources.Network1().Id), Name: testresources.Network1().Name, Description: testresources.Network1().Description, Partition: testresources.Network1().Partition, @@ -55,7 +55,7 @@ func Test_NetworkCmd_List(t *testing.T) { Vrf: testresources.Network1().Vrf, ParentNetwork: testresources.Network2().ParentNetwork, AddressFamily: apiv2.NetworkAddressFamily_NETWORK_ADDRESS_FAMILY_DUAL_STACK.Enum(), - Type: &testresources.Network1().Type, + Type: new(testresources.Network1().Type), Labels: &apiv2.Labels{ Labels: map[string]string{"a": "b"}, }, @@ -73,14 +73,14 @@ func Test_NetworkCmd_List(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 - └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private child f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c partition-1 ipv4-masq 192.168.1.0/24 + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 + └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private child f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 5711axzf0-4218-p7x9-3f8f-d34912dx190q ipv4-masq 192.168.1.0/24 `), WantWideTable: new(` - ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx - └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private network private child f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c partition-1 ipv4-masq 192.168.1.0/24 a=b + ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx + └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private network private child f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 5711axzf0-4218-p7x9-3f8f-d34912dx190q ipv4-masq 192.168.1.0/24 a=b `), Template: new("{{ .id }} {{ .name }}"), WantTemplate: new(` @@ -88,10 +88,10 @@ func Test_NetworkCmd_List(t *testing.T) { d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private `), WantMarkdown: new(` - | ID | NAME | TYPE | PROJECT | PARTITION | NAT | PREFIXES | PREFIX USAGE | IP USAGE | - |-----------------------------------------|----------|----------|--------------------------------------|-------------|-----------|---------------------------|--------------|----------| - | 6988ebb0-9531-4f9b-a893-d7868258e2ef | internet | external | 0d81bca7-73f6-4da3-8397-4a8c52a0c583 | partition-1 | none | 10.0.0.0/16,2001:db8::/32 |   |   | - | └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 | private | child | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | partition-1 | ipv4-masq | 192.168.1.0/24 |   |   | + | ID | NAME | TYPE | PROJECT | PARTITION | NAT | PREFIXES | PREFIX USAGE | IP USAGE | + |-----------------------------------------|----------|----------|--------------------------------------|---------------------------------------|-----------|---------------------------|--------------|----------| + | 6988ebb0-9531-4f9b-a893-d7868258e2ef | internet | external | 0d81bca7-73f6-4da3-8397-4a8c52a0c583 | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | none | 10.0.0.0/16,2001:db8::/32 |   |   | + | └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 | private | child | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | ipv4-masq | 192.168.1.0/24 |   |   | `), }, } @@ -122,21 +122,21 @@ func Test_NetworkCmd_Describe(t *testing.T) { }), WantProtoObject: testresources.Network1(), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 `), WantWideTable: new(` - ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx + ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx `), Template: new("{{ .id }} {{ .name }}"), WantTemplate: new(` 6988ebb0-9531-4f9b-a893-d7868258e2ef internet `), WantMarkdown: new(` - | ID | NAME | TYPE | PROJECT | PARTITION | NAT | PREFIXES | PREFIX USAGE | IP USAGE | - |--------------------------------------|----------|----------|--------------------------------------|-------------|------|---------------------------|--------------|----------| - | 6988ebb0-9531-4f9b-a893-d7868258e2ef | internet | external | 0d81bca7-73f6-4da3-8397-4a8c52a0c583 | partition-1 | none | 10.0.0.0/16,2001:db8::/32 |   |   | + | ID | NAME | TYPE | PROJECT | PARTITION | NAT | PREFIXES | PREFIX USAGE | IP USAGE | + |--------------------------------------|----------|----------|--------------------------------------|---------------------------------------|------|---------------------------|--------------|----------| + | 6988ebb0-9531-4f9b-a893-d7868258e2ef | internet | external | 0d81bca7-73f6-4da3-8397-4a8c52a0c583 | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | none | 10.0.0.0/16,2001:db8::/32 |   |   | `), }, } @@ -201,8 +201,8 @@ func Test_NetworkCmd_Create(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 `), }, } @@ -256,8 +256,8 @@ func Test_NetworkCmd_Delete(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 `), }, } @@ -293,12 +293,12 @@ func Test_NetworkCmd_Update(t *testing.T) { }), WantProtoObject: testresources.Network1(), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 `), WantWideTable: new(` - ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx + ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx `), }, { @@ -336,8 +336,8 @@ func Test_NetworkCmd_Update(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 `), }, } @@ -376,8 +376,8 @@ func Test_NetworkCmd_Apply(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 `), }, { @@ -427,8 +427,8 @@ func Test_NetworkCmd_Apply(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 `), }, } diff --git a/tests/e2e/api/project_test.go b/tests/e2e/api/project_test.go index 1b2864b..7438026 100644 --- a/tests/e2e/api/project_test.go +++ b/tests/e2e/api/project_test.go @@ -219,6 +219,9 @@ func Test_ProjectCmd_Update(t *testing.T) { Project: testresources.Project1().Uuid, Name: new("new-name"), Description: new("new-desc"), + UpdateMeta: &apiv2.UpdateMeta{ + LockingStrategy: apiv2.OptimisticLockingStrategy_OPTIMISTIC_LOCKING_STRATEGY_SERVER, + }, }, WantResponse: func() connect.AnyResponse { return connect.NewResponse(&apiv2.ProjectServiceUpdateResponse{ @@ -243,6 +246,9 @@ func Test_ProjectCmd_Update(t *testing.T) { Project: testresources.Project1().Uuid, Name: new(testresources.Project1().Name), Description: new(testresources.Project1().Description), + UpdateMeta: &apiv2.UpdateMeta{ + LockingStrategy: apiv2.OptimisticLockingStrategy_OPTIMISTIC_LOCKING_STRATEGY_SERVER, + }, }, WantResponse: func() connect.AnyResponse { return connect.NewResponse(&apiv2.ProjectServiceUpdateResponse{ @@ -363,8 +369,11 @@ func Test_ProjectCmd_Apply(t *testing.T) { { WantRequest: &apiv2.ProjectServiceUpdateRequest{ Project: testresources.Project1().Uuid, - Description: &testresources.Project1().Description, - Name: &testresources.Project1().Name, + Description: new(testresources.Project1().Description), + Name: new(testresources.Project1().Name), + UpdateMeta: &apiv2.UpdateMeta{ + LockingStrategy: apiv2.OptimisticLockingStrategy_OPTIMISTIC_LOCKING_STRATEGY_SERVER, + }, }, WantResponse: func() connect.AnyResponse { return connect.NewResponse(&apiv2.ProjectServiceUpdateResponse{ @@ -390,11 +399,13 @@ func Test_ProjectCmd_ListInvites(t *testing.T) { tests := []*e2e.Test[apiv2.ProjectServiceInvitesListResponse, apiv2.ProjectInvite]{ { Name: "list invites", - CmdArgs: []string{"project", "invite", "list", testresources.Project1().Uuid}, + CmdArgs: []string{"project", "invite", "list", "--project", testresources.Project1().Uuid}, NewRootCmd: e2erootcmd.NewRootCmd(t, &e2erootcmd.TestConfig{ ClientCalls: []client.ClientCall{ { - WantRequest: &apiv2.ProjectServiceInvitesListRequest{}, + WantRequest: &apiv2.ProjectServiceInvitesListRequest{ + Project: testresources.Project1().Uuid, + }, WantResponse: func() connect.AnyResponse { return connect.NewResponse(&apiv2.ProjectServiceInvitesListResponse{ Invites: []*apiv2.ProjectInvite{ diff --git a/tests/e2e/api/tenant_test.go b/tests/e2e/api/tenant_test.go index d806fe0..5642526 100644 --- a/tests/e2e/api/tenant_test.go +++ b/tests/e2e/api/tenant_test.go @@ -116,9 +116,9 @@ func Test_TenantCmd_Create(t *testing.T) { ClientCalls: []client.ClientCall{ { WantRequest: &apiv2.TenantServiceCreateRequest{ - Description: &testresources.Tenant1().Description, Name: testresources.Tenant1().Name, - Email: &testresources.Tenant1().Email, + Description: new(testresources.Tenant1().Description), + Email: new(testresources.Tenant1().Email), }, WantResponse: func() connect.AnyResponse { return connect.NewResponse(&apiv2.TenantServiceCreateResponse{ @@ -141,9 +141,9 @@ func Test_TenantCmd_Create(t *testing.T) { { WantRequest: &apiv2.TenantServiceCreateRequest{ Name: testresources.Tenant1().Name, - Description: &testresources.Tenant1().Description, - Email: &testresources.Tenant1().Email, - AvatarUrl: new(""), + Description: new(testresources.Tenant1().Description), + Email: new(testresources.Tenant1().Email), + AvatarUrl: new(testresources.Tenant1().AvatarUrl), }, WantResponse: func() connect.AnyResponse { return connect.NewResponse(&apiv2.TenantServiceCreateResponse{ @@ -169,9 +169,9 @@ func Test_TenantCmd_Create(t *testing.T) { { WantRequest: &apiv2.TenantServiceCreateRequest{ Name: testresources.Tenant1().Name, - Description: &testresources.Tenant1().Description, - AvatarUrl: new(""), - Email: &testresources.Tenant1().Email, + Description: new(testresources.Tenant1().Description), + Email: new(testresources.Tenant1().Email), + AvatarUrl: new(testresources.Tenant1().AvatarUrl), }, WantResponse: func() connect.AnyResponse { return connect.NewResponse(&apiv2.TenantServiceCreateResponse{ @@ -182,9 +182,9 @@ func Test_TenantCmd_Create(t *testing.T) { { WantRequest: &apiv2.TenantServiceCreateRequest{ Name: testresources.Tenant2().Name, - Description: &testresources.Tenant2().Description, - Email: &testresources.Tenant2().Email, - AvatarUrl: new(""), + Description: new(testresources.Tenant2().Description), + Email: new(testresources.Tenant2().Email), + AvatarUrl: new(testresources.Tenant2().AvatarUrl), }, WantResponse: func() connect.AnyResponse { return connect.NewResponse(&apiv2.TenantServiceCreateResponse{ @@ -270,6 +270,9 @@ func Test_TenantCmd_Update(t *testing.T) { Login: testresources.Tenant1().Login, Name: new("new-name"), Description: new("new-desc"), + UpdateMeta: &apiv2.UpdateMeta{ + LockingStrategy: apiv2.OptimisticLockingStrategy_OPTIMISTIC_LOCKING_STRATEGY_SERVER, + }, }, WantResponse: func() connect.AnyResponse { return connect.NewResponse(&apiv2.TenantServiceUpdateResponse{ @@ -295,6 +298,10 @@ func Test_TenantCmd_Update(t *testing.T) { Name: new(testresources.Tenant1().Name), Email: new(testresources.Tenant1().Email), Description: new(testresources.Tenant1().Description), + AvatarUrl: new(testresources.Tenant1().AvatarUrl), + UpdateMeta: &apiv2.UpdateMeta{ + LockingStrategy: apiv2.OptimisticLockingStrategy_OPTIMISTIC_LOCKING_STRATEGY_SERVER, + }, }, WantResponse: func() connect.AnyResponse { return connect.NewResponse(&apiv2.TenantServiceUpdateResponse{ @@ -328,10 +335,10 @@ func Test_TenantCmd_Apply(t *testing.T) { ClientCalls: []client.ClientCall{ { WantRequest: &apiv2.TenantServiceCreateRequest{ + Name: testresources.Tenant1().Name, Email: new(testresources.Tenant1().Email), Description: new(testresources.Tenant1().Description), - Name: testresources.Tenant1().Name, - AvatarUrl: new(""), + AvatarUrl: new(testresources.Tenant1().AvatarUrl), }, WantResponse: func() connect.AnyResponse { return connect.NewResponse(&apiv2.TenantServiceCreateResponse{ @@ -361,7 +368,7 @@ func Test_TenantCmd_Apply(t *testing.T) { Email: new(testresources.Tenant1().Email), Description: new(testresources.Tenant1().Description), Name: testresources.Tenant1().Name, - AvatarUrl: new(""), + AvatarUrl: new(testresources.Tenant1().AvatarUrl), }, WantError: connect.NewError(connect.CodeAlreadyExists, fmt.Errorf("already exists")), }, @@ -371,6 +378,10 @@ func Test_TenantCmd_Apply(t *testing.T) { Email: new(testresources.Tenant1().Email), Description: new(testresources.Tenant1().Description), Name: new(testresources.Tenant1().Name), + AvatarUrl: new(testresources.Tenant1().AvatarUrl), + UpdateMeta: &apiv2.UpdateMeta{ + LockingStrategy: apiv2.OptimisticLockingStrategy_OPTIMISTIC_LOCKING_STRATEGY_SERVER, + }, }, WantResponse: func() connect.AnyResponse { return connect.NewResponse(&apiv2.TenantServiceUpdateResponse{ diff --git a/tests/e2e/testresources/audit.go b/tests/e2e/testresources/audit.go index de7de5c..e5b0a01 100644 --- a/tests/e2e/testresources/audit.go +++ b/tests/e2e/testresources/audit.go @@ -13,7 +13,7 @@ var ( Uuid: "d1ff7267-2fbb-4a63-a7c1-44f1a83381a7", Timestamp: timestamppb.New(e2e.TimeBubbleStartTime()), User: "me", - Tenant: "a", + Tenant: "aa", Project: new(Project1().Uuid), Method: "/apiv2.Create/", Body: new("request body"), @@ -27,7 +27,7 @@ var ( Uuid: "d1ff7267-2fbb-4a63-a7c1-44f1a83381a7", Timestamp: timestamppb.New(e2e.TimeBubbleStartTime()), User: "me", - Tenant: "a", + Tenant: "aa", Project: new(Project1().Uuid), Method: "/apiv2.List/", Body: new("result body"), @@ -42,7 +42,7 @@ var ( Uuid: "5091c4e9-e8db-483c-ab6b-fe14f82570a7", Timestamp: timestamppb.New(e2e.TimeBubbleStartTime().AddDate(1, 0, 0)), User: "Larry", - Tenant: "b", + Tenant: "bb", Project: new(Project1().Uuid), Method: "/apiv2.List/", Body: new("result body"), diff --git a/tests/e2e/testresources/images.go b/tests/e2e/testresources/images.go index 150aaab..c483ba1 100644 --- a/tests/e2e/testresources/images.go +++ b/tests/e2e/testresources/images.go @@ -11,6 +11,7 @@ var ( Features: []apiv2.ImageFeature{apiv2.ImageFeature_IMAGE_FEATURE_MACHINE}, Classification: apiv2.ImageClassification_IMAGE_CLASSIFICATION_SUPPORTED, Meta: &apiv2.Meta{}, + Url: "https://first-image-metal-stack.io", } } Image2 = func() *apiv2.Image { @@ -21,6 +22,7 @@ var ( Features: []apiv2.ImageFeature{apiv2.ImageFeature_IMAGE_FEATURE_FIREWALL}, Classification: apiv2.ImageClassification_IMAGE_CLASSIFICATION_PREVIEW, Meta: &apiv2.Meta{}, + Url: "https://second-image-metal-stack.io", } } ) diff --git a/tests/e2e/testresources/ips.go b/tests/e2e/testresources/ips.go index 5aef78e..254d143 100644 --- a/tests/e2e/testresources/ips.go +++ b/tests/e2e/testresources/ips.go @@ -11,7 +11,7 @@ var ( Uuid: "2e0144a2-09ef-42b7-b629-4263295db6e8", Network: "internet", Ip: "1.1.1.1", - Name: "a", + Name: "aa", Description: "a description", Project: "ce19a655-7933-4745-8f3e-9592b4a90488", Type: apiv2.IPType_IP_TYPE_STATIC, @@ -29,7 +29,7 @@ var ( Uuid: "9cef40ec-29c6-4dfa-aee8-47ee1f49223d", Network: "internet", Ip: "4.3.2.1", - Name: "b", + Name: "bb", Description: "b description", Project: "46bdfc45-9c8d-4268-b359-b40e3079d384", Type: apiv2.IPType_IP_TYPE_EPHEMERAL, diff --git a/tests/e2e/testresources/networks.go b/tests/e2e/testresources/networks.go index b8c4c92..0be513d 100644 --- a/tests/e2e/testresources/networks.go +++ b/tests/e2e/testresources/networks.go @@ -39,7 +39,7 @@ var ( NatType: apiv2.NATType_NAT_TYPE_IPV4_MASQUERADE, Prefixes: []string{"192.168.1.0/24"}, Vrf: new(uint32(100)), - ParentNetwork: &Network1().Id, + ParentNetwork: new(Network1().Id), Meta: &apiv2.Meta{ CreatedAt: timestamppb.New(e2e.TimeBubbleStartTime()), Labels: &apiv2.Labels{ diff --git a/tests/e2e/testresources/partitions.go b/tests/e2e/testresources/partitions.go index 600baff..2a7534c 100644 --- a/tests/e2e/testresources/partitions.go +++ b/tests/e2e/testresources/partitions.go @@ -7,7 +7,7 @@ import ( var ( Partition1 = func() *apiv2.Partition { return &apiv2.Partition{ - Id: "partition-1", + Id: "5711axzf0-4218-p7x9-3f8f-d34912dx190q", Description: "partition 1", MgmtServiceAddresses: []string{ "192.168.1.1:1234", @@ -28,7 +28,7 @@ var ( } Partition2 = func() *apiv2.Partition { return &apiv2.Partition{ - Id: "partition-2", + Id: "d34912dx1-90qe-3jf8-1kd0-5711axzf08sj", Description: "partition 2", MgmtServiceAddresses: []string{ "192.168.1.2:1234", diff --git a/tests/e2e/testresources/switch.go b/tests/e2e/testresources/switch.go index 7564b02..d6ab64d 100644 --- a/tests/e2e/testresources/switch.go +++ b/tests/e2e/testresources/switch.go @@ -19,7 +19,7 @@ var ( ManagementIp: "10.0.0.1", ManagementUser: new("admin"), MachineConnections: []*apiv2.MachineConnection{ - &apiv2.MachineConnection{ + { MachineId: "id1", Nic: Nic1(), }, diff --git a/tests/e2e/testresources/tenants.go b/tests/e2e/testresources/tenants.go index c8eb5b4..0512df5 100644 --- a/tests/e2e/testresources/tenants.go +++ b/tests/e2e/testresources/tenants.go @@ -18,6 +18,7 @@ var ( Meta: &apiv2.Meta{ CreatedAt: timestamppb.New(e2e.TimeBubbleStartTime()), }, + AvatarUrl: "https://first-tenant-avater.io", } } Tenant2 = func() *apiv2.Tenant { @@ -29,6 +30,7 @@ var ( Meta: &apiv2.Meta{ CreatedAt: timestamppb.New(e2e.TimeBubbleStartTime()), }, + AvatarUrl: "https://second-tenant-avater.io", } } From 36a889387c9d6352b25b521a12ff78ef4947c490 Mon Sep 17 00:00:00 2001 From: Simon Mayer Date: Wed, 4 Nov 2026 07:43:49 +0100 Subject: [PATCH 2/3] Fix tests --- cmd/api/v2/project_member.go | 3 + cmd/api/v2/tenant_member.go | 3 + tests/e2e/admin/ip_test.go | 18 +-- tests/e2e/admin/machine_test.go | 160 +++++++++++++------------- tests/e2e/admin/partition_test.go | 8 +- tests/e2e/api/ip_test.go | 30 ++--- tests/e2e/api/machine_test.go | 48 ++++---- tests/e2e/api/project_member_test.go | 5 +- tests/e2e/api/tenant_member_test.go | 3 + tests/e2e/testresources/machine.go | 2 +- tests/e2e/testresources/partitions.go | 8 +- 11 files changed, 150 insertions(+), 138 deletions(-) diff --git a/cmd/api/v2/project_member.go b/cmd/api/v2/project_member.go index 1b39eca..63470ce 100644 --- a/cmd/api/v2/project_member.go +++ b/cmd/api/v2/project_member.go @@ -193,6 +193,9 @@ func (c *projectMember) updateRequestFromCLI(args []string) (*apiv2.ProjectMembe Project: project, Member: member, Role: pointer.PointerOrNil(apiv2.ProjectRole(apiv2.ProjectRole_value[viper.GetString("role")])), + UpdateMeta: &apiv2.UpdateMeta{ + LockingStrategy: apiv2.OptimisticLockingStrategy_OPTIMISTIC_LOCKING_STRATEGY_SERVER, + }, }, nil } diff --git a/cmd/api/v2/tenant_member.go b/cmd/api/v2/tenant_member.go index df17d63..bc17324 100644 --- a/cmd/api/v2/tenant_member.go +++ b/cmd/api/v2/tenant_member.go @@ -206,6 +206,9 @@ func (c *tenantMember) updateRequestFromCLI(args []string) (*apiv2.TenantMemberS Login: tenant, Member: member, Role: pointer.PointerOrNil(apiv2.TenantRole(apiv2.TenantRole_value[viper.GetString("role")])), + UpdateMeta: &apiv2.UpdateMeta{ + LockingStrategy: apiv2.OptimisticLockingStrategy_OPTIMISTIC_LOCKING_STRATEGY_SERVER, + }, }, nil } diff --git a/tests/e2e/admin/ip_test.go b/tests/e2e/admin/ip_test.go index 7eb106f..5d25dca 100644 --- a/tests/e2e/admin/ip_test.go +++ b/tests/e2e/admin/ip_test.go @@ -36,13 +36,13 @@ func Test_IPCmd_List(t *testing.T) { }), WantTable: new(` IP PROJECT ID NETWORK TYPE NAME ATTACHED SERVICE - 4.3.2.1 46bdfc45-9c8d-4268-b359-b40e3079d384 9cef40ec-29c6-4dfa-aee8-47ee1f49223d internet ephemeral b - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static a + 4.3.2.1 46bdfc45-9c8d-4268-b359-b40e3079d384 9cef40ec-29c6-4dfa-aee8-47ee1f49223d internet ephemeral bb + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static aa `), WantWideTable: new(` IP PROJECT ID TYPE NAME DESCRIPTION LABELS - 4.3.2.1 46bdfc45-9c8d-4268-b359-b40e3079d384 9cef40ec-29c6-4dfa-aee8-47ee1f49223d ephemeral b b description a=b - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static a a description cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx + 4.3.2.1 46bdfc45-9c8d-4268-b359-b40e3079d384 9cef40ec-29c6-4dfa-aee8-47ee1f49223d ephemeral bb b description a=b + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static aa a description cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx `), Template: new("{{ .ip }} {{ .project }}"), WantTemplate: new(` @@ -52,8 +52,8 @@ func Test_IPCmd_List(t *testing.T) { WantMarkdown: new(` | IP | PROJECT | ID | NETWORK | TYPE | NAME | ATTACHED SERVICE | |---------|--------------------------------------|--------------------------------------|----------|-----------|------|------------------| - | 4.3.2.1 | 46bdfc45-9c8d-4268-b359-b40e3079d384 | 9cef40ec-29c6-4dfa-aee8-47ee1f49223d | internet | ephemeral | b | | - | 1.1.1.1 | ce19a655-7933-4745-8f3e-9592b4a90488 | 2e0144a2-09ef-42b7-b629-4263295db6e8 | internet | static | a | | + | 4.3.2.1 | 46bdfc45-9c8d-4268-b359-b40e3079d384 | 9cef40ec-29c6-4dfa-aee8-47ee1f49223d | internet | ephemeral | bb | | + | 1.1.1.1 | ce19a655-7933-4745-8f3e-9592b4a90488 | 2e0144a2-09ef-42b7-b629-4263295db6e8 | internet | static | aa | | `), }, } @@ -88,11 +88,11 @@ func Test_IPCmd_Describe(t *testing.T) { WantProtoObject: testresources.IP1(), WantTable: new(` IP PROJECT ID NETWORK TYPE NAME ATTACHED SERVICE - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static a + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static aa `), WantWideTable: new(` IP PROJECT ID TYPE NAME DESCRIPTION LABELS - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static a a description cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 static aa a description cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx `), Template: new("{{ .ip }} {{ .project }}"), WantTemplate: new(` @@ -101,7 +101,7 @@ func Test_IPCmd_Describe(t *testing.T) { WantMarkdown: new(` | IP | PROJECT | ID | NETWORK | TYPE | NAME | ATTACHED SERVICE | |---------|--------------------------------------|--------------------------------------|----------|--------|------|------------------| - | 1.1.1.1 | ce19a655-7933-4745-8f3e-9592b4a90488 | 2e0144a2-09ef-42b7-b629-4263295db6e8 | internet | static | a | | + | 1.1.1.1 | ce19a655-7933-4745-8f3e-9592b4a90488 | 2e0144a2-09ef-42b7-b629-4263295db6e8 | internet | static | aa | | `), }, } diff --git a/tests/e2e/admin/machine_test.go b/tests/e2e/admin/machine_test.go index b6ab8b9..c0effe1 100644 --- a/tests/e2e/admin/machine_test.go +++ b/tests/e2e/admin/machine_test.go @@ -28,14 +28,14 @@ func Test_MachineCmd_List(t *testing.T) { "--hostname", "hostname", "--image", "image", "--partition", "partition", - "--project", "project", + "--project", "0d81bca7-73f6-4da3-8397-4a8c52a0c583", "--size", "size", - "--id", "uuid", + "--id", "5fa2bbe1-407c-4142-92d5-e4419daf9646", "--rack", "rack", "--labels", "a=b", "--state", "available", - "--bmc-address", "bmc-address", - "--bmc-mac", "bmc-mac", + "--bmc-address", "1.2.3.4", + "--bmc-mac", "00:00:00:00:00:03", "--bmc-user", "bmc-user", "--bmc-interface", "bmc-interface", "--chassis-part-number", "chassis-part-number", @@ -59,14 +59,14 @@ func Test_MachineCmd_List(t *testing.T) { "--preallocated", "--not-allocated", "--network-names", "network-name", - "--network-prefixes", "network-prefix", - "--network-destination-prefixes", "network-dest-prefix", + "--network-prefixes", "0.0.0.0/24", + "--network-destination-prefixes", "0.0.0.0/0", "--network-ips", "1.2.3.4", "--network-vrfs", "1", "--network-asns", "2", - "--nic-macs", "nic-mac", + "--nic-macs", "00:00:00:00:00:01", "--nic-names", "nic-name", - "--nic-neighbor-macs", "nic-neighbor-mac", + "--nic-neighbor-macs", "00:00:00:00:00:02", "--nic-neighbor-names", "nic-neighbor-name", "--disk-names", "disk-name", "--disk-sizes", "1024", @@ -82,7 +82,7 @@ func Test_MachineCmd_List(t *testing.T) { Hostname: new("hostname"), Name: new("name"), Image: new("image"), - Project: new("project"), + Project: new("0d81bca7-73f6-4da3-8397-4a8c52a0c583"), FilesystemLayout: new("fsl"), AllocationType: apiv2.MachineAllocationType_MACHINE_ALLOCATION_TYPE_FIREWALL.Enum(), Vpn: &apiv2.MachineVPN{ @@ -94,7 +94,7 @@ func Test_MachineCmd_List(t *testing.T) { }, Partition: new("partition"), Size: new("size"), - Uuid: new("uuid"), + Uuid: new("5fa2bbe1-407c-4142-92d5-e4419daf9646"), Rack: new("rack"), Room: new("room"), Labels: &apiv2.Labels{ @@ -108,16 +108,16 @@ func Test_MachineCmd_List(t *testing.T) { NotAllocated: new(true), Network: &apiv2.MachineNetworkQuery{ Networks: []string{"network-name"}, - Prefixes: []string{"network-prefix"}, - DestinationPrefixes: []string{"network-dest-prefix"}, + Prefixes: []string{"0.0.0.0/24"}, + DestinationPrefixes: []string{"0.0.0.0/0"}, Ips: []string{"1.2.3.4"}, Vrfs: []uint64{1}, Asns: []uint32{2}, }, Nic: &apiv2.MachineNicQuery{ - Macs: []string{"nic-mac"}, + Macs: []string{"00:00:00:00:00:01"}, Names: []string{"nic-name"}, - NeighborMacs: []string{"nic-neighbor-mac"}, + NeighborMacs: []string{"00:00:00:00:00:02"}, NeighborNames: []string{"nic-neighbor-name"}, }, Disk: &apiv2.MachineDiskQuery{ @@ -125,8 +125,8 @@ func Test_MachineCmd_List(t *testing.T) { Sizes: []uint64{1024}, }, Bmc: &apiv2.MachineBMCQuery{ - Address: new("bmc-address"), - Mac: new("bmc-mac"), + Address: new("1.2.3.4"), + Mac: new("00:00:00:00:00:03"), User: new("bmc-user"), Interface: new("bmc-interface"), }, @@ -158,14 +158,14 @@ func Test_MachineCmd_List(t *testing.T) { }, }), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 5fa2bbe1-407c-4142-92d5-e4419daf9646 Alive 1m v1-medium-x86 partition-1 rack-1 - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 5fa2bbe1-407c-4142-92d5-e4419daf9646 Alive 1m v1-medium-x86 5711axzf0-4218-p7x9-3f8f-d34912dx190q rack-1 + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 `), WantWideTable: new(` - ID LAST EVENT WHEN AGE DESCRIPTION NAME HOSTNAME PROJECT IPS SIZE IMAGE PARTITION RACK STARTED TAGS STATE - 5fa2bbe1-407c-4142-92d5-e4419daf9646 Alive 1m v1-medium-x86 partition-1 rack-1 a=b available - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd Phoned Home 1m 1m machine 2 machine-2 machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 4.5.6.7 v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 1999-12-31T23:59:00Z c=d available + ID LAST EVENT WHEN AGE DESCRIPTION NAME HOSTNAME PROJECT IPS SIZE IMAGE PARTITION RACK STARTED TAGS STATE + 5fa2bbe1-407c-4142-92d5-e4419daf9646 Alive 1m v1-medium-x86 5711axzf0-4218-p7x9-3f8f-d34912dx190q rack-1 a=b available + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f Phoned Home 1m 1m machine 2 machine-2 machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 4.5.6.7 v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 1999-12-31T23:59:00Z c=d available 192.1.1.1 `), Template: new("{{ .allocation.uuid }} {{ .allocation.project }}"), @@ -174,10 +174,10 @@ func Test_MachineCmd_List(t *testing.T) { 4f94e87b-b08f-4f82-b053-9b8305de60ad f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c `), WantMarkdown: new(` - | ID | | LAST EVENT | WHEN | AGE | HOSTNAME | PROJECT | SIZE | IMAGE | PARTITION | RACK | - |---------------------------------------|---|-------------|------|-----|-----------|--------------------------------------|---------------|--------------|-------------|--------| - | 5fa2bbe1-407c-4142-92d5-e4419daf9646 | | Alive | 1m | | | | v1-medium-x86 | | partition-1 | rack-1 | - | 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd | 🛡 | Phoned Home | 1m | 1m | machine-2 | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | v1-medium-x86 | Ubuntu 24.04 | partition-2 | rack-1 | + | ID | | LAST EVENT | WHEN | AGE | HOSTNAME | PROJECT | SIZE | IMAGE | PARTITION | RACK | + |--------------------------------------|---|-------------|------|-----|-----------|--------------------------------------|---------------|--------------|---------------------------------------|--------| + | 5fa2bbe1-407c-4142-92d5-e4419daf9646 | | Alive | 1m | | | | v1-medium-x86 | | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | rack-1 | + | 673fc473-63ca-4ea4-b9dd-b45cb2127a6f | 🛡 | Phoned Home | 1m | 1m | machine-2 | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | v1-medium-x86 | Ubuntu 24.04 | d34912dx1-90qe-3jf8-1kd0-5711axzf08sj | rack-1 | `), }, { @@ -201,9 +201,9 @@ func Test_MachineCmd_List(t *testing.T) { }, }), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 5fa2bbe1-407c-4142-92d5-e4419daf9646 Alive 1m v1-medium-x86 partition-1 rack-1 - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 5fa2bbe1-407c-4142-92d5-e4419daf9646 Alive 1m v1-medium-x86 5711axzf0-4218-p7x9-3f8f-d34912dx190q rack-1 + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 `), }, } @@ -233,12 +233,12 @@ func Test_MachineCmd_Describe(t *testing.T) { }), WantProtoObject: testresources.Machine2(), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 `), WantWideTable: new(` - ID LAST EVENT WHEN AGE DESCRIPTION NAME HOSTNAME PROJECT IPS SIZE IMAGE PARTITION RACK STARTED TAGS STATE - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd Phoned Home 1m 1m machine 2 machine-2 machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 4.5.6.7 v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 1999-12-31T23:59:00Z c=d available + ID LAST EVENT WHEN AGE DESCRIPTION NAME HOSTNAME PROJECT IPS SIZE IMAGE PARTITION RACK STARTED TAGS STATE + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f Phoned Home 1m 1m machine 2 machine-2 machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 4.5.6.7 v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 1999-12-31T23:59:00Z c=d available 192.1.1.1 `), Template: new("{{ .allocation.uuid }} {{ .allocation.project }}"), @@ -246,9 +246,9 @@ func Test_MachineCmd_Describe(t *testing.T) { 4f94e87b-b08f-4f82-b053-9b8305de60ad f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c `), WantMarkdown: new(` - | ID | | LAST EVENT | WHEN | AGE | HOSTNAME | PROJECT | SIZE | IMAGE | PARTITION | RACK | - |---------------------------------------|---|-------------|------|-----|-----------|--------------------------------------|---------------|--------------|-------------|--------| - | 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd | 🛡 | Phoned Home | 1m | 1m | machine-2 | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | v1-medium-x86 | Ubuntu 24.04 | partition-2 | rack-1 | + | ID | | LAST EVENT | WHEN | AGE | HOSTNAME | PROJECT | SIZE | IMAGE | PARTITION | RACK | + |--------------------------------------|---|-------------|------|-----|-----------|--------------------------------------|---------------|--------------|---------------------------------------|--------| + | 673fc473-63ca-4ea4-b9dd-b45cb2127a6f | 🛡 | Phoned Home | 1m | 1m | machine-2 | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | v1-medium-x86 | Ubuntu 24.04 | d34912dx1-90qe-3jf8-1kd0-5711axzf08sj | rack-1 | `), }, } @@ -394,8 +394,8 @@ func Test_MachineCmd_Create(t *testing.T) { }, }), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 `), }, } @@ -448,8 +448,8 @@ func Test_MachineCmd_Delete(t *testing.T) { }, ), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 `), }, } @@ -541,8 +541,8 @@ func Test_MachineCmd_Update(t *testing.T) { }, ), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 `), }, } @@ -597,8 +597,8 @@ func Test_MachineCmd_Apply(t *testing.T) { }, ), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 `), }, { @@ -662,8 +662,8 @@ func Test_MachineCmd_Apply(t *testing.T) { }, ), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 `), }, } @@ -681,14 +681,14 @@ func Test_MachineCmd_BmcList(t *testing.T) { "--hostname", "hostname", "--image", "image", "--partition", "partition", - "--project", "project", + "--project", "0d81bca7-73f6-4da3-8397-4a8c52a0c583", "--size", "size", - "--id", "uuid", + "--id", "5fa2bbe1-407c-4142-92d5-e4419daf9646", "--rack", "rack", "--labels", "a=b", "--state", "available", - "--bmc-address", "bmc-address", - "--bmc-mac", "bmc-mac", + "--bmc-address", "1.2.3.4", + "--bmc-mac", "00:00:00:00:00:03", "--bmc-user", "bmc-user", "--bmc-interface", "bmc-interface", "--chassis-part-number", "chassis-part-number", @@ -712,14 +712,14 @@ func Test_MachineCmd_BmcList(t *testing.T) { "--preallocated", "--not-allocated", "--network-names", "network-name", - "--network-prefixes", "network-prefix", - "--network-destination-prefixes", "network-dest-prefix", + "--network-prefixes", "0.0.0.0/24", + "--network-destination-prefixes", "0.0.0.0/0", "--network-ips", "1.2.3.4", "--network-vrfs", "1", "--network-asns", "2", - "--nic-macs", "nic-mac", + "--nic-macs", "00:00:00:00:00:01", "--nic-names", "nic-name", - "--nic-neighbor-macs", "nic-neighbor-mac", + "--nic-neighbor-macs", "00:00:00:00:00:02", "--nic-neighbor-names", "nic-neighbor-name", "--disk-names", "disk-name", "--disk-sizes", "1024", @@ -735,7 +735,7 @@ func Test_MachineCmd_BmcList(t *testing.T) { Hostname: new("hostname"), Name: new("name"), Image: new("image"), - Project: new("project"), + Project: new("0d81bca7-73f6-4da3-8397-4a8c52a0c583"), FilesystemLayout: new("fsl"), AllocationType: apiv2.MachineAllocationType_MACHINE_ALLOCATION_TYPE_FIREWALL.Enum(), Vpn: &apiv2.MachineVPN{ @@ -747,7 +747,7 @@ func Test_MachineCmd_BmcList(t *testing.T) { }, Partition: new("partition"), Size: new("size"), - Uuid: new("uuid"), + Uuid: new("5fa2bbe1-407c-4142-92d5-e4419daf9646"), Rack: new("rack"), Room: new("room"), Labels: &apiv2.Labels{ @@ -761,16 +761,16 @@ func Test_MachineCmd_BmcList(t *testing.T) { NotAllocated: new(true), Network: &apiv2.MachineNetworkQuery{ Networks: []string{"network-name"}, - Prefixes: []string{"network-prefix"}, - DestinationPrefixes: []string{"network-dest-prefix"}, + Prefixes: []string{"0.0.0.0/24"}, + DestinationPrefixes: []string{"0.0.0.0/0"}, Ips: []string{"1.2.3.4"}, Vrfs: []uint64{1}, Asns: []uint32{2}, }, Nic: &apiv2.MachineNicQuery{ - Macs: []string{"nic-mac"}, + Macs: []string{"00:00:00:00:00:01"}, Names: []string{"nic-name"}, - NeighborMacs: []string{"nic-neighbor-mac"}, + NeighborMacs: []string{"00:00:00:00:00:02"}, NeighborNames: []string{"nic-neighbor-name"}, }, Disk: &apiv2.MachineDiskQuery{ @@ -778,8 +778,8 @@ func Test_MachineCmd_BmcList(t *testing.T) { Sizes: []uint64{1024}, }, Bmc: &apiv2.MachineBMCQuery{ - Address: new("bmc-address"), - Mac: new("bmc-mac"), + Address: new("1.2.3.4"), + Mac: new("00:00:00:00:00:03"), User: new("bmc-user"), Interface: new("bmc-interface"), }, @@ -811,25 +811,25 @@ func Test_MachineCmd_BmcList(t *testing.T) { }, }), WantTable: new(` - ID POWER IP MAC BOARD PART NUMBER BIOS BMC SIZE PARTITION RACK UPDATED - 5fa2bbe1-407c-4142-92d5-e4419daf9646 🟒 ⏾ 120W 10.0.0.1:623 02:00:00:00:00:01 Board-PN-1 1.5.6 3.1.1 v1-medium-x86 partition-1 rack-1 1m ago - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd ⏾ 0W 10.0.0.2:623 02:00:00:00:00:02 Board-PN-2 2.0.0 2.4.0 v1-medium-x86 partition-2 rack-1 2m ago + ID POWER IP MAC BOARD PART NUMBER BIOS BMC SIZE PARTITION RACK UPDATED + 5fa2bbe1-407c-4142-92d5-e4419daf9646 🟒 ⏾ 120W 10.0.0.1:623 02:00:00:00:00:01 Board-PN-1 1.5.6 3.1.1 v1-medium-x86 5711axzf0-4218-p7x9-3f8f-d34912dx190q rack-1 1m ago + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f ⏾ 0W 10.0.0.2:623 02:00:00:00:00:02 Board-PN-2 2.0.0 2.4.0 v1-medium-x86 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 2m ago `), WantWideTable: new(` - ID LED POWER IP MAC BOARD PART NUMBER CHASSIS SERIAL PRODUCT SERIAL BIOS VERSION BMC VERSION SIZE PARTITION RACK UPDATED - 5fa2bbe1-407c-4142-92d5-e4419daf9646 LED-ON on On On 120W 10.0.0.1:623 02:00:00:00:00:01 Board-PN-1 Chassis-SN-1 Product-SN-1 1.5.6 3.1.1 v1-medium-x86 partition-1 rack-1 1m ago - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd LED-OFF off Power Supply Warning Absent 0W 10.0.0.2:623 02:00:00:00:00:02 Board-PN-2 Chassis-SN-2 Product-SN-2 2.0.0 2.4.0 v1-medium-x86 partition-2 rack-1 2m ago + ID LED POWER IP MAC BOARD PART NUMBER CHASSIS SERIAL PRODUCT SERIAL BIOS VERSION BMC VERSION SIZE PARTITION RACK UPDATED + 5fa2bbe1-407c-4142-92d5-e4419daf9646 LED-ON on On On 120W 10.0.0.1:623 02:00:00:00:00:01 Board-PN-1 Chassis-SN-1 Product-SN-1 1.5.6 3.1.1 v1-medium-x86 5711axzf0-4218-p7x9-3f8f-d34912dx190q rack-1 1m ago + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f LED-OFF off Power Supply Warning Absent 0W 10.0.0.2:623 02:00:00:00:00:02 Board-PN-2 Chassis-SN-2 Product-SN-2 2.0.0 2.4.0 v1-medium-x86 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 2m ago `), Template: new("{{ .uuid }} {{ .bmc_report.bmc.address }}"), WantTemplate: new(` 5fa2bbe1-407c-4142-92d5-e4419daf9646 10.0.0.1:623 -673fc473-63ca-4ea4-b9dd-b45cb2127a6fd 10.0.0.2:623 +673fc473-63ca-4ea4-b9dd-b45cb2127a6f 10.0.0.2:623 `), WantMarkdown: new(` - | ID | | POWER | IP | MAC | BOARD PART NUMBER | BIOS | BMC | SIZE | PARTITION | RACK | UPDATED | - |---------------------------------------|---|--------|--------------|-------------------|-------------------|-------|-------|---------------|-------------|--------|---------| - | 5fa2bbe1-407c-4142-92d5-e4419daf9646 | 🟒 | ⏾ 120W | 10.0.0.1:623 | 02:00:00:00:00:01 | Board-PN-1 | 1.5.6 | 3.1.1 | v1-medium-x86 | partition-1 | rack-1 | 1m ago | - | 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd | | ⏾ 0W | 10.0.0.2:623 | 02:00:00:00:00:02 | Board-PN-2 | 2.0.0 | 2.4.0 | v1-medium-x86 | partition-2 | rack-1 | 2m ago | + | ID | | POWER | IP | MAC | BOARD PART NUMBER | BIOS | BMC | SIZE | PARTITION | RACK | UPDATED | + |--------------------------------------|---|--------|--------------|-------------------|-------------------|-------|-------|---------------|---------------------------------------|--------|---------| + | 5fa2bbe1-407c-4142-92d5-e4419daf9646 | 🟒 | ⏾ 120W | 10.0.0.1:623 | 02:00:00:00:00:01 | Board-PN-1 | 1.5.6 | 3.1.1 | v1-medium-x86 | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | rack-1 | 1m ago | + | 673fc473-63ca-4ea4-b9dd-b45cb2127a6f | | ⏾ 0W | 10.0.0.2:623 | 02:00:00:00:00:02 | Board-PN-2 | 2.0.0 | 2.4.0 | v1-medium-x86 | d34912dx1-90qe-3jf8-1kd0-5711axzf08sj | rack-1 | 2m ago | `), }, } @@ -858,21 +858,21 @@ func Test_MachineCmd_BmcDescribe(t *testing.T) { }, }), WantTable: new(` - ID POWER IP MAC BOARD PART NUMBER BIOS BMC SIZE PARTITION RACK UPDATED - 5fa2bbe1-407c-4142-92d5-e4419daf9646 🟒 ⏾ 120W 10.0.0.1:623 02:00:00:00:00:01 Board-PN-1 1.5.6 3.1.1 v1-medium-x86 partition-1 rack-1 1m ago + ID POWER IP MAC BOARD PART NUMBER BIOS BMC SIZE PARTITION RACK UPDATED + 5fa2bbe1-407c-4142-92d5-e4419daf9646 🟒 ⏾ 120W 10.0.0.1:623 02:00:00:00:00:01 Board-PN-1 1.5.6 3.1.1 v1-medium-x86 5711axzf0-4218-p7x9-3f8f-d34912dx190q rack-1 1m ago `), WantWideTable: new(` - ID LED POWER IP MAC BOARD PART NUMBER CHASSIS SERIAL PRODUCT SERIAL BIOS VERSION BMC VERSION SIZE PARTITION RACK UPDATED - 5fa2bbe1-407c-4142-92d5-e4419daf9646 LED-ON on On On 120W 10.0.0.1:623 02:00:00:00:00:01 Board-PN-1 Chassis-SN-1 Product-SN-1 1.5.6 3.1.1 v1-medium-x86 partition-1 rack-1 1m ago + ID LED POWER IP MAC BOARD PART NUMBER CHASSIS SERIAL PRODUCT SERIAL BIOS VERSION BMC VERSION SIZE PARTITION RACK UPDATED + 5fa2bbe1-407c-4142-92d5-e4419daf9646 LED-ON on On On 120W 10.0.0.1:623 02:00:00:00:00:01 Board-PN-1 Chassis-SN-1 Product-SN-1 1.5.6 3.1.1 v1-medium-x86 5711axzf0-4218-p7x9-3f8f-d34912dx190q rack-1 1m ago `), Template: new("{{ .uuid }} {{ .bmc_report.bmc.address }}"), WantTemplate: new(` 5fa2bbe1-407c-4142-92d5-e4419daf9646 10.0.0.1:623 `), WantMarkdown: new(` - | ID | | POWER | IP | MAC | BOARD PART NUMBER | BIOS | BMC | SIZE | PARTITION | RACK | UPDATED | - |--------------------------------------|---|--------|--------------|-------------------|-------------------|-------|-------|---------------|-------------|--------|---------| - | 5fa2bbe1-407c-4142-92d5-e4419daf9646 | 🟒 | ⏾ 120W | 10.0.0.1:623 | 02:00:00:00:00:01 | Board-PN-1 | 1.5.6 | 3.1.1 | v1-medium-x86 | partition-1 | rack-1 | 1m ago | + | ID | | POWER | IP | MAC | BOARD PART NUMBER | BIOS | BMC | SIZE | PARTITION | RACK | UPDATED | + |--------------------------------------|---|--------|--------------|-------------------|-------------------|-------|-------|---------------|---------------------------------------|--------|---------| + | 5fa2bbe1-407c-4142-92d5-e4419daf9646 | 🟒 | ⏾ 120W | 10.0.0.1:623 | 02:00:00:00:00:01 | Board-PN-1 | 1.5.6 | 3.1.1 | v1-medium-x86 | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | rack-1 | 1m ago | `), }, } diff --git a/tests/e2e/admin/partition_test.go b/tests/e2e/admin/partition_test.go index 5df87e4..8d2b405 100644 --- a/tests/e2e/admin/partition_test.go +++ b/tests/e2e/admin/partition_test.go @@ -216,8 +216,8 @@ func Test_AdminPartitionCmd_Apply(t *testing.T) { }, }), WantTable: new(` - ID DESCRIPTION - partition-1 partition 1 + ID DESCRIPTION + 5711axzf0-4218-p7x9-3f8f-d34912dx190q partition 1 `), }, { @@ -259,8 +259,8 @@ func Test_AdminPartitionCmd_Apply(t *testing.T) { }, }), WantTable: new(` - ID DESCRIPTION - partition-1 partition 1 + ID DESCRIPTION + 5711axzf0-4218-p7x9-3f8f-d34912dx190q partition 1 `), }, } diff --git a/tests/e2e/api/ip_test.go b/tests/e2e/api/ip_test.go index d16b631..4ffd42e 100644 --- a/tests/e2e/api/ip_test.go +++ b/tests/e2e/api/ip_test.go @@ -40,8 +40,8 @@ func Test_IPCmd_List(t *testing.T) { }), WantTable: new(` IP PROJECT ID NETWORK TYPE NAME ATTACHED SERVICE - 4.3.2.1 46bdfc45-9c8d-4268-b359-b40e3079d384 9cef40ec-29c6-4dfa-aee8-47ee1f49223d internet ephemeral b - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static a + 4.3.2.1 46bdfc45-9c8d-4268-b359-b40e3079d384 9cef40ec-29c6-4dfa-aee8-47ee1f49223d internet ephemeral bb + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static aa `), WantWideTable: new(` IP PROJECT ID TYPE NAME DESCRIPTION LABELS @@ -56,8 +56,8 @@ func Test_IPCmd_List(t *testing.T) { WantMarkdown: new(` | IP | PROJECT | ID | NETWORK | TYPE | NAME | ATTACHED SERVICE | |---------|--------------------------------------|--------------------------------------|----------|-----------|------|------------------| - | 4.3.2.1 | 46bdfc45-9c8d-4268-b359-b40e3079d384 | 9cef40ec-29c6-4dfa-aee8-47ee1f49223d | internet | ephemeral | b | | - | 1.1.1.1 | ce19a655-7933-4745-8f3e-9592b4a90488 | 2e0144a2-09ef-42b7-b629-4263295db6e8 | internet | static | a | | + | 4.3.2.1 | 46bdfc45-9c8d-4268-b359-b40e3079d384 | 9cef40ec-29c6-4dfa-aee8-47ee1f49223d | internet | ephemeral | bb | | + | 1.1.1.1 | ce19a655-7933-4745-8f3e-9592b4a90488 | 2e0144a2-09ef-42b7-b629-4263295db6e8 | internet | static | aa | | `), }, { @@ -68,7 +68,7 @@ func Test_IPCmd_List(t *testing.T) { "--uuid", testresources.IP1().Uuid, "--name", testresources.IP1().Name, "--network", testresources.IP1().Network, - "--machine", "machine-1", + "--machine", "5fa2bbe1-407c-4142-92d5-e4419daf9646", "--labels", "a=b", "--addressfamily", "IPv4", "--type", "static", @@ -85,7 +85,7 @@ func Test_IPCmd_List(t *testing.T) { Uuid: pointer.PointerOrNil(testresources.IP1().Uuid), Name: pointer.PointerOrNil(testresources.IP1().Name), Network: pointer.PointerOrNil(testresources.IP1().Network), - Machine: pointer.PointerOrNil("machine-1"), + Machine: pointer.PointerOrNil("5fa2bbe1-407c-4142-92d5-e4419daf9646"), Type: pointer.PointerOrNil(apiv2.IPType_IP_TYPE_STATIC), AddressFamily: apiv2.IPAddressFamily_IP_ADDRESS_FAMILY_V4.Enum(), Labels: &apiv2.Labels{ @@ -105,7 +105,7 @@ func Test_IPCmd_List(t *testing.T) { }), WantTable: new(` IP PROJECT ID NETWORK TYPE NAME ATTACHED SERVICE - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static a + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static aa `), }, } @@ -137,7 +137,7 @@ func Test_IPCmd_Describe(t *testing.T) { WantProtoObject: testresources.IP1(), WantTable: new(` IP PROJECT ID NETWORK TYPE NAME ATTACHED SERVICE - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static a + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static aa `), WantWideTable: new(` IP PROJECT ID TYPE NAME DESCRIPTION LABELS @@ -150,7 +150,7 @@ func Test_IPCmd_Describe(t *testing.T) { WantMarkdown: new(` | IP | PROJECT | ID | NETWORK | TYPE | NAME | ATTACHED SERVICE | |---------|--------------------------------------|--------------------------------------|----------|--------|------|------------------| - | 1.1.1.1 | ce19a655-7933-4745-8f3e-9592b4a90488 | 2e0144a2-09ef-42b7-b629-4263295db6e8 | internet | static | a | | + | 1.1.1.1 | ce19a655-7933-4745-8f3e-9592b4a90488 | 2e0144a2-09ef-42b7-b629-4263295db6e8 | internet | static | aa | | `), }, } @@ -212,7 +212,7 @@ func Test_IPCmd_Create(t *testing.T) { }), WantTable: new(` IP PROJECT ID NETWORK TYPE NAME ATTACHED SERVICE - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static a + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static aa `), }, } @@ -268,7 +268,7 @@ func Test_IPCmd_Delete(t *testing.T) { ), WantTable: new(` IP PROJECT ID NETWORK TYPE NAME ATTACHED SERVICE - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static a + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static aa `), }, } @@ -306,7 +306,7 @@ func Test_IPCmd_Update(t *testing.T) { WantProtoObject: testresources.IP1(), WantTable: new(` IP PROJECT ID NETWORK TYPE NAME ATTACHED SERVICE - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static a + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static aa `), WantWideTable: new(` IP PROJECT ID TYPE NAME DESCRIPTION LABELS @@ -351,7 +351,7 @@ func Test_IPCmd_Update(t *testing.T) { ), WantTable: new(` IP PROJECT ID NETWORK TYPE NAME ATTACHED SERVICE - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static a + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static aa `), }, } @@ -393,7 +393,7 @@ func Test_IPCmd_Apply(t *testing.T) { ), WantTable: new(` IP PROJECT ID NETWORK TYPE NAME ATTACHED SERVICE - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static a + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static aa `), }, { @@ -446,7 +446,7 @@ func Test_IPCmd_Apply(t *testing.T) { ), WantTable: new(` IP PROJECT ID NETWORK TYPE NAME ATTACHED SERVICE - 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static a + 1.1.1.1 ce19a655-7933-4745-8f3e-9592b4a90488 2e0144a2-09ef-42b7-b629-4263295db6e8 internet static aa `), }, } diff --git a/tests/e2e/api/machine_test.go b/tests/e2e/api/machine_test.go index 1f872b5..9a9971d 100644 --- a/tests/e2e/api/machine_test.go +++ b/tests/e2e/api/machine_test.go @@ -41,12 +41,12 @@ func Test_MachineCmd_List(t *testing.T) { }, }), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 `), WantWideTable: new(` - ID LAST EVENT WHEN AGE DESCRIPTION NAME HOSTNAME PROJECT IPS SIZE IMAGE PARTITION RACK STARTED TAGS STATE - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd Phoned Home 1m 1m machine 2 machine-2 machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 4.5.6.7 v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 1999-12-31T23:59:00Z c=d available + ID LAST EVENT WHEN AGE DESCRIPTION NAME HOSTNAME PROJECT IPS SIZE IMAGE PARTITION RACK STARTED TAGS STATE + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f Phoned Home 1m 1m machine 2 machine-2 machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 4.5.6.7 v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 1999-12-31T23:59:00Z c=d available 192.1.1.1 `), Template: new("{{ .allocation.uuid }} {{ .allocation.project }}"), @@ -54,9 +54,9 @@ func Test_MachineCmd_List(t *testing.T) { 4f94e87b-b08f-4f82-b053-9b8305de60ad f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c `), WantMarkdown: new(` - | ID | | LAST EVENT | WHEN | AGE | HOSTNAME | PROJECT | SIZE | IMAGE | PARTITION | RACK | - |---------------------------------------|---|-------------|------|-----|-----------|--------------------------------------|---------------|--------------|-------------|--------| - | 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd | 🛡 | Phoned Home | 1m | 1m | machine-2 | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | v1-medium-x86 | Ubuntu 24.04 | partition-2 | rack-1 | + | ID | | LAST EVENT | WHEN | AGE | HOSTNAME | PROJECT | SIZE | IMAGE | PARTITION | RACK | + |--------------------------------------|---|-------------|------|-----|-----------|--------------------------------------|---------------|--------------|---------------------------------------|--------| + | 673fc473-63ca-4ea4-b9dd-b45cb2127a6f | 🛡 | Phoned Home | 1m | 1m | machine-2 | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | v1-medium-x86 | Ubuntu 24.04 | d34912dx1-90qe-3jf8-1kd0-5711axzf08sj | rack-1 | `), }, } @@ -87,12 +87,12 @@ func Test_MachineCmd_Describe(t *testing.T) { }), WantProtoObject: testresources.Machine2(), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 `), WantWideTable: new(` - ID LAST EVENT WHEN AGE DESCRIPTION NAME HOSTNAME PROJECT IPS SIZE IMAGE PARTITION RACK STARTED TAGS STATE - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd Phoned Home 1m 1m machine 2 machine-2 machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 4.5.6.7 v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 1999-12-31T23:59:00Z c=d available + ID LAST EVENT WHEN AGE DESCRIPTION NAME HOSTNAME PROJECT IPS SIZE IMAGE PARTITION RACK STARTED TAGS STATE + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f Phoned Home 1m 1m machine 2 machine-2 machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 4.5.6.7 v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 1999-12-31T23:59:00Z c=d available 192.1.1.1 `), Template: new("{{ .allocation.uuid }} {{ .allocation.project }}"), @@ -100,9 +100,9 @@ func Test_MachineCmd_Describe(t *testing.T) { 4f94e87b-b08f-4f82-b053-9b8305de60ad f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c `), WantMarkdown: new(` - | ID | | LAST EVENT | WHEN | AGE | HOSTNAME | PROJECT | SIZE | IMAGE | PARTITION | RACK | - |---------------------------------------|---|-------------|------|-----|-----------|--------------------------------------|---------------|--------------|-------------|--------| - | 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd | 🛡 | Phoned Home | 1m | 1m | machine-2 | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | v1-medium-x86 | Ubuntu 24.04 | partition-2 | rack-1 | + | ID | | LAST EVENT | WHEN | AGE | HOSTNAME | PROJECT | SIZE | IMAGE | PARTITION | RACK | + |--------------------------------------|---|-------------|------|-----|-----------|--------------------------------------|---------------|--------------|---------------------------------------|--------| + | 673fc473-63ca-4ea4-b9dd-b45cb2127a6f | 🛡 | Phoned Home | 1m | 1m | machine-2 | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | v1-medium-x86 | Ubuntu 24.04 | d34912dx1-90qe-3jf8-1kd0-5711axzf08sj | rack-1 | `), }, } @@ -246,8 +246,8 @@ func Test_MachineCmd_Create(t *testing.T) { }, }), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 `), }, } @@ -302,8 +302,8 @@ func Test_MachineCmd_Delete(t *testing.T) { }, ), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 `), }, } @@ -395,8 +395,8 @@ func Test_MachineCmd_Update(t *testing.T) { }, ), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 `), }, } @@ -452,8 +452,8 @@ func Test_MachineCmd_Apply(t *testing.T) { }, ), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 `), }, { @@ -518,8 +518,8 @@ func Test_MachineCmd_Apply(t *testing.T) { }, ), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6fd 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 `), }, } diff --git a/tests/e2e/api/project_member_test.go b/tests/e2e/api/project_member_test.go index 83cd346..dd3b76c 100644 --- a/tests/e2e/api/project_member_test.go +++ b/tests/e2e/api/project_member_test.go @@ -134,7 +134,10 @@ func Test_ProjectMemberCmd_Update(t *testing.T) { WantRequest: &apiv2.ProjectMemberServiceUpdateRequest{ Project: testresources.Project1().Uuid, Member: testresources.Project1Member().Member, - Role: &testresources.Project1Member().Role, + Role: new(testresources.Project1Member().Role), + UpdateMeta: &apiv2.UpdateMeta{ + LockingStrategy: apiv2.OptimisticLockingStrategy_OPTIMISTIC_LOCKING_STRATEGY_SERVER, + }, }, WantResponse: func() connect.AnyResponse { return connect.NewResponse(&apiv2.ProjectMemberServiceUpdateResponse{ diff --git a/tests/e2e/api/tenant_member_test.go b/tests/e2e/api/tenant_member_test.go index e0a501a..48a4ebd 100644 --- a/tests/e2e/api/tenant_member_test.go +++ b/tests/e2e/api/tenant_member_test.go @@ -139,6 +139,9 @@ func Test_TenantMemberCmd_Update(t *testing.T) { Login: testresources.Tenant1().Login, Member: testresources.Tenant1Member().Member, Role: pointer.PointerOrNil(testresources.Tenant1Member().Role), + UpdateMeta: &apiv2.UpdateMeta{ + LockingStrategy: apiv2.OptimisticLockingStrategy_OPTIMISTIC_LOCKING_STRATEGY_SERVER, + }, }, WantResponse: func() connect.AnyResponse { return connect.NewResponse(&apiv2.TenantMemberServiceUpdateResponse{ diff --git a/tests/e2e/testresources/machine.go b/tests/e2e/testresources/machine.go index 0dd77ea..4379bc9 100644 --- a/tests/e2e/testresources/machine.go +++ b/tests/e2e/testresources/machine.go @@ -74,7 +74,7 @@ var ( } Machine2 = func() *apiv2.Machine { return &apiv2.Machine{ - Uuid: "673fc473-63ca-4ea4-b9dd-b45cb2127a6fd", + Uuid: "673fc473-63ca-4ea4-b9dd-b45cb2127a6f", Meta: &apiv2.Meta{ Labels: &apiv2.Labels{ Labels: map[string]string{ diff --git a/tests/e2e/testresources/partitions.go b/tests/e2e/testresources/partitions.go index 2a7534c..70de1b9 100644 --- a/tests/e2e/testresources/partitions.go +++ b/tests/e2e/testresources/partitions.go @@ -14,8 +14,8 @@ var ( }, BootConfiguration: &apiv2.PartitionBootConfiguration{ Commandline: "commandline", - ImageUrl: "imageurl", - KernelUrl: "kernelurl", + ImageUrl: "https://images.metal-stack.io/os/image.tar.lz4", + KernelUrl: "https://images.metal-stack.io/os/kernel", }, Meta: &apiv2.Meta{ Labels: &apiv2.Labels{ @@ -35,8 +35,8 @@ var ( }, BootConfiguration: &apiv2.PartitionBootConfiguration{ Commandline: "commandline", - ImageUrl: "imageurl", - KernelUrl: "kernelurl", + ImageUrl: "https://images.metal-stack.io/os/image.tar.lz4", + KernelUrl: "https://images.metal-stack.io/os/kernel", }, Meta: &apiv2.Meta{ Labels: &apiv2.Labels{ From 7c6d1cc3b9db03e2caa9c8da2c50a2554672d682 Mon Sep 17 00:00:00 2001 From: Simon Mayer Date: Wed, 4 Nov 2026 15:41:38 +0100 Subject: [PATCH 3/3] Rename partition id --- tests/e2e/admin/machine_test.go | 112 +++++++++++++------------- tests/e2e/admin/network_test.go | 76 ++++++++--------- tests/e2e/admin/partition_test.go | 86 ++++++++++---------- tests/e2e/api/machine_test.go | 72 ++++++++--------- tests/e2e/api/network_test.go | 88 ++++++++++---------- tests/e2e/testresources/partitions.go | 4 +- 6 files changed, 219 insertions(+), 219 deletions(-) diff --git a/tests/e2e/admin/machine_test.go b/tests/e2e/admin/machine_test.go index c0effe1..bbe5a84 100644 --- a/tests/e2e/admin/machine_test.go +++ b/tests/e2e/admin/machine_test.go @@ -158,15 +158,15 @@ func Test_MachineCmd_List(t *testing.T) { }, }), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 5fa2bbe1-407c-4142-92d5-e4419daf9646 Alive 1m v1-medium-x86 5711axzf0-4218-p7x9-3f8f-d34912dx190q rack-1 - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 - `), + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 5fa2bbe1-407c-4142-92d5-e4419daf9646 Alive 1m v1-medium-x86 partition-1 rack-1 + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + `), WantWideTable: new(` - ID LAST EVENT WHEN AGE DESCRIPTION NAME HOSTNAME PROJECT IPS SIZE IMAGE PARTITION RACK STARTED TAGS STATE - 5fa2bbe1-407c-4142-92d5-e4419daf9646 Alive 1m v1-medium-x86 5711axzf0-4218-p7x9-3f8f-d34912dx190q rack-1 a=b available - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f Phoned Home 1m 1m machine 2 machine-2 machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 4.5.6.7 v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 1999-12-31T23:59:00Z c=d available - 192.1.1.1 + ID LAST EVENT WHEN AGE DESCRIPTION NAME HOSTNAME PROJECT IPS SIZE IMAGE PARTITION RACK STARTED TAGS STATE + 5fa2bbe1-407c-4142-92d5-e4419daf9646 Alive 1m v1-medium-x86 partition-1 rack-1 a=b available + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f Phoned Home 1m 1m machine 2 machine-2 machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 4.5.6.7 v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 1999-12-31T23:59:00Z c=d available + 192.1.1.1 `), Template: new("{{ .allocation.uuid }} {{ .allocation.project }}"), WantTemplate: new(` @@ -174,11 +174,11 @@ func Test_MachineCmd_List(t *testing.T) { 4f94e87b-b08f-4f82-b053-9b8305de60ad f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c `), WantMarkdown: new(` - | ID | | LAST EVENT | WHEN | AGE | HOSTNAME | PROJECT | SIZE | IMAGE | PARTITION | RACK | - |--------------------------------------|---|-------------|------|-----|-----------|--------------------------------------|---------------|--------------|---------------------------------------|--------| - | 5fa2bbe1-407c-4142-92d5-e4419daf9646 | | Alive | 1m | | | | v1-medium-x86 | | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | rack-1 | - | 673fc473-63ca-4ea4-b9dd-b45cb2127a6f | 🛡 | Phoned Home | 1m | 1m | machine-2 | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | v1-medium-x86 | Ubuntu 24.04 | d34912dx1-90qe-3jf8-1kd0-5711axzf08sj | rack-1 | - `), + | ID | | LAST EVENT | WHEN | AGE | HOSTNAME | PROJECT | SIZE | IMAGE | PARTITION | RACK | + |--------------------------------------|---|-------------|------|-----|-----------|--------------------------------------|---------------|--------------|-------------|--------| + | 5fa2bbe1-407c-4142-92d5-e4419daf9646 | | Alive | 1m | | | | v1-medium-x86 | | partition-1 | rack-1 | + | 673fc473-63ca-4ea4-b9dd-b45cb2127a6f | 🛡 | Phoned Home | 1m | 1m | machine-2 | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | v1-medium-x86 | Ubuntu 24.04 | partition-2 | rack-1 | + `), }, { Name: "no flags", @@ -201,9 +201,9 @@ func Test_MachineCmd_List(t *testing.T) { }, }), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 5fa2bbe1-407c-4142-92d5-e4419daf9646 Alive 1m v1-medium-x86 5711axzf0-4218-p7x9-3f8f-d34912dx190q rack-1 - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 5fa2bbe1-407c-4142-92d5-e4419daf9646 Alive 1m v1-medium-x86 partition-1 rack-1 + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 `), }, } @@ -233,23 +233,23 @@ func Test_MachineCmd_Describe(t *testing.T) { }), WantProtoObject: testresources.Machine2(), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 `), WantWideTable: new(` - ID LAST EVENT WHEN AGE DESCRIPTION NAME HOSTNAME PROJECT IPS SIZE IMAGE PARTITION RACK STARTED TAGS STATE - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f Phoned Home 1m 1m machine 2 machine-2 machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 4.5.6.7 v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 1999-12-31T23:59:00Z c=d available - 192.1.1.1 - `), + ID LAST EVENT WHEN AGE DESCRIPTION NAME HOSTNAME PROJECT IPS SIZE IMAGE PARTITION RACK STARTED TAGS STATE + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f Phoned Home 1m 1m machine 2 machine-2 machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 4.5.6.7 v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 1999-12-31T23:59:00Z c=d available + 192.1.1.1 + `), Template: new("{{ .allocation.uuid }} {{ .allocation.project }}"), WantTemplate: new(` 4f94e87b-b08f-4f82-b053-9b8305de60ad f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c `), WantMarkdown: new(` - | ID | | LAST EVENT | WHEN | AGE | HOSTNAME | PROJECT | SIZE | IMAGE | PARTITION | RACK | - |--------------------------------------|---|-------------|------|-----|-----------|--------------------------------------|---------------|--------------|---------------------------------------|--------| - | 673fc473-63ca-4ea4-b9dd-b45cb2127a6f | 🛡 | Phoned Home | 1m | 1m | machine-2 | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | v1-medium-x86 | Ubuntu 24.04 | d34912dx1-90qe-3jf8-1kd0-5711axzf08sj | rack-1 | - `), + | ID | | LAST EVENT | WHEN | AGE | HOSTNAME | PROJECT | SIZE | IMAGE | PARTITION | RACK | + |--------------------------------------|---|-------------|------|-----|-----------|--------------------------------------|---------------|--------------|-------------|--------| + | 673fc473-63ca-4ea4-b9dd-b45cb2127a6f | 🛡 | Phoned Home | 1m | 1m | machine-2 | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | v1-medium-x86 | Ubuntu 24.04 | partition-2 | rack-1 | + `), }, } for _, tt := range tests { @@ -394,8 +394,8 @@ func Test_MachineCmd_Create(t *testing.T) { }, }), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 `), }, } @@ -448,8 +448,8 @@ func Test_MachineCmd_Delete(t *testing.T) { }, ), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 `), }, } @@ -541,8 +541,8 @@ func Test_MachineCmd_Update(t *testing.T) { }, ), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 `), }, } @@ -597,9 +597,9 @@ func Test_MachineCmd_Apply(t *testing.T) { }, ), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 - `), + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + `), }, { Name: "apply already exists", @@ -662,8 +662,8 @@ func Test_MachineCmd_Apply(t *testing.T) { }, ), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 `), }, } @@ -811,25 +811,25 @@ func Test_MachineCmd_BmcList(t *testing.T) { }, }), WantTable: new(` - ID POWER IP MAC BOARD PART NUMBER BIOS BMC SIZE PARTITION RACK UPDATED - 5fa2bbe1-407c-4142-92d5-e4419daf9646 🟒 ⏾ 120W 10.0.0.1:623 02:00:00:00:00:01 Board-PN-1 1.5.6 3.1.1 v1-medium-x86 5711axzf0-4218-p7x9-3f8f-d34912dx190q rack-1 1m ago - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f ⏾ 0W 10.0.0.2:623 02:00:00:00:00:02 Board-PN-2 2.0.0 2.4.0 v1-medium-x86 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 2m ago + ID POWER IP MAC BOARD PART NUMBER BIOS BMC SIZE PARTITION RACK UPDATED + 5fa2bbe1-407c-4142-92d5-e4419daf9646 🟒 ⏾ 120W 10.0.0.1:623 02:00:00:00:00:01 Board-PN-1 1.5.6 3.1.1 v1-medium-x86 partition-1 rack-1 1m ago + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f ⏾ 0W 10.0.0.2:623 02:00:00:00:00:02 Board-PN-2 2.0.0 2.4.0 v1-medium-x86 partition-2 rack-1 2m ago `), WantWideTable: new(` - ID LED POWER IP MAC BOARD PART NUMBER CHASSIS SERIAL PRODUCT SERIAL BIOS VERSION BMC VERSION SIZE PARTITION RACK UPDATED - 5fa2bbe1-407c-4142-92d5-e4419daf9646 LED-ON on On On 120W 10.0.0.1:623 02:00:00:00:00:01 Board-PN-1 Chassis-SN-1 Product-SN-1 1.5.6 3.1.1 v1-medium-x86 5711axzf0-4218-p7x9-3f8f-d34912dx190q rack-1 1m ago - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f LED-OFF off Power Supply Warning Absent 0W 10.0.0.2:623 02:00:00:00:00:02 Board-PN-2 Chassis-SN-2 Product-SN-2 2.0.0 2.4.0 v1-medium-x86 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 2m ago - `), + ID LED POWER IP MAC BOARD PART NUMBER CHASSIS SERIAL PRODUCT SERIAL BIOS VERSION BMC VERSION SIZE PARTITION RACK UPDATED + 5fa2bbe1-407c-4142-92d5-e4419daf9646 LED-ON on On On 120W 10.0.0.1:623 02:00:00:00:00:01 Board-PN-1 Chassis-SN-1 Product-SN-1 1.5.6 3.1.1 v1-medium-x86 partition-1 rack-1 1m ago + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f LED-OFF off Power Supply Warning Absent 0W 10.0.0.2:623 02:00:00:00:00:02 Board-PN-2 Chassis-SN-2 Product-SN-2 2.0.0 2.4.0 v1-medium-x86 partition-2 rack-1 2m ago + `), Template: new("{{ .uuid }} {{ .bmc_report.bmc.address }}"), WantTemplate: new(` 5fa2bbe1-407c-4142-92d5-e4419daf9646 10.0.0.1:623 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 10.0.0.2:623 `), WantMarkdown: new(` - | ID | | POWER | IP | MAC | BOARD PART NUMBER | BIOS | BMC | SIZE | PARTITION | RACK | UPDATED | - |--------------------------------------|---|--------|--------------|-------------------|-------------------|-------|-------|---------------|---------------------------------------|--------|---------| - | 5fa2bbe1-407c-4142-92d5-e4419daf9646 | 🟒 | ⏾ 120W | 10.0.0.1:623 | 02:00:00:00:00:01 | Board-PN-1 | 1.5.6 | 3.1.1 | v1-medium-x86 | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | rack-1 | 1m ago | - | 673fc473-63ca-4ea4-b9dd-b45cb2127a6f | | ⏾ 0W | 10.0.0.2:623 | 02:00:00:00:00:02 | Board-PN-2 | 2.0.0 | 2.4.0 | v1-medium-x86 | d34912dx1-90qe-3jf8-1kd0-5711axzf08sj | rack-1 | 2m ago | + | ID | | POWER | IP | MAC | BOARD PART NUMBER | BIOS | BMC | SIZE | PARTITION | RACK | UPDATED | + |--------------------------------------|---|--------|--------------|-------------------|-------------------|-------|-------|---------------|-------------|--------|---------| + | 5fa2bbe1-407c-4142-92d5-e4419daf9646 | 🟒 | ⏾ 120W | 10.0.0.1:623 | 02:00:00:00:00:01 | Board-PN-1 | 1.5.6 | 3.1.1 | v1-medium-x86 | partition-1 | rack-1 | 1m ago | + | 673fc473-63ca-4ea4-b9dd-b45cb2127a6f | | ⏾ 0W | 10.0.0.2:623 | 02:00:00:00:00:02 | Board-PN-2 | 2.0.0 | 2.4.0 | v1-medium-x86 | partition-2 | rack-1 | 2m ago | `), }, } @@ -858,21 +858,21 @@ func Test_MachineCmd_BmcDescribe(t *testing.T) { }, }), WantTable: new(` - ID POWER IP MAC BOARD PART NUMBER BIOS BMC SIZE PARTITION RACK UPDATED - 5fa2bbe1-407c-4142-92d5-e4419daf9646 🟒 ⏾ 120W 10.0.0.1:623 02:00:00:00:00:01 Board-PN-1 1.5.6 3.1.1 v1-medium-x86 5711axzf0-4218-p7x9-3f8f-d34912dx190q rack-1 1m ago + ID POWER IP MAC BOARD PART NUMBER BIOS BMC SIZE PARTITION RACK UPDATED + 5fa2bbe1-407c-4142-92d5-e4419daf9646 🟒 ⏾ 120W 10.0.0.1:623 02:00:00:00:00:01 Board-PN-1 1.5.6 3.1.1 v1-medium-x86 partition-1 rack-1 1m ago `), WantWideTable: new(` - ID LED POWER IP MAC BOARD PART NUMBER CHASSIS SERIAL PRODUCT SERIAL BIOS VERSION BMC VERSION SIZE PARTITION RACK UPDATED - 5fa2bbe1-407c-4142-92d5-e4419daf9646 LED-ON on On On 120W 10.0.0.1:623 02:00:00:00:00:01 Board-PN-1 Chassis-SN-1 Product-SN-1 1.5.6 3.1.1 v1-medium-x86 5711axzf0-4218-p7x9-3f8f-d34912dx190q rack-1 1m ago - `), + ID LED POWER IP MAC BOARD PART NUMBER CHASSIS SERIAL PRODUCT SERIAL BIOS VERSION BMC VERSION SIZE PARTITION RACK UPDATED + 5fa2bbe1-407c-4142-92d5-e4419daf9646 LED-ON on On On 120W 10.0.0.1:623 02:00:00:00:00:01 Board-PN-1 Chassis-SN-1 Product-SN-1 1.5.6 3.1.1 v1-medium-x86 partition-1 rack-1 1m ago + `), Template: new("{{ .uuid }} {{ .bmc_report.bmc.address }}"), WantTemplate: new(` 5fa2bbe1-407c-4142-92d5-e4419daf9646 10.0.0.1:623 `), WantMarkdown: new(` - | ID | | POWER | IP | MAC | BOARD PART NUMBER | BIOS | BMC | SIZE | PARTITION | RACK | UPDATED | - |--------------------------------------|---|--------|--------------|-------------------|-------------------|-------|-------|---------------|---------------------------------------|--------|---------| - | 5fa2bbe1-407c-4142-92d5-e4419daf9646 | 🟒 | ⏾ 120W | 10.0.0.1:623 | 02:00:00:00:00:01 | Board-PN-1 | 1.5.6 | 3.1.1 | v1-medium-x86 | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | rack-1 | 1m ago | + | ID | | POWER | IP | MAC | BOARD PART NUMBER | BIOS | BMC | SIZE | PARTITION | RACK | UPDATED | + |--------------------------------------|---|--------|--------------|-------------------|-------------------|-------|-------|---------------|-------------|--------|---------| + | 5fa2bbe1-407c-4142-92d5-e4419daf9646 | 🟒 | ⏾ 120W | 10.0.0.1:623 | 02:00:00:00:00:01 | Board-PN-1 | 1.5.6 | 3.1.1 | v1-medium-x86 | partition-1 | rack-1 | 1m ago | `), }, } diff --git a/tests/e2e/admin/network_test.go b/tests/e2e/admin/network_test.go index 38863d8..a913067 100644 --- a/tests/e2e/admin/network_test.go +++ b/tests/e2e/admin/network_test.go @@ -73,26 +73,26 @@ func Test_AdminNetworkCmd_List(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 - └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private child f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 5711axzf0-4218-p7x9-3f8f-d34912dx190q ipv4-masq 192.168.1.0/24 - `), + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private child f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c partition-1 ipv4-masq 192.168.1.0/24 + `), WantWideTable: new(` - ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx - └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private network private child f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 5711axzf0-4218-p7x9-3f8f-d34912dx190q ipv4-masq 192.168.1.0/24 a=b - `), + ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx + └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private network private child f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c partition-1 ipv4-masq 192.168.1.0/24 a=b + `), Template: new("{{ .id }} {{ .name }}"), WantTemplate: new(` 6988ebb0-9531-4f9b-a893-d7868258e2ef internet d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private `), WantMarkdown: new(` - | ID | NAME | TYPE | PROJECT | PARTITION | NAT | PREFIXES | PREFIX USAGE | IP USAGE | - |-----------------------------------------|----------|----------|--------------------------------------|---------------------------------------|-----------|---------------------------|--------------|----------| - | 6988ebb0-9531-4f9b-a893-d7868258e2ef | internet | external | 0d81bca7-73f6-4da3-8397-4a8c52a0c583 | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | none | 10.0.0.0/16,2001:db8::/32 |   |   | - | └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 | private | child | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | ipv4-masq | 192.168.1.0/24 |   |   | - `), + | ID | NAME | TYPE | PROJECT | PARTITION | NAT | PREFIXES | PREFIX USAGE | IP USAGE | + |-----------------------------------------|----------|----------|--------------------------------------|-------------|-----------|---------------------------|--------------|----------| + | 6988ebb0-9531-4f9b-a893-d7868258e2ef | internet | external | 0d81bca7-73f6-4da3-8397-4a8c52a0c583 | partition-1 | none | 10.0.0.0/16,2001:db8::/32 |   |   | + | └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 | private | child | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | partition-1 | ipv4-masq | 192.168.1.0/24 |   |   | + `), }, } for _, tt := range tests { @@ -121,22 +121,22 @@ func Test_AdminNetworkCmd_Describe(t *testing.T) { }), WantProtoObject: testresources.Network1(), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 - `), + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + `), WantWideTable: new(` - ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx - `), + ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx + `), Template: new("{{ .id }} {{ .name }}"), WantTemplate: new(` 6988ebb0-9531-4f9b-a893-d7868258e2ef internet `), WantMarkdown: new(` - | ID | NAME | TYPE | PROJECT | PARTITION | NAT | PREFIXES | PREFIX USAGE | IP USAGE | - |--------------------------------------|----------|----------|--------------------------------------|---------------------------------------|------|---------------------------|--------------|----------| - | 6988ebb0-9531-4f9b-a893-d7868258e2ef | internet | external | 0d81bca7-73f6-4da3-8397-4a8c52a0c583 | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | none | 10.0.0.0/16,2001:db8::/32 |   |   | - `), + | ID | NAME | TYPE | PROJECT | PARTITION | NAT | PREFIXES | PREFIX USAGE | IP USAGE | + |--------------------------------------|----------|----------|--------------------------------------|-------------|------|---------------------------|--------------|----------| + | 6988ebb0-9531-4f9b-a893-d7868258e2ef | internet | external | 0d81bca7-73f6-4da3-8397-4a8c52a0c583 | partition-1 | none | 10.0.0.0/16,2001:db8::/32 |   |   | + `), }, } for _, tt := range tests { @@ -247,9 +247,9 @@ func Test_AdminNetworkCmd_Create(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 - `), + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + `), }, } for _, tt := range tests { @@ -278,9 +278,9 @@ func Test_AdminNetworkCmd_Delete(t *testing.T) { }), WantProtoObject: testresources.Network1(), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 - `), + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + `), }, { Name: "delete from file", @@ -304,9 +304,9 @@ func Test_AdminNetworkCmd_Delete(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 - `), + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + `), }, } for _, tt := range tests { @@ -340,9 +340,9 @@ func Test_AdminNetworkCmd_Update(t *testing.T) { }), WantProtoObject: testresources.Network1(), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 - `), + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + `), }, { Name: "update from file", @@ -380,9 +380,9 @@ func Test_AdminNetworkCmd_Update(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 - `), + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + `), }, } for _, tt := range tests { diff --git a/tests/e2e/admin/partition_test.go b/tests/e2e/admin/partition_test.go index 8d2b405..7883e35 100644 --- a/tests/e2e/admin/partition_test.go +++ b/tests/e2e/admin/partition_test.go @@ -39,26 +39,26 @@ func Test_AdminPartitionCmd_List(t *testing.T) { }, }), WantTable: new(` - ID DESCRIPTION - 5711axzf0-4218-p7x9-3f8f-d34912dx190q partition 1 - d34912dx1-90qe-3jf8-1kd0-5711axzf08sj partition 2 - `), + ID DESCRIPTION + partition-1 partition 1 + partition-2 partition 2 + `), WantWideTable: new(` - ID DESCRIPTION LABELS - 5711axzf0-4218-p7x9-3f8f-d34912dx190q partition 1 a=b - d34912dx1-90qe-3jf8-1kd0-5711axzf08sj partition 2 - `), + ID DESCRIPTION LABELS + partition-1 partition 1 a=b + partition-2 partition 2 + `), Template: new("{{ .id }} {{ .description }}"), WantTemplate: new(` -5711axzf0-4218-p7x9-3f8f-d34912dx190q partition 1 -d34912dx1-90qe-3jf8-1kd0-5711axzf08sj partition 2 +partition-1 partition 1 +partition-2 partition 2 `), WantMarkdown: new(` - | ID | DESCRIPTION | - |---------------------------------------|-------------| - | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | partition 1 | - | d34912dx1-90qe-3jf8-1kd0-5711axzf08sj | partition 2 | - `), + | ID | DESCRIPTION | + |-------------|-------------| + | partition-1 | partition 1 | + | partition-2 | partition 2 | + `), }, } for _, tt := range tests { @@ -106,7 +106,7 @@ func Test_AdminPartitionCmd_Capacity(t *testing.T) { return connect.NewResponse(&adminv2.PartitionServiceCapacityResponse{ PartitionCapacity: []*adminv2.PartitionCapacity{ { - Partition: "5711axzf0-4218-p7x9-3f8f-d34912dx190q", + Partition: "partition-1", MachineSizeCapacities: []*adminv2.MachineSizeCapacity{ { Size: "size-1", @@ -126,34 +126,34 @@ func Test_AdminPartitionCmd_Capacity(t *testing.T) { }, }), WantTable: new(` - PARTITION SIZE ALLOCATED FREE UNAVAILABLE RESERVATIONS | TOTAL | FAULTY - 5711axzf0-4218-p7x9-3f8f-d34912dx190q size-1 1 3 0 2 (1/3 used) | 5 | 2 - Total 1 3 0 2 | 5 | 2 - `), + PARTITION SIZE ALLOCATED FREE UNAVAILABLE RESERVATIONS | TOTAL | FAULTY + partition-1 size-1 1 3 0 2 (1/3 used) | 5 | 2 + Total 1 3 0 2 | 5 | 2 + `), WantWideTable: new(` - PARTITION SIZE ALLOCATED FREE UNAVAILABLE RESERVATIONS | TOTAL | FAULTY PHONED HOME WAITING OTHER - 5711axzf0-4218-p7x9-3f8f-d34912dx190q size-1 1 3 0 2 (1/3 used) | 5 | 2 0 0 0 - Total 1 3 0 2 | 5 | 2 0 0 0 - `), + PARTITION SIZE ALLOCATED FREE UNAVAILABLE RESERVATIONS | TOTAL | FAULTY PHONED HOME WAITING OTHER + partition-1 size-1 1 3 0 2 (1/3 used) | 5 | 2 0 0 0 + Total 1 3 0 2 | 5 | 2 0 0 0 + `), Template: new("{{ .partition }} {{ (index .machine_size_capacities 0).size }}"), WantTemplate: new(` -5711axzf0-4218-p7x9-3f8f-d34912dx190q size-1 +partition-1 size-1 `), WantMarkdown: new(` - | PARTITION | SIZE | ALLOCATED | FREE | UNAVAILABLE | RESERVATIONS | | | TOTAL | | | FAULTY | - |---------------------------------------|--------|-----------|------|-------------|--------------|---|-------|---|--------| - | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | size-1 | 1 | 3 | 0 | 2 (1/3 used) | | | 5 | | | 2 | - | Total | | 1 | 3 | 0 | 2 | | | 5 | | | 2 | - `), + | PARTITION | SIZE | ALLOCATED | FREE | UNAVAILABLE | RESERVATIONS | | | TOTAL | | | FAULTY | + |-------------|--------|-----------|------|-------------|--------------|---|-------|---|--------| + | partition-1 | size-1 | 1 | 3 | 0 | 2 (1/3 used) | | | 5 | | | 2 | + | Total | | 1 | 3 | 0 | 2 | | | 5 | | | 2 | + `), }, { Name: "capacity with filters", - CmdArgs: []string{"admin", "partition", "capacity", "--id", "5711axzf0-4218-p7x9-3f8f-d34912dx190q", "--size", "size-1", "--project", "0d81bca7-73f6-4da3-8397-4a8c52a0c583"}, + CmdArgs: []string{"admin", "partition", "capacity", "--id", "partition-1", "--size", "size-1", "--project", "0d81bca7-73f6-4da3-8397-4a8c52a0c583"}, NewRootCmd: e2erootcmd.NewRootCmd(t, &e2erootcmd.TestConfig{ ClientCalls: []client.ClientCall{ { WantRequest: &adminv2.PartitionServiceCapacityRequest{ - Id: new("5711axzf0-4218-p7x9-3f8f-d34912dx190q"), + Id: new("partition-1"), Size: new("size-1"), Project: new("0d81bca7-73f6-4da3-8397-4a8c52a0c583"), }, @@ -161,7 +161,7 @@ func Test_AdminPartitionCmd_Capacity(t *testing.T) { return connect.NewResponse(&adminv2.PartitionServiceCapacityResponse{ PartitionCapacity: []*adminv2.PartitionCapacity{ { - Partition: "5711axzf0-4218-p7x9-3f8f-d34912dx190q", + Partition: "partition-1", MachineSizeCapacities: []*adminv2.MachineSizeCapacity{ { Size: "size-1", @@ -181,10 +181,10 @@ func Test_AdminPartitionCmd_Capacity(t *testing.T) { }, }), WantTable: new(` - PARTITION SIZE ALLOCATED FREE UNAVAILABLE RESERVATIONS | TOTAL | FAULTY - 5711axzf0-4218-p7x9-3f8f-d34912dx190q size-1 1 3 0 2 (1/3 used) | 5 | 2 - Total 1 3 0 2 | 5 | 2 - `), + PARTITION SIZE ALLOCATED FREE UNAVAILABLE RESERVATIONS | TOTAL | FAULTY + partition-1 size-1 1 3 0 2 (1/3 used) | 5 | 2 + Total 1 3 0 2 | 5 | 2 + `), }, } for _, tt := range tests { @@ -216,9 +216,9 @@ func Test_AdminPartitionCmd_Apply(t *testing.T) { }, }), WantTable: new(` - ID DESCRIPTION - 5711axzf0-4218-p7x9-3f8f-d34912dx190q partition 1 - `), + ID DESCRIPTION + partition-1 partition 1 + `), }, { Name: "apply already exists", @@ -259,9 +259,9 @@ func Test_AdminPartitionCmd_Apply(t *testing.T) { }, }), WantTable: new(` - ID DESCRIPTION - 5711axzf0-4218-p7x9-3f8f-d34912dx190q partition 1 - `), + ID DESCRIPTION + partition-1 partition 1 + `), }, } for _, tt := range tests { diff --git a/tests/e2e/api/machine_test.go b/tests/e2e/api/machine_test.go index 9a9971d..6621daf 100644 --- a/tests/e2e/api/machine_test.go +++ b/tests/e2e/api/machine_test.go @@ -41,23 +41,23 @@ func Test_MachineCmd_List(t *testing.T) { }, }), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 - `), + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + `), WantWideTable: new(` - ID LAST EVENT WHEN AGE DESCRIPTION NAME HOSTNAME PROJECT IPS SIZE IMAGE PARTITION RACK STARTED TAGS STATE - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f Phoned Home 1m 1m machine 2 machine-2 machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 4.5.6.7 v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 1999-12-31T23:59:00Z c=d available - 192.1.1.1 - `), + ID LAST EVENT WHEN AGE DESCRIPTION NAME HOSTNAME PROJECT IPS SIZE IMAGE PARTITION RACK STARTED TAGS STATE + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f Phoned Home 1m 1m machine 2 machine-2 machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 4.5.6.7 v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 1999-12-31T23:59:00Z c=d available + 192.1.1.1 + `), Template: new("{{ .allocation.uuid }} {{ .allocation.project }}"), WantTemplate: new(` 4f94e87b-b08f-4f82-b053-9b8305de60ad f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c `), WantMarkdown: new(` - | ID | | LAST EVENT | WHEN | AGE | HOSTNAME | PROJECT | SIZE | IMAGE | PARTITION | RACK | - |--------------------------------------|---|-------------|------|-----|-----------|--------------------------------------|---------------|--------------|---------------------------------------|--------| - | 673fc473-63ca-4ea4-b9dd-b45cb2127a6f | 🛡 | Phoned Home | 1m | 1m | machine-2 | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | v1-medium-x86 | Ubuntu 24.04 | d34912dx1-90qe-3jf8-1kd0-5711axzf08sj | rack-1 | - `), + | ID | | LAST EVENT | WHEN | AGE | HOSTNAME | PROJECT | SIZE | IMAGE | PARTITION | RACK | + |--------------------------------------|---|-------------|------|-----|-----------|--------------------------------------|---------------|--------------|-------------|--------| + | 673fc473-63ca-4ea4-b9dd-b45cb2127a6f | 🛡 | Phoned Home | 1m | 1m | machine-2 | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | v1-medium-x86 | Ubuntu 24.04 | partition-2 | rack-1 | + `), }, } for _, tt := range tests { @@ -87,23 +87,23 @@ func Test_MachineCmd_Describe(t *testing.T) { }), WantProtoObject: testresources.Machine2(), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 - `), + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + `), WantWideTable: new(` - ID LAST EVENT WHEN AGE DESCRIPTION NAME HOSTNAME PROJECT IPS SIZE IMAGE PARTITION RACK STARTED TAGS STATE - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f Phoned Home 1m 1m machine 2 machine-2 machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 4.5.6.7 v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 1999-12-31T23:59:00Z c=d available - 192.1.1.1 - `), + ID LAST EVENT WHEN AGE DESCRIPTION NAME HOSTNAME PROJECT IPS SIZE IMAGE PARTITION RACK STARTED TAGS STATE + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f Phoned Home 1m 1m machine 2 machine-2 machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 4.5.6.7 v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 1999-12-31T23:59:00Z c=d available + 192.1.1.1 + `), Template: new("{{ .allocation.uuid }} {{ .allocation.project }}"), WantTemplate: new(` 4f94e87b-b08f-4f82-b053-9b8305de60ad f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c `), WantMarkdown: new(` - | ID | | LAST EVENT | WHEN | AGE | HOSTNAME | PROJECT | SIZE | IMAGE | PARTITION | RACK | - |--------------------------------------|---|-------------|------|-----|-----------|--------------------------------------|---------------|--------------|---------------------------------------|--------| - | 673fc473-63ca-4ea4-b9dd-b45cb2127a6f | 🛡 | Phoned Home | 1m | 1m | machine-2 | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | v1-medium-x86 | Ubuntu 24.04 | d34912dx1-90qe-3jf8-1kd0-5711axzf08sj | rack-1 | - `), + | ID | | LAST EVENT | WHEN | AGE | HOSTNAME | PROJECT | SIZE | IMAGE | PARTITION | RACK | + |--------------------------------------|---|-------------|------|-----|-----------|--------------------------------------|---------------|--------------|-------------|--------| + | 673fc473-63ca-4ea4-b9dd-b45cb2127a6f | 🛡 | Phoned Home | 1m | 1m | machine-2 | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | v1-medium-x86 | Ubuntu 24.04 | partition-2 | rack-1 | + `), }, } for _, tt := range tests { @@ -246,9 +246,9 @@ func Test_MachineCmd_Create(t *testing.T) { }, }), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 - `), + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + `), }, } for _, tt := range tests { @@ -302,9 +302,9 @@ func Test_MachineCmd_Delete(t *testing.T) { }, ), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 - `), + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + `), }, } for _, tt := range tests { @@ -395,9 +395,9 @@ func Test_MachineCmd_Update(t *testing.T) { }, ), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 - `), + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + `), }, } for _, tt := range tests { @@ -452,9 +452,9 @@ func Test_MachineCmd_Apply(t *testing.T) { }, ), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 - `), + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 + `), }, { Name: "apply already exists", @@ -518,8 +518,8 @@ func Test_MachineCmd_Apply(t *testing.T) { }, ), WantTable: new(` - ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK - 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 d34912dx1-90qe-3jf8-1kd0-5711axzf08sj rack-1 + ID LAST EVENT WHEN AGE HOSTNAME PROJECT SIZE IMAGE PARTITION RACK + 673fc473-63ca-4ea4-b9dd-b45cb2127a6f 🛡 Phoned Home 1m 1m machine-2 f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c v1-medium-x86 Ubuntu 24.04 partition-2 rack-1 `), }, } diff --git a/tests/e2e/api/network_test.go b/tests/e2e/api/network_test.go index bce2b54..b982890 100644 --- a/tests/e2e/api/network_test.go +++ b/tests/e2e/api/network_test.go @@ -73,26 +73,26 @@ func Test_NetworkCmd_List(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 - └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private child f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 5711axzf0-4218-p7x9-3f8f-d34912dx190q ipv4-masq 192.168.1.0/24 - `), + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private child f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c partition-1 ipv4-masq 192.168.1.0/24 + `), WantWideTable: new(` - ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx - └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private network private child f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c 5711axzf0-4218-p7x9-3f8f-d34912dx190q ipv4-masq 192.168.1.0/24 a=b - `), + ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx + └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private network private child f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c partition-1 ipv4-masq 192.168.1.0/24 a=b + `), Template: new("{{ .id }} {{ .name }}"), WantTemplate: new(` 6988ebb0-9531-4f9b-a893-d7868258e2ef internet d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 private `), WantMarkdown: new(` - | ID | NAME | TYPE | PROJECT | PARTITION | NAT | PREFIXES | PREFIX USAGE | IP USAGE | - |-----------------------------------------|----------|----------|--------------------------------------|---------------------------------------|-----------|---------------------------|--------------|----------| - | 6988ebb0-9531-4f9b-a893-d7868258e2ef | internet | external | 0d81bca7-73f6-4da3-8397-4a8c52a0c583 | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | none | 10.0.0.0/16,2001:db8::/32 |   |   | - | └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 | private | child | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | ipv4-masq | 192.168.1.0/24 |   |   | - `), + | ID | NAME | TYPE | PROJECT | PARTITION | NAT | PREFIXES | PREFIX USAGE | IP USAGE | + |-----------------------------------------|----------|----------|--------------------------------------|-------------|-----------|---------------------------|--------------|----------| + | 6988ebb0-9531-4f9b-a893-d7868258e2ef | internet | external | 0d81bca7-73f6-4da3-8397-4a8c52a0c583 | partition-1 | none | 10.0.0.0/16,2001:db8::/32 |   |   | + | └─╴d83ffb0a-7aa6-4a66-8e03-0b5ee8b718a0 | private | child | f3b4e6a1-2c8d-4e5f-a7b9-1d3e5f7a9b0c | partition-1 | ipv4-masq | 192.168.1.0/24 |   |   | + `), }, } for _, tt := range tests { @@ -122,22 +122,22 @@ func Test_NetworkCmd_Describe(t *testing.T) { }), WantProtoObject: testresources.Network1(), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 - `), + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + `), WantWideTable: new(` - ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx - `), + ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx + `), Template: new("{{ .id }} {{ .name }}"), WantTemplate: new(` 6988ebb0-9531-4f9b-a893-d7868258e2ef internet `), WantMarkdown: new(` - | ID | NAME | TYPE | PROJECT | PARTITION | NAT | PREFIXES | PREFIX USAGE | IP USAGE | - |--------------------------------------|----------|----------|--------------------------------------|---------------------------------------|------|---------------------------|--------------|----------| - | 6988ebb0-9531-4f9b-a893-d7868258e2ef | internet | external | 0d81bca7-73f6-4da3-8397-4a8c52a0c583 | 5711axzf0-4218-p7x9-3f8f-d34912dx190q | none | 10.0.0.0/16,2001:db8::/32 |   |   | - `), + | ID | NAME | TYPE | PROJECT | PARTITION | NAT | PREFIXES | PREFIX USAGE | IP USAGE | + |--------------------------------------|----------|----------|--------------------------------------|-------------|------|---------------------------|--------------|----------| + | 6988ebb0-9531-4f9b-a893-d7868258e2ef | internet | external | 0d81bca7-73f6-4da3-8397-4a8c52a0c583 | partition-1 | none | 10.0.0.0/16,2001:db8::/32 |   |   | + `), }, } for _, tt := range tests { @@ -201,9 +201,9 @@ func Test_NetworkCmd_Create(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 - `), + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + `), }, } for _, tt := range tests { @@ -256,9 +256,9 @@ func Test_NetworkCmd_Delete(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 - `), + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + `), }, } for _, tt := range tests { @@ -293,13 +293,13 @@ func Test_NetworkCmd_Update(t *testing.T) { }), WantProtoObject: testresources.Network1(), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 - `), + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + `), WantWideTable: new(` - ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx - `), + ID DESCRIPTION NAME TYPE PROJECT PARTITION NAT PREFIXES ANNOTATIONS + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet network internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 cluster.metal-stack.io/id/namespace/service=/default/ingress-nginx + `), }, { Name: "update from file", @@ -336,9 +336,9 @@ func Test_NetworkCmd_Update(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 - `), + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + `), }, } for _, tt := range tests { @@ -376,9 +376,9 @@ func Test_NetworkCmd_Apply(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 - `), + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + `), }, { Name: "apply already exists", @@ -427,9 +427,9 @@ func Test_NetworkCmd_Apply(t *testing.T) { }, }), WantTable: new(` - ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE - 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 5711axzf0-4218-p7x9-3f8f-d34912dx190q none 10.0.0.0/16,2001:db8::/32 - `), + ID NAME TYPE PROJECT PARTITION NAT PREFIXES PREFIX USAGE IP USAGE + 6988ebb0-9531-4f9b-a893-d7868258e2ef internet external 0d81bca7-73f6-4da3-8397-4a8c52a0c583 partition-1 none 10.0.0.0/16,2001:db8::/32 + `), }, } for _, tt := range tests { diff --git a/tests/e2e/testresources/partitions.go b/tests/e2e/testresources/partitions.go index 70de1b9..10c3fcc 100644 --- a/tests/e2e/testresources/partitions.go +++ b/tests/e2e/testresources/partitions.go @@ -7,7 +7,7 @@ import ( var ( Partition1 = func() *apiv2.Partition { return &apiv2.Partition{ - Id: "5711axzf0-4218-p7x9-3f8f-d34912dx190q", + Id: "partition-1", Description: "partition 1", MgmtServiceAddresses: []string{ "192.168.1.1:1234", @@ -28,7 +28,7 @@ var ( } Partition2 = func() *apiv2.Partition { return &apiv2.Partition{ - Id: "d34912dx1-90qe-3jf8-1kd0-5711axzf08sj", + Id: "partition-2", Description: "partition 2", MgmtServiceAddresses: []string{ "192.168.1.2:1234",