func TestWaitErr(t *testing.T) { mc := mock.NewClient() mc.Err = []error{errors.New("err")} if err, ok := <-Wait(mc, 0, "LM-X - Tier 1", 1024); err == nil || !ok { t.Errorf("expected err!=nil and ok=true, was err=%q, ok=%v", err, ok) } mc.Check(t) }
func fixture(t *testing.T) (*mock.Client, Tool, func()) { addr, teardown := fakerpc.Fixture(t) mc := mock.NewClient() tool, err := New(mc, addr, "pulse_test", "pulse_test") if err != nil { t.Skip("pulsekit/dev: skipping test: ", err) } return mc, tool, teardown }
func TestWaitOK(t *testing.T) { mc := mock.NewClient() mc.Err = []error{nil} mc.BR = []pulse.BuildResult{ {Complete: true}, {Complete: true}, } if _, ok := <-Wait(mc, 0, "LM-X - Tier 1", 1024); ok { t.Error("expected ok to be false") } mc.Check(t) }
func (f *fixture) MockClient() *mock.Client { mc := mock.NewClient() mc.BI, mc.L, mc.BR, mc.Err = f.BI, f.L, f.BR, f.Err return mc }
func fixture() (mc *mock.Client, mcli *MockCLI, f *Flags) { mc = mock.NewClient() mcli = NewMockCLI(mc) f = mcli.f return }