Пример #1
0
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
}
Пример #2
0
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)
	}
}
Пример #3
0
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)
	}
}
Пример #4
0
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)
	}
}
Пример #5
0
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)
	}
}
Пример #6
0
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)
}
Пример #7
0
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)
}
Пример #8
0
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)
}