Skip to content

Commit

Permalink
fix(executor): Fix the artifacts option in k8sapi and PNS executor Fi…
Browse files Browse the repository at this point in the history
…xes#4244 (argoproj#4279)
  • Loading branch information
sarabala1979 committed Oct 20, 2020
1 parent ea9db43 commit e14f4f9
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions workflow/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@ func (we *WorkflowExecutor) stageArchiveFile(mainCtrID string, art *wfv1.Artifac
if strategy.None != nil {
fileName := filepath.Base(art.Path)
log.Infof("No compression strategy needed. Staging skipped")
if !argofile.Exists(mountedArtPath) {
return "", "", errors.Errorf(errors.CodeNotFound, "%s no such file or directory", art.Path)
}
return fileName, mountedArtPath, nil
}
fileName := fmt.Sprintf("%s.tgz", art.Name)
Expand Down
39 changes: 39 additions & 0 deletions workflow/executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,42 @@ func TestChmod(t *testing.T) {
}

}

func TestSaveArtifacts(t *testing.T) {
fakeClientset := fake.NewSimpleClientset()
mockRuntimeExecutor := mocks.ContainerRuntimeExecutor{}
templateWithOutParam := wfv1.Template{
Inputs: wfv1.Inputs{
Artifacts: []wfv1.Artifact{
{
Name: "samedir",
Path: "/samedir",
},
},
},
Outputs: wfv1.Outputs{
Artifacts: []wfv1.Artifact{
{
Name: "samedir",
Path: "/samedir",
Optional: true,
},
},
},
}
we := WorkflowExecutor{
PodName: fakePodName,
Template: templateWithOutParam,
ClientSet: fakeClientset,
Namespace: fakeNamespace,
PodAnnotationsPath: fakeAnnotations,
ExecutionControl: nil,
RuntimeExecutor: &mockRuntimeExecutor,
mainContainerID: fakeContainerID,
}
err := we.SaveArtifacts()
assert.NoError(t, err)
we.Template.Outputs.Artifacts[0].Optional = false
err = we.SaveArtifacts()
assert.Error(t, err)
}

0 comments on commit e14f4f9

Please sign in to comment.