This repository has been archived by the owner on Dec 16, 2022. It is now read-only.
forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change GRPC message limit SQL error type (vitessio#6630)
* impl+log Signed-off-by: Richard Bailey <rbailey@slack-corp.com> * correctly escape regex Signed-off-by: Richard Bailey <rbailey@slack-corp.com> * simple tests, remove logging Signed-off-by: Richard Bailey <rbailey@slack-corp.com> * years are dumb Signed-off-by: Richard Bailey <rbailey@slack-corp.com> * handle the other tow RE cases. this is ... mabye a bit much with the factoring out but maybe not Signed-off-by: Richard Bailey <rbailey@slack-corp.com> * fix up comments, move impls around Signed-off-by: Richard Bailey <rbailey@slack-corp.com> * better better error comment <_< Signed-off-by: Richard Bailey <rbailey@slack-corp.com> * assert! Signed-off-by: Richard Bailey <rbailey@slack-corp.com> * to run test suite Signed-off-by: Richard Bailey <rbailey@slack-corp.com> * fix up testsv Signed-off-by: Richard Bailey <rbailey@slack-corp.com> * tests pass; remove dead code-as-comments Signed-off-by: Richard Bailey <rbailey@slack-corp.com> * pull out unnecessary processing Signed-off-by: Richard Bailey <rbailey@slack-corp.com> * don't differentiate trailing vs leading clarification Signed-off-by: Richard Bailey <rbailey@slack-corp.com>
- Loading branch information
1 parent
86a5bd9
commit adc03bf
Showing
6 changed files
with
62 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
Copyright 2020 The Vitess Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package mysql | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestDumuxResourceExhaustedErrors(t *testing.T) { | ||
type testCase struct { | ||
msg string | ||
want int | ||
} | ||
|
||
cases := []testCase{ | ||
testCase{"misc", ERTooManyUserConnections}, | ||
testCase{"grpc: received message larger than max (99282 vs. 1234): trailer", ERNetPacketTooLarge}, | ||
testCase{"grpc: received message larger than max (1234 vs. 1234)", ERNetPacketTooLarge}, | ||
testCase{"header: grpc: received message larger than max (1234 vs. 1234)", ERNetPacketTooLarge}, | ||
// This should be explicitly handled by returning ERNetPacketTooLarge from the execturo directly | ||
// and therefore shouldn't need to be teased out of another error. | ||
testCase{"in-memory row count exceeded allowed limit of 13", ERTooManyUserConnections}, | ||
} | ||
|
||
for _, c := range cases { | ||
got := demuxResourceExhaustedErrors(c.msg) | ||
assert.Equalf(t, c.want, got, c.msg) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters