Cherry-pick MM-66789: Restrict log downloads to a root path for support packets (#35164)
Automatic Merge
Этот коммит содержится в:
@@ -35,6 +35,7 @@ type MainHelper struct {
|
||||
|
||||
status int
|
||||
testResourcePath string
|
||||
testLogsPath string
|
||||
replicas []string
|
||||
storePool *sqlstore.TestPool
|
||||
}
|
||||
@@ -88,6 +89,15 @@ func NewMainHelperWithOptions(options *HelperOptions) *MainHelper {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
// Create a logs directory and set MM_LOG_PATH for tests that validate log file paths.
|
||||
// This is done unconditionally so tests don't need to enable full resources just for logging.
|
||||
logsDir, err := os.MkdirTemp("", "testlogs")
|
||||
if err != nil {
|
||||
log.Fatal("Failed to create test logs directory: " + err.Error())
|
||||
}
|
||||
os.Setenv("MM_LOG_PATH", logsDir)
|
||||
mainHelper.testLogsPath = logsDir
|
||||
|
||||
if options != nil {
|
||||
mainHelper.Options = *options
|
||||
|
||||
@@ -293,6 +303,10 @@ func (h *MainHelper) Close() error {
|
||||
if h.testResourcePath != "" {
|
||||
os.RemoveAll(h.testResourcePath)
|
||||
}
|
||||
if h.testLogsPath != "" {
|
||||
os.RemoveAll(h.testLogsPath)
|
||||
os.Unsetenv("MM_LOG_PATH")
|
||||
}
|
||||
|
||||
if h.storePool != nil {
|
||||
h.storePool.Close()
|
||||
|
||||
Ссылка в новой задаче
Block a user