Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VX-175 valitate network entity before insert #96

Merged
merged 1 commit into from
Jul 13, 2018

Conversation

John-Lin
Copy link
Contributor

No description provided.

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"`
Copy link
Contributor

Choose a reason for hiding this comment

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

我覺得 VlanTag 好像不是一定要?
有些應用他就沒有要vlan

Copy link
Contributor Author

Choose a reason for hiding this comment

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

這邊應該是讓 entity 的欄位更加清楚,要給 VLANTags: [] 才算一個成功的 POST

Copy link
Contributor Author

@John-Lin John-Lin Jul 13, 2018

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的內容來決定

@@ -55,10 +55,12 @@ func (suite *NetworkTestSuite) TestCreateNetwork() {
network := entity.Network{
Type: entity.FakeNetworkType,
Name: tName,
IsDPDKPort: true, // for fake network, true means success
Copy link
Contributor

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

codecov-io commented Jul 13, 2018

Codecov Report

Merging #96 into develop will decrease coverage by 0.08%.
The diff coverage is 40%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ
src/server/handler_network.go 81.41% <40%> (-0.49%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ee8e63...25f63c0. Read the comment docs.

@John-Lin John-Lin force-pushed the johnlin/validate-network-entity branch from e8cb6b3 to 25f63c0 Compare July 13, 2018 16:08
Copy link
Contributor

@hwchiu hwchiu left a comment

Choose a reason for hiding this comment

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

LGTM

@hwchiu hwchiu merged commit 0c1bff6 into develop Jul 13, 2018
@hwchiu hwchiu deleted the johnlin/validate-network-entity branch July 13, 2018 17:11
John-Lin pushed a commit that referenced this pull request Jul 25, 2018
…ntity

VX-175 valitate network entity before insert

Former-commit-id: 0f7c4895d403935030df2d0331d9f643a24de3ae [formerly 0c1bff6]
Former-commit-id: b971f0ebc5b0b4982ef73b969b7de4e9ade0352d
John-Lin pushed a commit that referenced this pull request Jul 25, 2018
…ntity

VX-175 valitate network entity before insert

Former-commit-id: 0f7c4895d403935030df2d0331d9f643a24de3ae [formerly 0f7c4895d403935030df2d0331d9f643a24de3ae [formerly 0c1bff6]]
Former-commit-id: b971f0ebc5b0b4982ef73b969b7de4e9ade0352d
Former-commit-id: 34c90ee
John-Lin pushed a commit that referenced this pull request Jul 25, 2018
…ntity

VX-175 valitate network entity before insert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants