(ctx context.Context, options ...interface{})
| 254 | var testExporter *telemetry.TestMetricsExporter |
| 255 | |
| 256 | func newController(ctx context.Context, options ...interface{}) (context.CancelFunc, *WorkflowController) { |
| 257 | // get all the objects and add to the fake |
| 258 | var objects, coreObjects []runtime.Object |
| 259 | for _, opt := range options { |
| 260 | switch v := opt.(type) { |
| 261 | case *apiv1.ServiceAccount: |
| 262 | coreObjects = append(coreObjects, v) |
| 263 | case runtime.Object: |
| 264 | objects = append(objects, v) |
| 265 | } |
| 266 | } |
| 267 | wfclientset := fakewfclientset.NewSimpleClientset(objects...) |
| 268 | dynamicClient := dynamicfake.NewSimpleDynamicClient(scheme.Scheme, objects...) |
| 269 | informerFactory := wfextv.NewSharedInformerFactory(wfclientset, 0) |
| 270 | ctx, cancel := context.WithCancel(ctx) |
| 271 | kube := fake.NewSimpleClientset(coreObjects...) |
| 272 | wfc := &WorkflowController{ |
| 273 | Config: config.Config{ |
| 274 | Images: map[string]config.Image{ |
| 275 | "my-image": { |
| 276 | Entrypoint: []string{"my-entrypoint"}, |
| 277 | Cmd: []string{"my-cmd"}, |
| 278 | }, |
| 279 | "argoproj/argosay:v2": {Cmd: []string{""}}, |
| 280 | "docker/whalesay:latest": {Cmd: []string{""}}, |
| 281 | "busybox": {Cmd: []string{""}}, |
| 282 | }, |
| 283 | }, |
| 284 | artifactRepositories: armocks.DummyArtifactRepositories(&wfv1.ArtifactRepository{ |
| 285 | S3: &wfv1.S3ArtifactRepository{ |
| 286 | S3Bucket: wfv1.S3Bucket{Endpoint: "my-endpoint", Bucket: "my-bucket"}, |
| 287 | }, |
| 288 | }), |
| 289 | cliExecutorLogFormat: "text", |
| 290 | kubeclientset: kube, |
| 291 | dynamicInterface: dynamicClient, |
| 292 | wfclientset: wfclientset, |
| 293 | workflowKeyLock: sync.NewKeyLock(), |
| 294 | wfArchive: sqldb.NullWorkflowArchive, |
| 295 | hydrator: hydratorfake.Noop, |
| 296 | estimatorFactory: estimation.DummyEstimatorFactory, |
| 297 | eventRecorderManager: &testEventRecorderManager{eventRecorder: record.NewFakeRecorder(64)}, |
| 298 | archiveLabelSelector: labels.Everything(), |
| 299 | cacheFactory: controllercache.NewCacheFactory(kube, "default"), |
| 300 | progressPatchTickDuration: envutil.LookupEnvDurationOr(ctx, common.EnvVarProgressPatchTickDuration, 1*time.Minute), |
| 301 | progressFileTickDuration: envutil.LookupEnvDurationOr(ctx, common.EnvVarProgressFileTickDuration, 3*time.Second), |
| 302 | maxStackDepth: maxAllowedStackDepth, |
| 303 | } |
| 304 | |
| 305 | for _, opt := range options { |
| 306 | switch v := opt.(type) { |
| 307 | // any post-processing |
| 308 | case func(workflowController *WorkflowController): |
| 309 | v(wfc) |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | // always compare to NewWorkflowController to see what this block of code should be doing |
no test coverage detected