func ListAllTheThings() { //do.All for known/existing/running do.All = true typs := []string{"chains", "services"} for _, typ := range typs { if err := list.ListAll(do, typ); err != nil { return } } if err := list.ListDatas(do); err != nil { return } if err := list.ListActions(do); err != nil { return } }
func TestListDataContainers(t *testing.T) { dataName1 := fmt.Sprintf("%s%s", dataName, "one") dataName2 := fmt.Sprintf("%s%s", dataName, "two") datas := make(map[string]bool) datas[dataName] = true datas[dataName1] = true datas[dataName2] = true testCreateDataByImport(t, dataName) testCreateDataByImport(t, dataName1) testCreateDataByImport(t, dataName2) defer testKillDataCont(t, dataName) defer testKillDataCont(t, dataName1) defer testKillDataCont(t, dataName2) do := definitions.NowDo() do.Quiet = true if err := list.ListDatas(do); err != nil { log.Error(err) t.FailNow() } output := strings.Split(do.Result, "\n") i := 0 for _, out := range output { if datas[util.TrimString(out)] == true { i++ } } if i != 3 { log.Error(fmt.Errorf("Expected 3 data containers, got (%v)\n", i)) t.Fail() } }
//---------------------------------------------------- func ListKnownData(cmd *cobra.Command, args []string) { if err := list.ListDatas(do); err != nil { return } }