-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add events for major lifecycle events
{Add,Remove}Nodes from InstanceGroup SyncIngress, TranslateIngress, IPChanged, GarbageCollection
- Loading branch information
Showing
13 changed files
with
173 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package events | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
) | ||
|
||
func TestTruncatedStringList(t *testing.T) { | ||
var saved int | ||
truncatedStringListMax, saved = 30, truncatedStringListMax | ||
defer func() { truncatedStringListMax = saved }() | ||
|
||
for _, tc := range []struct { | ||
desc string | ||
count int | ||
want string | ||
}{ | ||
{"zero", 0, "[]"}, | ||
{"one", 1, "[elt-0]"}, | ||
{"not truncated", 4, "[elt-0, elt-1, elt-2, elt-3]"}, | ||
{"truncated", 20, "[elt-0, elt-1, elt-2, elt-3, ...]"}, | ||
} { | ||
t.Run(tc.desc, func(t *testing.T) { | ||
var l []string | ||
for i := 0; i < tc.count; i++ { | ||
l = append(l, fmt.Sprintf("elt-%d", i)) | ||
} | ||
got := TruncatedStringList(l) | ||
if got != tc.want { | ||
t.Errorf("TruncatedString(%v) = %q; want %q", l, got, tc.want) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.