-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VX-175 valitate network entity before insert #96
Conversation
src/entity/network.go
Outdated
Type NetworkType `bson:"type" json:"type" validate:"required"` | ||
IsDPDKPort bool `bson:"isDPDKPort" json:"isDPDKPort" validate:"required"` | ||
Name string `bson:"name" json:"name" validate:"required"` | ||
VLANTags []int32 `bson:"VLANTags" json:"VLANTags" validate:"required,dive,max=4095,min=0"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我覺得 VlanTag 好像不是一定要?
有些應用他就沒有要vlan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
這邊應該是讓 entity 的欄位更加清楚,要給 VLANTags: []
才算一個成功的 POST
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
就是 VLANTags: []
是表示沒有tags ,而缺少VLANTags
欄位則是非法的entity。所以沒有給 VLANTags
欄位的話就會被 server 回400 ,所以required的意思是這個欄位不能缺,但是有沒有vlan tag就是由slice的內容來決定
src/server/handler_network_test.go
Outdated
@@ -55,10 +55,12 @@ func (suite *NetworkTestSuite) TestCreateNetwork() { | |||
network := entity.Network{ | |||
Type: entity.FakeNetworkType, | |||
Name: tName, | |||
IsDPDKPort: true, // for fake network, true means success |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please change the way how fake network works.
Codecov Report
@@ Coverage Diff @@
## develop #96 +/- ##
===========================================
- Coverage 56.13% 56.05% -0.09%
===========================================
Files 35 35
Lines 1564 1561 -3
===========================================
- Hits 878 875 -3
+ Misses 630 629 -1
- Partials 56 57 +1
Continue to review full report at Codecov.
|
e8cb6b3
to
25f63c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…ntity VX-175 valitate network entity before insert Former-commit-id: 0f7c4895d403935030df2d0331d9f643a24de3ae [formerly 0c1bff6] Former-commit-id: b971f0ebc5b0b4982ef73b969b7de4e9ade0352d
…ntity VX-175 valitate network entity before insert
No description provided.