pbacsko commented on code in PR #758:
URL: https://github.com/apache/yunikorn-k8shim/pull/758#discussion_r1446692939


##########
test/e2e/framework/helpers/common/utils.go:
##########
@@ -254,3 +240,53 @@ func RunShellCmdForeground(cmdStr string) (string, error) {
 
        return stdOutStream.String(), nil
 }
+
+func CreateLogFile(suiteName string, specName string, logType string, 
extention string) (*os.File, error) {
+       filePath, err := getLogFilePath(suiteName, specName, logType, extention)
+       if err != nil {
+               return nil, err
+       }
+
+       dir := filepath.Dir(filePath)
+       if _, err = os.Stat(dir); os.IsNotExist(err) {
+               err = os.MkdirAll(dir, 0755)
+               if err != nil {
+                       return nil, err
+               }
+       }
+
+       file, err := os.Create(filePath)
+       if err != nil {
+               return nil, err
+       }
+       fmt.Fprintf(ginkgo.GinkgoWriter, "Created log file: %s\n", filePath)
+       return file, nil
+}
+
+func getLogFilePath(suiteName string, specName string, logType string, 
extention string) (string, error) {

Review Comment:
   "extension" ?



##########
test/e2e/admission_controller/admission_controller_suite_test.go:
##########
@@ -188,6 +190,8 @@ func TestAdmissionController(t *testing.T) {
 }
 
 var _ = BeforeSuite(func() {
+       _, filename, _, _ := runtime.Caller(0)
+       suiteName = common.GetSuiteName(filename)

Review Comment:
   These two lines are constantly repeated. It would make sense to rename and 
extend `GetSuiteName()` to return two strings, the `suiteName` and `filename`, 
eg. `common.GetTestSuiteInfo()`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to