func GetStart() ([]RunOutput, error) { out := make([]RunOutput, 0) pods := []string{} etc, err := config.Etc() if err != nil { return out, err } for _, dir := range etc.Run { p, _ := convention.Pods(dir) pods = append(pods, p...) } for _, p := range pods { o, _ := RunPods(p) out = append(out, o) // out = append(out, RunOutput{ // ContainerId: "x", // }) // ps := GetStatus() // fmt.Println(ps) } return out, nil }
func TestPodsDir3(t *testing.T) { pods := root + "/empty" _, err := convention.Pods(pods) if err == nil || err != convention.ErrNoPods { t.Fatalf("%s should throw error", pods) } }
func TestPodsDir2(t *testing.T) { pods := root + "/opt" p, err := convention.Pods(pods) if err == nil && len(p) != 2 { t.Fatalf("%s should return []string{2}", pods) } }
func TestPodsNotExist(t *testing.T) { pods := root + "/null.yaml" _, err := convention.Pods(pods) if err == nil || err != convention.ErrNoPods { t.Fatalf("%s should throw error", pods) } }
func TestPodsDir1(t *testing.T) { pods := root p, err := convention.Pods(pods) t.Log(p) if err == nil && len(p) != 1 { t.Fatalf("%s should return []string{1}", pods) } }
func TestPods(t *testing.T) { yaml, _ := convention.Pods(root) data, err := config.Pods(yaml[0]) if err != nil { t.Fatalf("Err: #v", err) } t.Logf("%#v", data) }
func TestRunPods(t *testing.T) { yaml, _ := convention.Pods("/data") t.Logf("%#v", yaml) data, err := pods.RunPods(yaml[0]) if err != nil { t.Fatalf("Err: #v", err) } t.Logf("%v", data) }
func TestMakeCmd(t *testing.T) { yaml, _ := convention.Pods(root) t.Logf("%#v", yaml) p, _ := config.Pods(yaml[0]) data, err := pods.MakeCmd(p) if err != nil { t.Fatalf("Err: #v", err) } t.Logf("%v", data) }