Skip to content

Commit

Permalink
Enable container tool bin for test runner (#287)
Browse files Browse the repository at this point in the history
enable container tool bin for test runner

Signed-off-by: Emily McMullan <[email protected]>
  • Loading branch information
eemcmullan authored Jul 22, 2024
1 parent 9e99c4b commit 7dc905f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 5 additions & 4 deletions cmd/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ func NewTestCommand(log logr.Logger) *cobra.Command {
return nil
}
results, err := testing.NewRunner().Run(tests, testing.TestOptions{
RunLocal: Settings.RunLocal,
ContainerImage: Settings.RunnerImage,
ProgressPrinter: testing.PrintProgress,
Log: log.V(3),
RunLocal: Settings.RunLocal,
ContainerImage: Settings.RunnerImage,
ContainerToolBin: Settings.PodmanBinary,
ProgressPrinter: testing.PrintProgress,
Log: log.V(3),
})
testing.PrintSummary(os.Stdout, results)
if err != nil {
Expand Down
6 changes: 4 additions & 2 deletions pkg/testing/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type TestOptions struct {
BaseProviderConfig []provider.Config
RunLocal bool
ContainerImage string
ContainerToolBin string
ProgressPrinter ResultPrinter
Log logr.Logger
}
Expand Down Expand Up @@ -204,7 +205,7 @@ func (r defaultRunner) Run(testFiles []TestsFile, opts TestOptions) ([]Result, e
}
default:
if reproducerCmd, err = runInContainer(
logger, opts.ContainerImage, logFile, volumes, analysisParams); err != nil {
logger, opts.ContainerImage, opts.ContainerToolBin, logFile, volumes, analysisParams); err != nil {
results = append(results, Result{
TestsFilePath: testsFile.Path,
Error: err})
Expand Down Expand Up @@ -315,7 +316,7 @@ func runLocal(logFile io.Writer, dir string, analysisParams AnalysisParams) (str
return fmt.Sprintf("konveyor-analyzer %s", strings.Join(args, " ")), cmd.Run()
}

func runInContainer(consoleLogger logr.Logger, image string, logFile io.Writer, volumes map[string]string, analysisParams AnalysisParams) (string, error) {
func runInContainer(consoleLogger logr.Logger, image string, containerBin string, logFile io.Writer, volumes map[string]string, analysisParams AnalysisParams) (string, error) {
if image == "" {
image = "quay.io/konveyor/analyzer-lsp:latest"
}
Expand All @@ -342,6 +343,7 @@ func runInContainer(consoleLogger logr.Logger, image string, logFile io.Writer,
container.WithImage(image),
container.WithLog(consoleLogger),
container.WithEntrypointBin("konveyor-analyzer"),
container.WithContainerToolBin(containerBin),
container.WithEntrypointArgs(args...),
container.WithVolumes(volumes),
container.WithWorkDir("/shared/"),
Expand Down

0 comments on commit 7dc905f

Please sign in to comment.