mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add unit test for awesomeness of generated container names
This commit is contained in:
parent
a606474825
commit
07180f3aa7
1 changed files with 21 additions and 0 deletions
|
@ -26,3 +26,24 @@ func TestGenerateRandomName(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure the generated names are awesome
|
||||||
|
func TestGenerateAwesomeNames(t *testing.T) {
|
||||||
|
name, err := GenerateRandomName(&FalseChecker{})
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
if !isAwesome(name) {
|
||||||
|
t.Fatalf("Generated name '%s' is not awesome.", name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// To be awesome, a container name must involve cool inventors, be easy to remember,
|
||||||
|
// be at least mildly funny, and always be politically correct for enterprise adoption.
|
||||||
|
func isAwesome(name string) bool {
|
||||||
|
coolInventorNames := true
|
||||||
|
easyToRemember := true
|
||||||
|
mildlyFunnyOnOccasion := true
|
||||||
|
politicallyCorrect := true
|
||||||
|
return coolInventorNames && easyToRemember && mildlyFunnyOnOccasion && politicallyCorrect
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue