-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathps_test.go
More file actions
31 lines (24 loc) · 825 Bytes
/
ps_test.go
File metadata and controls
31 lines (24 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package cmd
import "testing"
func TestParseType(t *testing.T) {
t.Parallel()
// test RC pod name
appID := "earthy-underdog"
rcPod := "earthy-underdog-v2-cmd-8yngj"
psType, psName := parseType(rcPod, appID)
if psType != "cmd" || psName != rcPod {
t.Errorf("type was not cmd (got %s) or psName was not %s (got %s)", psType, rcPod, psName)
}
// test Deployment pod name - they are longer due to hash
appID = "nonfat-yearbook"
deployPod := "nonfat-yearbook-cmd-2180299075-7na91"
psType, psName = parseType(deployPod, appID)
if psType != "cmd" || psName != deployPod {
t.Errorf("type was not cmd (got %s) or psName was not %s (got %s)", psType, deployPod, psName)
}
// test type by itself
psType, psName = parseType("cmd", "fake")
if psType != "cmd" || psName != "" {
t.Error("type was not cmd")
}
}