MCPcopy
hub / github.com/argoproj/argo-workflows / TestStoppedWorkflow

Method TestStoppedWorkflow

test/e2e/artifacts_test.go:265–354  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

263}
264
265func (s *ArtifactsSuite) TestStoppedWorkflow() {
266 s.T().Skip("This test is flaky and will be skipped as a result")
267
268 for _, tt := range []struct {
269 workflowFile string
270 }{
271 {workflowFile: "@testdata/artifactgc/artgc-dag-wf-stopped.yaml"},
272 {workflowFile: "@testdata/artifactgc/artgc-dag-wf-stopped-pod-gc-on-pod-completion.yaml"},
273 } {
274 // Create the minio client for interacting with the bucket.
275 c, err := minio.New("localhost:9000", &minio.Options{
276 Creds: credentials.NewStaticV4("admin", "password", ""),
277 })
278 s.Require().NoError(err)
279
280 // Ensure the artifacts aren't in the bucket.
281 ctx := logging.TestContext(s.T().Context())
282 _, err = c.StatObject(ctx, "my-bucket-3", "on-deletion-wf-stopped-1", minio.StatObjectOptions{})
283 if err == nil {
284 err = c.RemoveObject(ctx, "my-bucket-3", "on-deletion-wf-stopped-1", minio.RemoveObjectOptions{})
285 s.Require().NoError(err)
286 }
287 _, err = c.StatObject(ctx, "my-bucket-3", "on-deletion-wf-stopped-2", minio.StatObjectOptions{})
288 if err == nil {
289 err = c.RemoveObject(ctx, "my-bucket-3", "on-deletion-wf-stopped-2", minio.RemoveObjectOptions{})
290 s.Require().NoError(err)
291 }
292
293 then := s.Given().
294 Workflow(tt.workflowFile).
295 When().
296 Then()
297
298 // Assert the artifacts don't exist.
299 then.ExpectArtifactByKey("on-deletion-wf-stopped-1", "my-bucket-3", func(t *testing.T, object minio.ObjectInfo, err error) {
300 require.Error(t, err)
301 })
302 then.ExpectArtifactByKey("on-deletion-wf-stopped-2", "my-bucket-3", func(t *testing.T, object minio.ObjectInfo, err error) {
303 require.Error(t, err)
304 })
305
306 when := then.When().
307 SubmitWorkflow().
308 WaitForWorkflow(
309 fixtures.WorkflowCompletionOkay(true),
310 fixtures.Condition(func(wf *wfv1.Workflow) (bool, string) {
311
312 condition := "for artifacts to exist"
313
314 _, err1 := c.StatObject(ctx, "my-bucket-3", "on-deletion-wf-stopped-1", minio.StatObjectOptions{})
315 _, err2 := c.StatObject(ctx, "my-bucket-3", "on-deletion-wf-stopped-2", minio.StatObjectOptions{})
316
317 if err1 == nil && err2 == nil {
318 return true, condition
319 }
320 return false, condition
321 }))
322

Callers

nothing calls this directly

Calls 15

TestContextFunction · 0.92
WorkflowCompletionOkayTypeAlias · 0.92
ConditionFuncType · 0.92
ThenMethod · 0.80
WorkflowMethod · 0.80
ExpectArtifactByKeyMethod · 0.80
WaitForWorkflowMethod · 0.80
RemoveFinalizersMethod · 0.80
ContextMethod · 0.65
ErrorMethod · 0.65
SubmitWorkflowMethod · 0.65

Tested by

no test coverage detected