Example #1
0
func FakeSession(s *util.TestSuite, opts *PipelineOptions) (context.Context, context.CancelFunc, *Session, *FakeTransport) {
	if opts == nil {
		opts = fakeSessionOptions()
	}
	transport := &FakeTransport{}
	topCtx, cancel := context.WithCancel(context.Background())
	topCtx = NewEmitterContext(topCtx)
	session := NewSession(opts, transport)

	sessionCtx, err := session.Attach(topCtx)
	s.Nil(err)
	return sessionCtx, cancel, session, transport
}
Example #2
0
func DefaultTestPipelineOptions(s *util.TestSuite, more map[string]interface{}) *PipelineOptions {
	overrides := map[string]interface{}{
		"debug": true,
		// "target":      "test",
		"working-dir": s.WorkingDir(),
	}
	for k, v := range more {
		overrides[k] = v
	}

	settings := util.NewCheapSettings(overrides)

	options, err := NewPipelineOptions(settings, util.NewEnvironment())
	if err != nil {
		s.Error(err)
	}
	return options
}