()
| 263 | } |
| 264 | |
| 265 | func (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 |
nothing calls this directly
no test coverage detected