Skip to content

Commit

Permalink
fix download junit test report when s3 has subfolder
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Zhao <[email protected]>
  • Loading branch information
PetrusZ committed Feb 14, 2025
1 parent 4815acc commit 596a388
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions pkg/microservice/aslan/core/common/service/it_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
"strings"

Expand Down Expand Up @@ -201,6 +202,10 @@ func GetWorkflowV4LocalTestSuite(workflowName, jobName string, taskID int64, log
if err != nil {
log.Errorf("GetLocalTestSuite GenerateTmpFile err:%v", err)
}

if len(stepSpec.S3Storage.Subfolder) > 0 {
stepSpec.S3DestDir = strings.TrimLeft(path.Join(stepSpec.S3Storage.Subfolder, stepSpec.S3DestDir), "/")
}
objectKey := filepath.Join(stepSpec.S3DestDir, stepSpec.FileName)
client, err := s3tool.NewClient(s3Storage.Endpoint, s3Storage.Ak, s3Storage.Sk, s3Storage.Region, s3Storage.Insecure, s3Storage.Provider)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (s *JunitReportStep) Run(ctx context.Context) error {
return err
}
}
log.Infof("Finish archive %s.", s.spec.FileName)
log.Infof("Finish archive %s to %s.", s.spec.FileName)
if results.Failures > 0 || results.Errors > 0 {
return fmt.Errorf("%d case(s) failed, %d case(s) error", results.Failures, results.Errors)
}
Expand Down

0 comments on commit 596a388

Please sign in to comment.