Skip to content

Commit

Permalink
Revert "Update all the Go dependencies (vitessio#11741)"
Browse files Browse the repository at this point in the history
This reverts commit 18faa1e.
  • Loading branch information
timvaillancourt committed Apr 9, 2024
1 parent 1d0f136 commit ebe2d5b
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 131 deletions.
39 changes: 19 additions & 20 deletions go/sqltypes/result_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package sqltypes

import (
"reflect"
"testing"

"vitess.io/vitess/go/test/utils"
Expand All @@ -30,20 +31,20 @@ func TestRepair(t *testing.T) {
}, {
Type: VarChar,
}}
in := &Result{
in := Result{
Rows: [][]Value{
{TestValue(VarBinary, "1"), TestValue(VarBinary, "aa")},
{TestValue(VarBinary, "2"), TestValue(VarBinary, "bb")},
},
}
want := &Result{
want := Result{
Rows: [][]Value{
{TestValue(Int64, "1"), TestValue(VarChar, "aa")},
{TestValue(Int64, "2"), TestValue(VarChar, "bb")},
},
}
in.Repair(fields)
if !in.Equal(want) {
if !reflect.DeepEqual(in, want) {
t.Errorf("Repair:\n%#v, want\n%#v", in, want)
}
}
Expand Down Expand Up @@ -84,7 +85,7 @@ func TestTruncate(t *testing.T) {
}

out := in.Truncate(0)
if !out.Equal(in) {
if !reflect.DeepEqual(out, in) {
t.Errorf("Truncate(0):\n%v, want\n%v", out, in)
}

Expand All @@ -101,7 +102,7 @@ func TestTruncate(t *testing.T) {
{TestValue(Int64, "3")},
},
}
if !out.Equal(want) {
if !reflect.DeepEqual(out, want) {
t.Errorf("Truncate(1):\n%v, want\n%v", out, want)
}
}
Expand Down Expand Up @@ -278,21 +279,19 @@ func TestStripMetaData(t *testing.T) {
},
}}
for _, tcase := range testcases {
t.Run(tcase.name, func(t *testing.T) {
inCopy := tcase.in.Copy()
out := inCopy.StripMetadata(tcase.includedFields)
if !out.Equal(tcase.expected) {
t.Errorf("StripMetaData unexpected result for %v: %v", tcase.name, out)
}
if len(tcase.in.Fields) > 0 {
// check the out array is different than the in array.
if out.Fields[0] == inCopy.Fields[0] && tcase.includedFields != querypb.ExecuteOptions_ALL {
t.Errorf("StripMetaData modified original Field for %v", tcase.name)
}
inCopy := tcase.in.Copy()
out := inCopy.StripMetadata(tcase.includedFields)
if !reflect.DeepEqual(out, tcase.expected) {
t.Errorf("StripMetaData unexpected result for %v: %v", tcase.name, out)
}
if len(tcase.in.Fields) > 0 {
// check the out array is different than the in array.
if out.Fields[0] == inCopy.Fields[0] && tcase.includedFields != querypb.ExecuteOptions_ALL {
t.Errorf("StripMetaData modified original Field for %v", tcase.name)
}
// check we didn't change the original result.
utils.MustMatch(t, tcase.in, inCopy)
})
}
// check we didn't change the original result.
utils.MustMatch(t, tcase.in, inCopy)
}
}

Expand Down Expand Up @@ -341,7 +340,7 @@ func TestAppendResult(t *testing.T) {

result.AppendResult(src)

if !result.Equal(want) {
if !reflect.DeepEqual(result, want) {
t.Errorf("Got:\n%#v, want:\n%#v", result, want)
}
}
62 changes: 29 additions & 33 deletions go/stats/statsd/statsd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func TestStatsdCounter(t *testing.T) {
t.Fatal(err)
}
result := string(bytes[:n])
expected := "test.counter_name:1|c\n"
assert.Equal(t, expected, result)
expected := "test.counter_name:1|c"
assert.Equal(t, result, expected)
}
})
if !found {
Expand Down Expand Up @@ -84,8 +84,8 @@ func TestStatsdGauge(t *testing.T) {
t.Fatal(err)
}
result := string(bytes[:n])
expected := "test.gauge_name:10|g\n"
assert.Equal(t, expected, result)
expected := "test.gauge_name:10.000000|g"
assert.Equal(t, result, expected)
}
})
if !found {
Expand Down Expand Up @@ -113,8 +113,8 @@ func TestStatsdGaugeFloat64(t *testing.T) {
t.Fatal(err)
}
result := string(bytes[:n])
expected := "test.gauge_name_f64:3.14|g\n"
assert.Equal(t, expected, result)
expected := "test.gauge_name_f64:3.140000|g"
assert.Equal(t, result, expected)
}
})
if !found {
Expand Down Expand Up @@ -143,8 +143,8 @@ func TestStatsdGaugeFunc(t *testing.T) {
t.Fatal(err)
}
result := string(bytes[:n])
expected := "test.gauge_func_name:2|g\n"
assert.Equal(t, expected, result)
expected := "test.gauge_func_name:2.000000|g"
assert.Equal(t, result, expected)
}
})
if !found {
Expand Down Expand Up @@ -172,8 +172,8 @@ func TestStatsdCounterDuration(t *testing.T) {
t.Fatal(err)
}
result := string(bytes[:n])
expected := "test.counter_duration_name:1.000000|ms\n"
assert.Equal(t, expected, result)
expected := "test.counter_duration_name:1.000000|ms"
assert.Equal(t, result, expected)
}
})
if !found {
Expand Down Expand Up @@ -203,12 +203,11 @@ func TestStatsdCountersWithSingleLabel(t *testing.T) {
result := strings.Split(string(bytes[:n]), "\n")
sort.Strings(result)
expected := []string{
"",
"test.counter_with_single_label_name:0|c|#label:tag2",
"test.counter_with_single_label_name:2|c|#label:tag1",
}
for i, res := range result {
assert.Equal(t, expected[i], res)
assert.Equal(t, res, expected[i])
}
}
})
Expand Down Expand Up @@ -237,8 +236,8 @@ func TestStatsdCountersWithMultiLabels(t *testing.T) {
t.Fatal(err)
}
result := string(bytes[:n])
expected := "test.counter_with_multiple_label_name:1|c|#label1:foo,label2:bar\n"
assert.Equal(t, expected, result)
expected := "test.counter_with_multiple_label_name:1|c|#label1:foo,label2:bar"
assert.Equal(t, result, expected)
}
})
if !found {
Expand Down Expand Up @@ -272,12 +271,11 @@ func TestStatsdCountersFuncWithMultiLabels(t *testing.T) {
result := strings.Split(string(bytes[:n]), "\n")
sort.Strings(result)
expected := []string{
"",
"test.counter_func_with_multiple_labels_name:1|c|#label1:foo,label2:bar",
"test.counter_func_with_multiple_labels_name:2|c|#label1:bar,label2:baz",
}
for i, res := range result {
assert.Equal(t, expected[i], res)
assert.Equal(t, res, expected[i])
}
}
})
Expand Down Expand Up @@ -306,8 +304,8 @@ func TestStatsdGaugesWithMultiLabels(t *testing.T) {
t.Fatal(err)
}
result := string(bytes[:n])
expected := "test.gauges_with_multiple_label_name:3|g|#label1:foo,label2:bar\n"
assert.Equal(t, expected, result)
expected := "test.gauges_with_multiple_label_name:3.000000|g|#label1:foo,label2:bar"
assert.Equal(t, result, expected)
}
})
if !found {
Expand Down Expand Up @@ -341,12 +339,11 @@ func TestStatsdGaugesFuncWithMultiLabels(t *testing.T) {
result := strings.Split(string(bytes[:n]), "\n")
sort.Strings(result)
expected := []string{
"",
"test.gauges_func_with_multiple_labels_name:1|g|#label1:foo,label2:bar",
"test.gauges_func_with_multiple_labels_name:2|g|#label1:bar,label2:baz",
"test.gauges_func_with_multiple_labels_name:1.000000|g|#label1:foo,label2:bar",
"test.gauges_func_with_multiple_labels_name:2.000000|g|#label1:bar,label2:baz",
}
for i, res := range result {
assert.Equal(t, expected[i], res)
assert.Equal(t, res, expected[i])
}
}
})
Expand Down Expand Up @@ -375,8 +372,8 @@ func TestStatsdGaugesWithSingleLabel(t *testing.T) {
t.Fatal(err)
}
result := string(bytes[:n])
expected := "test.gauges_with_single_label_name:1|g|#label1:bar\n"
assert.Equal(t, expected, result)
expected := "test.gauges_with_single_label_name:1.000000|g|#label1:bar"
assert.Equal(t, result, expected)
}
})
if !found {
Expand Down Expand Up @@ -404,8 +401,8 @@ func TestStatsdMultiTimings(t *testing.T) {
t.Fatal(err)
}
result := string(bytes[:n])
expected := "test.multi_timings_name:10.000000|ms|#label1:foo,label2:bar\n"
assert.Equal(t, expected, result)
expected := "test.multi_timings_name:10.000000|ms|#label1:foo,label2:bar"
assert.Equal(t, result, expected)
}
})
if !found {
Expand Down Expand Up @@ -433,8 +430,8 @@ func TestStatsdTimings(t *testing.T) {
t.Fatal(err)
}
result := string(bytes[:n])
expected := "test.timings_name:2.000000|ms|#label1:foo\n"
assert.Equal(t, expected, result)
expected := "test.timings_name:2.000000|ms|#label1:foo"
assert.Equal(t, result, expected)
}
})
if !found {
Expand Down Expand Up @@ -465,13 +462,12 @@ func TestStatsdHistogram(t *testing.T) {
}
result := string(bytes[:n])
expected := []string{
"test.histogram_name:2|h",
"test.histogram_name:3|h",
"test.histogram_name:6|h",
"",
"test.histogram_name:2.000000|h",
"test.histogram_name:3.000000|h",
"test.histogram_name:6.000000|h",
}
for i, res := range strings.Split(result, "\n") {
assert.Equal(t, expected[i], res)
assert.Equal(t, res, expected[i])
}
}
})
Expand Down
18 changes: 9 additions & 9 deletions go/vt/vtadmin/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ func TestFindSchema(t *testing.T) {
}

assert.NoError(t, err)
assert.Truef(t, proto.Equal(tt.expected, resp), "expected %v, got %v", tt.expected, resp)
assert.Equal(t, tt.expected, resp)
})
}

Expand Down Expand Up @@ -815,7 +815,7 @@ func TestFindSchema(t *testing.T) {
}

assert.NoError(t, err)
assert.Truef(t, proto.Equal(expected, schema), "expected %v, got %v", expected, schema)
assert.Equal(t, expected, schema)
})
}

Expand Down Expand Up @@ -1091,7 +1091,7 @@ func TestGetKeyspace(t *testing.T) {
}

assert.NoError(t, err)
assert.Truef(t, proto.Equal(tt.expected, ks), "expected %v, got %v", tt.expected, ks)
assert.Equal(t, tt.expected, ks)
}, vtctlds...)
})
}
Expand Down Expand Up @@ -1575,7 +1575,7 @@ func TestGetSchema(t *testing.T) {
}

assert.NoError(t, err)
assert.Truef(t, proto.Equal(tt.expected, resp), "expected %v, got %v", tt.expected, resp)
assert.Equal(t, tt.expected, resp)
})
})
}
Expand Down Expand Up @@ -1742,7 +1742,7 @@ func TestGetSchema(t *testing.T) {
}

assert.NoError(t, err)
assert.Truef(t, proto.Equal(expected, schema), "expected %v, got %v", expected, schema)
assert.Equal(t, expected, schema)
})
}

Expand Down Expand Up @@ -2556,7 +2556,7 @@ func TestGetSchemas(t *testing.T) {
}

assert.NoError(t, err)
assert.Truef(t, proto.Equal(expected, resp), "expected: %v, got: %v", expected, resp)
assert.ElementsMatch(t, expected.Schemas, resp.Schemas)
})
}

Expand Down Expand Up @@ -2717,7 +2717,7 @@ func TestGetSrvVSchema(t *testing.T) {
}

require.NoError(t, err)
assert.Truef(t, proto.Equal(tt.expected, resp), "expected %v, got %v", tt.expected, resp)
assert.Equal(t, tt.expected, resp)
})
})
}
Expand Down Expand Up @@ -3609,7 +3609,7 @@ func TestGetVSchema(t *testing.T) {
}

assert.NoError(t, err)
assert.Truef(t, proto.Equal(tt.expected, resp), "expected %v, got %v", tt.expected, resp)
assert.Equal(t, tt.expected, resp)
})
}
}
Expand Down Expand Up @@ -4155,7 +4155,7 @@ func TestGetWorkflow(t *testing.T) {
}

assert.NoError(t, err)
assert.Truef(t, proto.Equal(tt.expected, resp), "expected %v, got %v", tt.expected, resp)
assert.Equal(t, tt.expected, resp)
})
}
}
Expand Down
Loading

0 comments on commit ebe2d5b

Please sign in to comment.