Skip to content

Commit

Permalink
[fix]: update permission to keploy directory if it exists (#1585)
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedLotfy02 committed Feb 17, 2024
1 parent 7317a66 commit 4803d99
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions cmd/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,17 +397,17 @@ func (t *Test) GetCmd() *cobra.Command {

if generateTestReport {
testReportPath = path + "/testReports"

testReportPath, err = pkg.GetNextTestReportDir(testReportPath, models.TestRunTemplateName)
t.logger.Info("", zap.Any("keploy testReport path", testReportPath))
if err != nil {
t.logger.Error("failed to get the next test report directory", zap.Error(err))
return err
}
t.logger.Info("", zap.Any("keploy testReport path", testReportPath))
if err != nil {
t.logger.Error("failed to get the next test report directory", zap.Error(err))
return err
}
} else {
t.logger.Info("Test Reports are not being generated since generateTestReport flag is set false")
}

var hasContainerName bool
if isDockerCmd {
if strings.Contains(appCmd, "--name") {
Expand Down Expand Up @@ -449,11 +449,14 @@ func (t *Test) GetCmd() *cobra.Command {
PassthroughHosts: passThroughHosts,
}, enableTele)

cmd := exec.Command("sudo", "chmod", "-R", "777", path)
err = cmd.Run()
if err != nil {
t.logger.Error("failed to set the permission of keploy directory", zap.Error(err))
return err
fileExist := utils.CheckFileExists(path)
if fileExist {
cmd := exec.Command("sudo", "chmod", "-R", "777", path)
err = cmd.Run()
if err != nil {
t.logger.Error("failed to run command", zap.Error(err))
return err
}
}

}
Expand Down Expand Up @@ -511,4 +514,4 @@ func (t *Test) GetCmd() *cobra.Command {
testCmd.SilenceErrors = true

return testCmd
}
}

0 comments on commit 4803d99

Please sign in to comment.