GetDevFileName returns a qualified name of a devfile for use in a test. The devfile will be in a temporary directory and is named using the calling function's name.
()
| 141 | // GetDevFileName returns a qualified name of a devfile for use in a test. |
| 142 | // The devfile will be in a temporary directory and is named using the calling function's name. |
| 143 | func GetDevFileName() string { |
| 144 | pc, fn, _, ok := runtime.Caller(1) |
| 145 | if !ok { |
| 146 | return tmpDir + "DefaultDevfile" |
| 147 | } |
| 148 | |
| 149 | testFile := filepath.Base(fn) |
| 150 | testFileExtension := filepath.Ext(testFile) |
| 151 | subdir := testFile[0 : len(testFile)-len(testFileExtension)] |
| 152 | destDir := CreateTempDir(subdir) |
| 153 | callerName := runtime.FuncForPC(pc).Name() |
| 154 | pos1 := strings.LastIndex(callerName, "Test_") |
| 155 | devfileName := destDir + callerName[pos1:len(callerName)] + ".yaml" |
| 156 | |
| 157 | LogInfoMessage(fmt.Sprintf("GetDevFileName : %s", devfileName)) |
| 158 | |
| 159 | return devfileName |
| 160 | } |
| 161 | |
| 162 | // AddSuffixToFileName adds a specified suffix to the name of a specified file. |
| 163 | // For example if the file is devfile.yaml and the suffix is 1, the result is devfile1.yaml |
nothing calls this directly
no test coverage detected