From bb47f98bf0cc54bd1c9aef7b3508c28eddc6d96d Mon Sep 17 00:00:00 2001 From: Gavin Nishizawa Date: Fri, 3 Feb 2023 17:20:12 -0800 Subject: [PATCH] testing chaos with more readable/simpler ids and labels --- d2chaos/d2chaos.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/d2chaos/d2chaos.go b/d2chaos/d2chaos.go index c26ea3c80..efa4ecc9a 100644 --- a/d2chaos/d2chaos.go +++ b/d2chaos/d2chaos.go @@ -62,7 +62,7 @@ func (gs *dslGenState) gen(maxi int) error { } func (gs *dslGenState) genNode(containerID string) (string, error) { - nodeID := gs.randStr(32, true) + nodeID := gs.randStr(8, true) if containerID != "" { nodeID = containerID + "." + nodeID } @@ -95,7 +95,7 @@ func (gs *dslGenState) node() error { if gs.roll(25, 75) == 0 { // 25% chance of adding a label. - gs.g, err = d2oracle.Set(gs.g, nodeID, nil, go2.Pointer(gs.randStr(256, false))) + gs.g, err = d2oracle.Set(gs.g, nodeID, nil, go2.Pointer(gs.randStr(8, false))) if err != nil { return err } @@ -154,7 +154,7 @@ func (gs *dslGenState) edge() error { return err } if gs.randBool() { - gs.g, err = d2oracle.Set(gs.g, key, nil, go2.Pointer(gs.randStr(128, false))) + gs.g, err = d2oracle.Set(gs.g, key, nil, go2.Pointer(gs.randStr(8, false))) if err != nil { return err } @@ -191,11 +191,7 @@ func (gs *dslGenState) randBool() bool { // TODO go back to using xrand.String, currently some incompatibility with // stuffing these strings into a script for dagre func randRune() rune { - if mathrand.Int31n(100) == 0 { - // Generate newline 1% of the time. - return '\n' - } - return mathrand.Int31n(128) + 1 + return mathrand.Int31n(26) + 97 } func (gs *dslGenState) findOuterSequenceDiagram(nodeID string) string {