Cherry-pick MM-66789: Restrict log downloads to a root path for support packets (#35164)

Automatic Merge
Этот коммит содержится в:
Doug Lauder
2026-02-02 14:23:28 -05:00
коммит произвёл GitHub
родитель d2594e5046
Коммит 463f7a0511
13 изменённых файлов: 1050 добавлений и 7 удалений

Просмотреть файл

@@ -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()

Просмотреть файл

@@ -142,6 +142,12 @@ func SetupTestResources() (string, error) {
return "", errors.Wrapf(err, "failed to create client directory %s", clientDir)
}
logsDir := path.Join(tempDir, "logs")
err = os.Mkdir(logsDir, 0700)
if err != nil {
return "", errors.Wrapf(err, "failed to create logs directory %s", logsDir)
}
err = setupConfig(path.Join(tempDir, "config"))
if err != nil {
return "", errors.Wrap(err, "failed to setup config")