Added debug settings for testing and e2e tests (#29175)

Этот коммит содержится в:
Harshil Sharma
2024-11-12 11:26:14 +05:30
коммит произвёл GitHub
родитель 64bf13f250
Коммит 56260e93d4
3 изменённых файлов: 18 добавлений и 2 удалений

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

@@ -82,7 +82,8 @@ import (
)
const (
scheduledPostJobInterval = 5 * time.Minute
scheduledPostJobInterval = 5 * time.Minute
debugScheduledPostJobInterval = 2 * time.Second
)
var SentryDSN = "https://9d7c9cccf549479799f880bcf4f26323@o94110.ingest.sentry.io/5212327"
@@ -1841,10 +1842,17 @@ func runScheduledPostJob(a *App) {
}
func doRunScheduledPostJob(a *App) {
var jobInterval time.Duration
if *a.Config().ServiceSettings.EnableTesting {
jobInterval = debugScheduledPostJobInterval
} else {
jobInterval = scheduledPostJobInterval
}
rctx := request.EmptyContext(a.Log())
withMut(&a.ch.scheduledPostMut, func() {
fn := func() { a.ProcessScheduledPosts(rctx) }
a.ch.scheduledPostTask = model.CreateRecurringTaskFromNextIntervalTime("Process Scheduled Posts", fn, scheduledPostJobInterval)
a.ch.scheduledPostTask = model.CreateRecurringTaskFromNextIntervalTime("Process Scheduled Posts", fn, jobInterval)
})
}

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

@@ -8,6 +8,7 @@ import {FormattedMessage, useIntl} from 'react-intl';
import {useDispatch, useSelector} from 'react-redux';
import {savePreferences} from 'mattermost-redux/actions/preferences';
import {testingEnabled} from 'mattermost-redux/selectors/entities/general';
import {generateCurrentTimezoneLabel, getCurrentTimezone} from 'mattermost-redux/selectors/entities/timezone';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
@@ -76,6 +77,8 @@ export default function ScheduledPostCustomTimeModal({channelId, onExited, onCon
const label = formatMessage({id: 'schedule_post.custom_time_modal.title', defaultMessage: 'Schedule message'});
const timePickerInterval = useSelector(testingEnabled) ? 1 : undefined;
return (
<DateTimePickerModal
className='scheduled_post_custom_time_modal'
@@ -107,6 +110,7 @@ export default function ScheduledPostCustomTimeModal({channelId, onExited, onCon
relativeDate={true}
onCancel={onExited}
errorText={errorMessage}
timePickerInterval={timePickerInterval}
/>
);
}

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

@@ -161,3 +161,7 @@ export const getUsersStatusAndProfileFetchingPollInterval: (state: GlobalState)
export function developerModeEnabled(state: GlobalState): boolean {
return state.entities.general.config.EnableDeveloper === 'true';
}
export function testingEnabled(state: GlobalState): boolean {
return state.entities.general.config.EnableTesting === 'true';
}