mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 02:00:43 +00:00
During rendering, RenderableNodes are created by Map funcs, which take only NodeMetadata. Previously, it was simply assumed that the relevant keys for a given Map func would be present in the metadata. If that implicit invariant failed, the returned RenderableNode would be invalid, with e.g. an ID of "hostid::". That, in turn, would trigger undefined behavior later on in the rendering workflow. This bug was detected by creating a partial node metadata for a non-local endpoint node. That node was detected during the first phase of rendering, and given an invalid renderable node ID of "myhostname::", which prevented it from attaching to TheInternet pseudonode. It eventually got removed from the set of valid nodes, which meant nodes that were adjacent to it suddenly became orphans, and got filtered out by the FilterUnconnected step of the rendering pipeline. With this change, every map func checks for the presence of mandatory fields, i.e. the fields that compose the resulting renderable node's ID. Also, - Add unit tests for LeafMapFuncs - Topology Validate checks NodeMetadatas must not have nil Metadata