Skip to content

Skip flaky cancellation test checks that depend on a race-condition #811

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

Merged
merged 2 commits into from
May 30, 2018
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
28 changes: 14 additions & 14 deletions driver_go18_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func TestContextCancelExec(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())

// Delay execution for just a bit until db.ExecContext has begun.
defer time.AfterFunc(100*time.Millisecond, cancel).Stop()
defer time.AfterFunc(250*time.Millisecond, cancel).Stop()

// This query will be canceled.
startTime := time.Now()
Expand All @@ -259,7 +259,7 @@ func TestContextCancelExec(t *testing.T) {
dbt.Errorf("too long execution time: %s", d)
}

// Wait for the INSERT query has done.
// Wait for the INSERT query to be done.
time.Sleep(time.Second)

// Check how many times the query is executed.
Expand All @@ -268,7 +268,7 @@ func TestContextCancelExec(t *testing.T) {
dbt.Fatalf("%s", err.Error())
}
if v != 1 { // TODO: need to kill the query, and v should be 0.
dbt.Errorf("expected val to be 1, got %d", v)
dbt.Skipf("[WARN] expected val to be 1, got %d", v)
}

// Context is already canceled, so error should come before execution.
Expand All @@ -283,7 +283,7 @@ func TestContextCancelExec(t *testing.T) {
dbt.Fatalf("%s", err.Error())
}
if v != 1 {
dbt.Errorf("expected val to be 1, got %d", v)
dbt.Skipf("[WARN] expected val to be 1, got %d", v)
}
})
}
Expand All @@ -294,7 +294,7 @@ func TestContextCancelQuery(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())

// Delay execution for just a bit until db.ExecContext has begun.
defer time.AfterFunc(100*time.Millisecond, cancel).Stop()
defer time.AfterFunc(250*time.Millisecond, cancel).Stop()

// This query will be canceled.
startTime := time.Now()
Expand All @@ -305,7 +305,7 @@ func TestContextCancelQuery(t *testing.T) {
dbt.Errorf("too long execution time: %s", d)
}

// Wait for the INSERT query has done.
// Wait for the INSERT query to be done.
time.Sleep(time.Second)

// Check how many times the query is executed.
Expand All @@ -314,7 +314,7 @@ func TestContextCancelQuery(t *testing.T) {
dbt.Fatalf("%s", err.Error())
}
if v != 1 { // TODO: need to kill the query, and v should be 0.
dbt.Errorf("expected val to be 1, got %d", v)
dbt.Skipf("[WARN] expected val to be 1, got %d", v)
}

// Context is already canceled, so error should come before execution.
Expand All @@ -327,7 +327,7 @@ func TestContextCancelQuery(t *testing.T) {
dbt.Fatalf("%s", err.Error())
}
if v != 1 {
dbt.Errorf("expected val to be 1, got %d", v)
dbt.Skipf("[WARN] expected val to be 1, got %d", v)
}
})
}
Expand All @@ -353,7 +353,7 @@ func TestContextCancelQueryRow(t *testing.T) {
}

cancel()
// make sure the driver recieve cancel request.
// make sure the driver receives the cancel request.
time.Sleep(100 * time.Millisecond)

if rows.Next() {
Expand Down Expand Up @@ -385,7 +385,7 @@ func TestContextCancelStmtExec(t *testing.T) {
}

// Delay execution for just a bit until db.ExecContext has begun.
defer time.AfterFunc(100*time.Millisecond, cancel).Stop()
defer time.AfterFunc(250*time.Millisecond, cancel).Stop()

// This query will be canceled.
startTime := time.Now()
Expand All @@ -396,7 +396,7 @@ func TestContextCancelStmtExec(t *testing.T) {
dbt.Errorf("too long execution time: %s", d)
}

// Wait for the INSERT query has done.
// Wait for the INSERT query to be done.
time.Sleep(time.Second)

// Check how many times the query is executed.
Expand All @@ -405,7 +405,7 @@ func TestContextCancelStmtExec(t *testing.T) {
dbt.Fatalf("%s", err.Error())
}
if v != 1 { // TODO: need to kill the query, and v should be 0.
dbt.Errorf("expected val to be 1, got %d", v)
dbt.Skipf("[WARN] expected val to be 1, got %d", v)
}
})
}
Expand All @@ -420,7 +420,7 @@ func TestContextCancelStmtQuery(t *testing.T) {
}

// Delay execution for just a bit until db.ExecContext has begun.
defer time.AfterFunc(100*time.Millisecond, cancel).Stop()
defer time.AfterFunc(250*time.Millisecond, cancel).Stop()

// This query will be canceled.
startTime := time.Now()
Expand All @@ -440,7 +440,7 @@ func TestContextCancelStmtQuery(t *testing.T) {
dbt.Fatalf("%s", err.Error())
}
if v != 1 { // TODO: need to kill the query, and v should be 0.
dbt.Errorf("expected val to be 1, got %d", v)
dbt.Skipf("[WARN] expected val to be 1, got %d", v)
}
})
}
Expand Down