Skip to content

Commit

Permalink
(DEL-2899) Make Port Name Optional (#287)
Browse files Browse the repository at this point in the history
* make port name optional

Signed-off-by: Stephen Hwang <[email protected]>

* fix unit tests

Signed-off-by: Stephen Hwang <[email protected]>

---------

Signed-off-by: Stephen Hwang <[email protected]>
  • Loading branch information
sthwang-metal authored Dec 6, 2023
1 parent 40a661c commit d85a9ac
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 49 deletions.
2 changes: 0 additions & 2 deletions internal/ent/generated/port/port.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions internal/ent/generated/port_create.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions internal/ent/generated/port_update.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions internal/ent/generated/runtime.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion internal/ent/schema/port.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func (Port) Fields() []ent.Field {
entgql.OrderField("number"),
),
field.String("name").
NotEmpty().
Annotations(
entgql.OrderField("name"),
),
Expand Down
10 changes: 4 additions & 6 deletions internal/graphapi/loadbalancer.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions internal/graphapi/origin.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions internal/graphapi/pool.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions internal/graphapi/port.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions internal/graphapi/port_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,16 @@ func TestCreate_LoadbalancerPort(t *testing.T) {
},
},
{
TestName: "fails to create loadbalancer port with empty name",
TestName: "succeeds in creating loadbalancer port with empty name",
Input: graphclient.CreateLoadBalancerPortInput{
Name: "",
LoadBalancerID: lb.ID,
Number: 22,
Number: 23,
},
Expected: &graphclient.LoadBalancerPort{
Name: "",
Number: 23,
},
errorMsg: "value is less than the required length",
},
{
TestName: "fails to create loadbalancer port with empty loadbalancer id",
Expand Down Expand Up @@ -220,12 +223,15 @@ func TestUpdate_LoadbalancerPort(t *testing.T) {
},
},
{
TestName: "fails to update loadbalancer port name to empty",
TestName: "succeeds in updating loadbalancer port name to empty",
ID: port.ID,
Input: graphclient.UpdateLoadBalancerPortInput{
Name: newString(""),
},
errorMsg: "value is less than the required length",
Expected: &graphclient.LoadBalancerPort{
Name: "",
Number: 22,
},
},
{
TestName: "fails to update loadbalancer port number < min",
Expand Down

0 comments on commit d85a9ac

Please sign in to comment.