Fix detecting a platform on Azure

This commit is contained in:
Kota Kanbe
2016-09-07 13:51:59 +09:00
parent d75990d9fd
commit 38857c3356
2 changed files with 33 additions and 3 deletions

View File

@@ -56,3 +56,24 @@ f570ae647edc agitated_lovelace`,
}
}
}
func TestIsAwsInstanceID(t *testing.T) {
var tests = []struct {
in string
expected bool
}{
{"i-1234567a", true},
{"i-1234567890abcdef0", true},
{"i-1234567890abcdef0000000", true},
{"e-1234567890abcdef0", false},
{"i-1234567890abcdef0 foo bar", false},
{"no data", false},
}
for _, tt := range tests {
actual := isAwsInstanceID(tt.in)
if tt.expected != actual {
t.Errorf("expected %t, actual %t, str: %s", tt.expected, actual, tt.in)
}
}
}