You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2019/04/12 18:46:59 UTC

[GitHub] [trafficcontrol] ocket8888 edited a comment on issue #3478: Mock Traffic Ops Server

ocket8888 edited a comment on issue #3478: Mock Traffic Ops Server
URL: https://github.com/apache/trafficcontrol/pull/3478#issuecomment-482681699
 
 
   > What if it was instead (with equally weak Go-fu reflection)
   > 
   > ```go
   >   for field: range fields {
   >     field.Name: CreateValue(field.Name, field.Type)
   >   }
   > ```
   
   Sure, the example `if` statement/block would be inside the `CreateValue` function in that case. Because you can't just give all numerics random values, or a specific, constant value. Because Ids won't line up, or types that aren't totally captured by their field types  can be wrong - e.g. QStringIgnore needs to be in the range [0,2], initialDispersion can't be 0 (or > 15?) etc.
   
   strings are just as bad, if not worse. Type names and tenant names would get mangled, xml_ids have extremely specific requirements that conflict with requirements for e.g. originFqdns.
   
   At some point, we have to nail down a common, static base which could theoretically be used to generate dynamic higher-level objects, but I'd advise against that. Especially since several fields of several objects have Unique constraints. Also, having a half-static, half-dynamic data set is exactly the problem the mock server is trying to solve. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services