Skip to content

Commit d2337c3

Browse files
committed
add e2e test for soft_delete flag
Signed-off-by: Phil Brookes <[email protected]>
1 parent 560ab17 commit d2337c3

File tree

9 files changed

+247
-269
lines changed

9 files changed

+247
-269
lines changed

examples/kuadrant/soft_delete/eu-cluster1.yaml

-50
This file was deleted.

examples/kuadrant/soft_delete/eu-cluster2.yaml

-50
This file was deleted.

examples/kuadrant/soft_delete/us-cluster1.yaml

-39
This file was deleted.

internal/common/tree.go

+11-9
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ func (d DNSTreeNodeData) String() string {
3636
return fmt.Sprintf("targets: %+v, labels: %+v", d.Targets, d.Labels)
3737
}
3838

39+
func WriteTree(s io.Writer, node *DNSTreeNode, title string) {
40+
fmt.Fprintf(s, "\n====== START TREE: %s ======\n", title)
41+
for _, ep := range *ToEndpoints(node, &[]*endpoint.Endpoint{}) {
42+
fmt.Fprintf(s, " endpoint: %v > %+v with labels: %+v\n", ep.DNSName, ep.Targets, ep.Labels)
43+
}
44+
fmt.Fprintf(s, "====== END TREE: %s ======\n\n", title)
45+
}
46+
3947
// PropagateStoppableLabel takes a propLabel (and value) to propagate throughout a tree, and a stopLabel
4048
// whenever the label is propagated to a dataset in a node which also has the stopLabel, this node and
4149
// all of the children of this node and any parents will have the propLabel removed.
@@ -52,15 +60,6 @@ func (d DNSTreeNodeData) String() string {
5260
// - Any node with the stopLabel and the propLabel:
5361
// - Has the propLabel removed from itself and all it's children
5462
// - Has the propLabel removed from any parent (or parent's parent) that has the label
55-
56-
func WriteTree(s io.Writer, node *DNSTreeNode, title string) {
57-
fmt.Fprintf(s, "\n====== START TREE: %s ======\n", title)
58-
for _, ep := range *ToEndpoints(node, &[]*endpoint.Endpoint{}) {
59-
fmt.Fprintf(s, " endpoint: %v > %+v with labels: %+v\n", ep.DNSName, ep.Targets, ep.Labels)
60-
}
61-
fmt.Fprintf(s, "====== END TREE: %s ======\n\n", title)
62-
}
63-
6463
func PropagateStoppableLabel(node *DNSTreeNode, propLabel, value, stopLabel string) {
6564
//propagate labels regardless of stop labels
6665
PropagateLabel(node, propLabel, value)
@@ -386,6 +385,9 @@ func ToEndpoints(node *DNSTreeNode, endpoints *[]*endpoint.Endpoint) *[]*endpoin
386385
}
387386

388387
for _, data := range node.DataSets {
388+
if len(data.Labels) == 0 {
389+
data.Labels = nil
390+
}
389391
*endpoints = append(*endpoints, &endpoint.Endpoint{
390392
DNSName: node.Name,
391393
Targets: data.Targets,

0 commit comments

Comments
 (0)