Skip to content

Commit

Permalink
Fix path to "search_md" zip in workflow tests
Browse files Browse the repository at this point in the history
  • Loading branch information
djjuhasz committed Nov 15, 2024
1 parent bbb8532 commit 18c6352
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions internal/ais/workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,29 @@ func (s *TestSuite) TestWorkflowSuccess() {
err := s.env.GetWorkflowResult(&result)
s.NoError(err)

s.Equal(result, ais.WorkflowResult{Key: "test-" + aipUUID + ".zip"})
s.Equal(result, ais.WorkflowResult{Key: "search-md_test-" + aipUUID + ".zip"})
}

func (s *TestSuite) mockActivitiesSuccess(aipUUID string) {
aipName := "test-" + aipUUID
aipPath := "9390/594f/84c2/457d/bd6a/618f/21f7/c954/test-9390594f-84c2-457d-bd6a-618f21f7c954.zip"
localDir := filepath.Join(s.testDir, fmt.Sprintf("search-md_%s", aipName))
metsName := fmt.Sprintf("METS.%s.xml", aipUUID)
metsPath := filepath.Join(localDir, metsName)
searchMDName := fmt.Sprintf("search-md_%s", aipName)
localDir := filepath.Join(s.testDir, searchMDName)

// Mock activities.
s.env.OnActivity(
ais.GetAIPPathActivity,
mock.AnythingOfType("*context.valueCtx"),
&ais.GetAIPPathActivityParams{AIPUUID: aipUUID},
).Return(
&ais.GetAIPPathActivityResult{Path: aipPath}, nil,
&ais.GetAIPPathActivityResult{
Path: "9390/594f/84c2/457d/bd6a/618f/21f7/c954/test-9390594f-84c2-457d-bd6a-618f21f7c954.zip",
}, nil,
)

// Mock session activities.
sessionCtx := mock.AnythingOfType("*context.timerCtx")
metsName := fmt.Sprintf("METS.%s.xml", aipUUID)
metsPath := filepath.Join(localDir, metsName)
s.env.OnActivity(
ais.FetchActivityName,
sessionCtx,
Expand All @@ -119,13 +121,13 @@ func (s *TestSuite) mockActivitiesSuccess(aipUUID string) {
&ais.FetchActivityResult{}, nil,
)

mdpath := "objects/header/metadata.xml"
mdRelPath := "objects/header/metadata.xml"
s.env.OnActivity(
ais.ParseActivityName,
sessionCtx,
&ais.ParseActivityParams{METSPath: metsPath},
).Return(
&ais.ParseActivityResult{MetadataRelPath: mdpath}, nil,
&ais.ParseActivityResult{MetadataRelPath: mdRelPath}, nil,
)

areldaPath := filepath.Join(localDir, "metadata.xml")
Expand All @@ -134,7 +136,7 @@ func (s *TestSuite) mockActivitiesSuccess(aipUUID string) {
sessionCtx,
&ais.FetchActivityParams{
AIPUUID: aipUUID,
RelativePath: fmt.Sprintf("%s/data/%s", aipName, mdpath),
RelativePath: fmt.Sprintf("%s/data/%s", aipName, mdRelPath),
Destination: areldaPath,
},
).Return(
Expand All @@ -153,7 +155,7 @@ func (s *TestSuite) mockActivitiesSuccess(aipUUID string) {
&ais.CombineMDActivityResult{Path: filepath.Join(localDir, "AIS_1000_893_3251903")}, nil,
)

zipPath := filepath.Join(s.testDir, aipName+".zip")
zipPath := localDir + ".zip"
s.env.OnActivity(
archivezip.Name,
sessionCtx,
Expand All @@ -167,6 +169,6 @@ func (s *TestSuite) mockActivitiesSuccess(aipUUID string) {
sessionCtx,
&bucketupload.Params{Path: zipPath},
).Return(
&bucketupload.Result{Key: aipName + ".zip"}, nil,
&bucketupload.Result{Key: searchMDName + ".zip"}, nil,
)
}

0 comments on commit 18c6352

Please sign in to comment.