Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

statistics: fix the test case by increase the time interval #51139

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions pkg/statistics/handle/autoanalyze/priorityqueue/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,11 @@ func TestIsValidToAnalyze(t *testing.T) {
// Just failed.
now := tk.MustQuery("select now()").Rows()[0][0].(string)
insertFailedJobWithStartTime(tk, job.TableSchema, job.TableName, "", now)
valid, failReason = job.IsValidToAnalyze(sctx)
// Note: The failure reason is not checked in this test because the time duration can sometimes be inaccurate.(not now)
valid, _ = job.IsValidToAnalyze(sctx)
require.False(t, valid)
require.Equal(t, "last analysis just failed", failReason)
// Failed 1 second ago.
startTime := tk.MustQuery("select now() - interval 1 second").Rows()[0][0].(string)
// Failed 10 seconds ago.
startTime := tk.MustQuery("select now() - interval 10 second").Rows()[0][0].(string)
insertFailedJobWithStartTime(tk, job.TableSchema, job.TableName, "", startTime)
valid, failReason = job.IsValidToAnalyze(sctx)
require.False(t, valid)
Expand Down Expand Up @@ -330,11 +330,11 @@ func TestIsValidToAnalyzeForPartitionedTba(t *testing.T) {
// Just failed.
now := tk.MustQuery("select now()").Rows()[0][0].(string)
insertFailedJobWithStartTime(tk, job.TableSchema, job.TableName, "p0", now)
valid, failReason = job.IsValidToAnalyze(sctx)
// Note: The failure reason is not checked in this test because the time duration can sometimes be inaccurate.(not now)
valid, _ = job.IsValidToAnalyze(sctx)
require.False(t, valid)
require.Equal(t, "last analysis just failed", failReason)
// Failed 1 second ago.
startTime := tk.MustQuery("select now() - interval 1 second").Rows()[0][0].(string)
// Failed 10 seconds ago.
startTime := tk.MustQuery("select now() - interval 10 second").Rows()[0][0].(string)
insertFailedJobWithStartTime(tk, job.TableSchema, job.TableName, "p0", startTime)
valid, failReason = job.IsValidToAnalyze(sctx)
require.False(t, valid)
Expand Down