codeamp / circuit

CodeAmp API. Built with Golang, GraphQL, GORM and Socket-IO
Apache License 2.0
21 stars 6 forks source link

Ignore ports variable if length is 0 #433

Closed drshrey closed 5 years ago

drshrey commented 5 years ago

Only go through the ports-creation logic in the service mutation if the length of the ports input is greater than 0. Currently, we pass in a ports variable from the client-side regardless of the service type. However, the one-shot service type passes in a 0 length, non-nil ports parameter which means we cannot create one-shot services from the panel client inputs right now.

This fixes it by allowing to hit ports creation logic only if it is not nil and the ports length is greater than 0.

codecov[bot] commented 5 years ago

Codecov Report

Merging #433 into master will increase coverage by 0.03%. The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #433      +/-   ##
==========================================
+ Coverage   61.31%   61.34%   +0.03%     
==========================================
  Files          51       51              
  Lines        5260     5260              
==========================================
+ Hits         3225     3227       +2     
+ Misses       1717     1715       -2     
  Partials      318      318