| 1 | /* |
| 2 | Copyright (c) 2019, Percona LLC. |
| 3 | All rights reserved. |
| 4 | |
| 5 | Redistribution and use in source and binary forms, with or without |
| 6 | modification, are permitted provided that the following conditions are met: |
| 7 | |
| 8 | * Redistributions of source code must retain the above copyright notice, this |
| 9 | list of conditions and the following disclaimer. |
| 10 | |
| 11 | * Redistributions in binary form must reproduce the above copyright notice, |
| 12 | this list of conditions and the following disclaimer in the documentation |
| 13 | and/or other materials provided with the distribution. |
| 14 | |
| 15 | * Neither the name of the copyright holder nor the names of its |
| 16 | contributors may be used to endorse or promote products derived from |
| 17 | this software without specific prior written permission. |
| 18 | |
| 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| 23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | */ |
| 30 | |
| 31 | package event_testscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/ |
| 32 | |
| 33 | import ( |
| 34 | "encoding/jsonscip-go gomod github.com/golang/go/src go1.25.4 `encoding/json`/" |
| 35 | "io/ioutilscip-go gomod github.com/golang/go/src go1.25.4 `io/ioutil`/" |
| 36 | lscip-go gomod github.com/golang/go/src go1.25.4 log/ "logscip-go gomod github.com/golang/go/src go1.25.4 log/" |
| 37 | "osscip-go gomod github.com/golang/go/src go1.25.4 os/" |
| 38 | "path/filepathscip-go gomod github.com/golang/go/src go1.25.4 `path/filepath`/" |
| 39 | "sortscip-go gomod github.com/golang/go/src go1.25.4 sort/" |
| 40 | "stringsscip-go gomod github.com/golang/go/src go1.25.4 strings/" |
| 41 | "testingscip-go gomod github.com/golang/go/src go1.25.4 testing/" |
| 42 | "timescip-go gomod github.com/golang/go/src go1.25.4 time/" |
| 43 | |
| 44 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/" |
| 45 | |
| 46 | "github.com/percona/go-mysql/eventscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/" |
| 47 | "github.com/percona/go-mysql/logscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/log`/" |
| 48 | parserscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/log/slow`/ "github.com/percona/go-mysql/log/slowscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/log/slow`/" |
| 49 | "github.com/percona/go-mysql/queryscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/query`/" |
| 50 | "github.com/percona/go-mysql/testscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/test`/" |
| 51 | ) |
| 52 | |
| 53 | var ( |
| 54 | rootDirscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/rootDir. = testscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/test`/.RootDirscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/test`/RootDir().() |
| 55 | samplescip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/sample. = filepathscip-go gomod github.com/golang/go/src go1.25.4 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.4 `path/filepath`/Join().(rootDirscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/rootDir., "test/slow-logs") |
| 56 | ) |
| 57 | |
| 58 | func aggregateSlowLogscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/aggregateSlowLog().(input, output string, utcOffset timescip-go gomod github.com/golang/go/src go1.25.4 time/.Durationscip-go gomod github.com/golang/go/src go1.25.4 time/Duration#, examples bool) (string, string) { |
| 59 | file, err := osscip-go gomod github.com/golang/go/src go1.25.4 os/.Openscip-go gomod github.com/golang/go/src go1.25.4 os/Open().(filepathscip-go gomod github.com/golang/go/src go1.25.4 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.4 `path/filepath`/Join().(samplescip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/sample., input)) |
| 60 | if err != nil { |
| 61 | lscip-go gomod github.com/golang/go/src go1.25.4 log/.Fatalscip-go gomod github.com/golang/go/src go1.25.4 log/Fatal().(err) |
| 62 | } |
| 63 | opt := logscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/log`/.Optionsscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/log`/Options#{} |
| 64 | opt.DefaultLocationscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/log`/Options#DefaultLocation. = timescip-go gomod github.com/golang/go/src go1.25.4 time/.UTCscip-go gomod github.com/golang/go/src go1.25.4 time/UTC. |
| 65 | p := parserscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/log/slow`/.NewSlowLogParserscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/log/slow`/NewSlowLogParser().(file, opt) |
| 66 | go p.Startscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/log/slow`/SlowLogParser#Start().() |
| 67 | a := eventscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/.NewAggregatorscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/NewAggregator().(examples, utcOffset, 10) |
| 68 | for e := range p.EventChanscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/log/slow`/SlowLogParser#EventChan().() { |
| 69 | f := queryscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/query`/.Fingerprintscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/query`/Fingerprint().(e.Queryscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/log`/Event#Query.) |
| 70 | id := queryscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/query`/.Idscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/query`/Id().(f) |
| 71 | a.AddEventscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Aggregator#AddEvent().(e, id, e.Userscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/log`/Event#User., e.Hostscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/log`/Event#Host., e.Dbscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/log`/Event#Db., e.Serverscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/log`/Event#Server., f) |
| 72 | } |
| 73 | got := a.Finalizescip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Aggregator#Finalize().() |
| 74 | gotJson, err := jsonscip-go gomod github.com/golang/go/src go1.25.4 `encoding/json`/.MarshalIndentscip-go gomod github.com/golang/go/src go1.25.4 `encoding/json`/MarshalIndent().(got, "", " ") |
| 75 | if err != nil { |
| 76 | lscip-go gomod github.com/golang/go/src go1.25.4 log/.Fatalscip-go gomod github.com/golang/go/src go1.25.4 log/Fatal().(err) |
| 77 | } |
| 78 | |
| 79 | resultOutputPath := filepathscip-go gomod github.com/golang/go/src go1.25.4 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.4 `path/filepath`/Join().("testdata", output) |
| 80 | if *testscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/test`/.Updatescip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/test`/Update. { |
| 81 | if err := ioutilscip-go gomod github.com/golang/go/src go1.25.4 `io/ioutil`/.WriteFilescip-go gomod github.com/golang/go/src go1.25.4 `io/ioutil`/WriteFile().(resultOutputPath, gotJson, 0o666); err != nil { |
| 82 | lscip-go gomod github.com/golang/go/src go1.25.4 log/.Fatalscip-go gomod github.com/golang/go/src go1.25.4 log/Fatal().(err) |
| 83 | } |
| 84 | } |
| 85 | expectJson, err := ioutilscip-go gomod github.com/golang/go/src go1.25.4 `io/ioutil`/.ReadFilescip-go gomod github.com/golang/go/src go1.25.4 `io/ioutil`/ReadFile().(resultOutputPath) |
| 86 | if err != nil { |
| 87 | lscip-go gomod github.com/golang/go/src go1.25.4 log/.Fatalscip-go gomod github.com/golang/go/src go1.25.4 log/Fatal().(err) |
| 88 | } |
| 89 | |
| 90 | return string(gotJson), string(expectJson) |
| 91 | } |
| 92 | |
| 93 | func zeroPercentilesscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/zeroPercentiles().(r *eventscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/.Resultscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Result#) { |
| 94 | for _, metrics := range r.Globalscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Result#Global..Metricsscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Class#Metrics..TimeMetricsscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Metrics#TimeMetrics. { |
| 95 | metrics.P99scip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/TimeStats#P99. = eventscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/.Float64scip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Float64().(0) |
| 96 | } |
| 97 | for _, metrics := range r.Globalscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Result#Global..Metricsscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Class#Metrics..NumberMetricsscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Metrics#NumberMetrics. { |
| 98 | metrics.P99scip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/NumberStats#P99. = eventscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/.Uint64scip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Uint64().(0) |
| 99 | } |
| 100 | for _, class := range r.Classscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Result#Class. { |
| 101 | for _, metrics := range class.Metricsscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Class#Metrics..TimeMetricsscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Metrics#TimeMetrics. { |
| 102 | metrics.P99scip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/TimeStats#P99. = eventscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/.Float64scip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Float64().(0) |
| 103 | } |
| 104 | for _, metrics := range class.Metricsscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Class#Metrics..NumberMetricsscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Metrics#NumberMetrics. { |
| 105 | metrics.P99scip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/NumberStats#P99. = eventscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/.Uint64scip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Uint64().(0) |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | func orderedscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/ordered().(in map[string]*eventscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/.Classscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Class#) (out []*eventscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/.Classscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Class#) { |
| 111 | var keys []string |
| 112 | for k := range in { |
| 113 | keys = append(keys, k) |
| 114 | } |
| 115 | sortscip-go gomod github.com/golang/go/src go1.25.4 sort/.Stringsscip-go gomod github.com/golang/go/src go1.25.4 sort/Strings().(keys) |
| 116 | for _, k := range keys { |
| 117 | out = append(out, in[k]) |
| 118 | } |
| 119 | |
| 120 | return out |
| 121 | } |
| 122 | |
| 123 | // -------------------------------------------------------------------------- |
| 124 | |
| 125 | func TestSlow001scip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/TestSlow001().(t *testingscip-go gomod github.com/golang/go/src go1.25.4 testing/.Tscip-go gomod github.com/golang/go/src go1.25.4 testing/T#) { |
| 126 | got, expect := aggregateSlowLogscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/aggregateSlowLog().("slow001.log", "slow001.golden", 0, true) |
| 127 | assertscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/JSONEq().(t, expect, got) |
| 128 | } |
| 129 | |
| 130 | func TestSlow001WithTzOffsetscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/TestSlow001WithTzOffset().(t *testingscip-go gomod github.com/golang/go/src go1.25.4 testing/.Tscip-go gomod github.com/golang/go/src go1.25.4 testing/T#) { |
| 131 | got, expect := aggregateSlowLogscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/aggregateSlowLog().("slow001.log", "slow001.golden", -1*timescip-go gomod github.com/golang/go/src go1.25.4 time/.Hourscip-go gomod github.com/golang/go/src go1.25.4 time/Hour., true) |
| 132 | // Use the same files as TestSlow001NoExamples but with a tz=-1 |
| 133 | expect = stringsscip-go gomod github.com/golang/go/src go1.25.4 strings/.Replacescip-go gomod github.com/golang/go/src go1.25.4 strings/Replace().(expect, "2007-10-15 21:43:52", "2007-10-15 20:43:52", 1) |
| 134 | expect = stringsscip-go gomod github.com/golang/go/src go1.25.4 strings/.Replacescip-go gomod github.com/golang/go/src go1.25.4 strings/Replace().(expect, "2007-10-15 21:45:10", "2007-10-15 20:45:10", 1) |
| 135 | assertscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/JSONEq().(t, expect, got) |
| 136 | } |
| 137 | |
| 138 | func TestSlow001NoExamplesscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/TestSlow001NoExamples().(t *testingscip-go gomod github.com/golang/go/src go1.25.4 testing/.Tscip-go gomod github.com/golang/go/src go1.25.4 testing/T#) { |
| 139 | got, expect := aggregateSlowLogscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/aggregateSlowLog().("slow001.log", "slow001-no-examples.golden", 0, false) |
| 140 | assertscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/JSONEq().(t, expect, got) |
| 141 | } |
| 142 | |
| 143 | // Test p99 and Cnt. |
| 144 | func TestSlow010scip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/TestSlow010().(t *testingscip-go gomod github.com/golang/go/src go1.25.4 testing/.Tscip-go gomod github.com/golang/go/src go1.25.4 testing/T#) { |
| 145 | got, expect := aggregateSlowLogscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/aggregateSlowLog().("slow010.log", "slow010.golden", 0, true) |
| 146 | assertscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/JSONEq().(t, expect, got) |
| 147 | } |
| 148 | |
| 149 | func TestAddClassSlow001scip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/TestAddClassSlow001().(t *testingscip-go gomod github.com/golang/go/src go1.25.4 testing/.Tscip-go gomod github.com/golang/go/src go1.25.4 testing/T#) { |
| 150 | expect, _ := aggregateSlowLogscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/aggregateSlowLog().("slow001.log", "slow001.golden", 0, true) |
| 151 | expectEventResult := eventscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/.Resultscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Result#{} |
| 152 | if err := jsonscip-go gomod github.com/golang/go/src go1.25.4 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.25.4 `encoding/json`/Unmarshal().([]byte(expect), &expectEventResult); err != nil { |
| 153 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.4 testing/common#Fatal().(err) |
| 154 | } |
| 155 | zeroPercentilesscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/zeroPercentiles().(&expectEventResult) |
| 156 | |
| 157 | global := eventscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/.NewClassscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/NewClass().("", "", "", "", "", "", false) |
| 158 | for _, class := range expectEventResult.Classscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Result#Class. { |
| 159 | global.AddClassscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Class#AddClass().(class) |
| 160 | } |
| 161 | expectGlobalBytes, err := jsonscip-go gomod github.com/golang/go/src go1.25.4 `encoding/json`/.Marshalscip-go gomod github.com/golang/go/src go1.25.4 `encoding/json`/Marshal().(expectEventResult.Globalscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Result#Global.) |
| 162 | if err != nil { |
| 163 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.4 testing/common#Fatal().(err) |
| 164 | } |
| 165 | gotGlobalBytes, err := jsonscip-go gomod github.com/golang/go/src go1.25.4 `encoding/json`/.Marshalscip-go gomod github.com/golang/go/src go1.25.4 `encoding/json`/Marshal().(global) |
| 166 | if err != nil { |
| 167 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.4 testing/common#Fatal().(err) |
| 168 | } |
| 169 | assertscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/JSONEq().(t, string(expectGlobalBytes), string(gotGlobalBytes)) |
| 170 | } |
| 171 | |
| 172 | func TestAddClassSlow023scip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/TestAddClassSlow023().(t *testingscip-go gomod github.com/golang/go/src go1.25.4 testing/.Tscip-go gomod github.com/golang/go/src go1.25.4 testing/T#) { |
| 173 | expect, _ := aggregateSlowLogscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/aggregateSlowLog().("slow023.log", "slow023.golden", 0, true) |
| 174 | expectEventResult := eventscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/.Resultscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Result#{} |
| 175 | if err := jsonscip-go gomod github.com/golang/go/src go1.25.4 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.25.4 `encoding/json`/Unmarshal().([]byte(expect), &expectEventResult); err != nil { |
| 176 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.4 testing/common#Fatal().(err) |
| 177 | } |
| 178 | zeroPercentilesscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/zeroPercentiles().(&expectEventResult) |
| 179 | |
| 180 | global := eventscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/.NewClassscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/NewClass().("", "", "", "", "", "", false) |
| 181 | for _, class := range orderedscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/ordered().(expectEventResult.Classscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Result#Class.) { |
| 182 | global.AddClassscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Class#AddClass().(class) |
| 183 | } |
| 184 | expectGlobalBytes, err := jsonscip-go gomod github.com/golang/go/src go1.25.4 `encoding/json`/.Marshalscip-go gomod github.com/golang/go/src go1.25.4 `encoding/json`/Marshal().(expectEventResult.Globalscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event`/Result#Global.) |
| 185 | if err != nil { |
| 186 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.4 testing/common#Fatal().(err) |
| 187 | } |
| 188 | gotGlobalBytes, err := jsonscip-go gomod github.com/golang/go/src go1.25.4 `encoding/json`/.Marshalscip-go gomod github.com/golang/go/src go1.25.4 `encoding/json`/Marshal().(global) |
| 189 | if err != nil { |
| 190 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.4 testing/common#Fatal().(err) |
| 191 | } |
| 192 | assertscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/JSONEq().(t, string(expectGlobalBytes), string(gotGlobalBytes)) |
| 193 | } |
| 194 | |
| 195 | func TestSlow018scip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/TestSlow018().(t *testingscip-go gomod github.com/golang/go/src go1.25.4 testing/.Tscip-go gomod github.com/golang/go/src go1.25.4 testing/T#) { |
| 196 | got, expect := aggregateSlowLogscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/aggregateSlowLog().("slow018.log", "slow018.golden", 0, true) |
| 197 | assertscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/JSONEq().(t, expect, got) |
| 198 | } |
| 199 | |
| 200 | // Tests for PCT-1006 & PCT-1085 |
| 201 | func TestUseDbscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/TestUseDb().(t *testingscip-go gomod github.com/golang/go/src go1.25.4 testing/.Tscip-go gomod github.com/golang/go/src go1.25.4 testing/T#) { |
| 202 | // Test db is not inherited |
| 203 | got, expect := aggregateSlowLogscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/aggregateSlowLog().("slow020.log", "slow020.golden", 0, true) |
| 204 | assertscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/JSONEq().(t, expect, got) |
| 205 | // Test "use" is not case sensitive |
| 206 | got, expect = aggregateSlowLogscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/aggregateSlowLog().("slow021.log", "slow021.golden", 0, true) |
| 207 | assertscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/JSONEq().(t, expect, got) |
| 208 | // Test we are parsing db names in backticks |
| 209 | got, expect = aggregateSlowLogscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/aggregateSlowLog().("slow022.log", "slow022.golden", 0, true) |
| 210 | assertscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/JSONEq().(t, expect, got) |
| 211 | } |
| 212 | |
| 213 | func TestOutlierSlow025scip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/TestOutlierSlow025().(t *testingscip-go gomod github.com/golang/go/src go1.25.4 testing/.Tscip-go gomod github.com/golang/go/src go1.25.4 testing/T#) { |
| 214 | got, expect := aggregateSlowLogscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/aggregateSlowLog().("slow025.log", "slow025.golden", 0, true) |
| 215 | assertscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/JSONEq().(t, expect, got) |
| 216 | } |
| 217 | |
| 218 | func TestMariaDB102WithExplainscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/TestMariaDB102WithExplain().(t *testingscip-go gomod github.com/golang/go/src go1.25.4 testing/.Tscip-go gomod github.com/golang/go/src go1.25.4 testing/T#) { |
| 219 | got, expect := aggregateSlowLogscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/aggregateSlowLog().("mariadb102-with-explain.log", "mariadb102-with-explain.golden", 0, true) |
| 220 | assertscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/JSONEq().(t, expect, got) |
| 221 | } |
| 222 | |
| 223 | func TestSlow026scip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/TestSlow026().(t *testingscip-go gomod github.com/golang/go/src go1.25.4 testing/.Tscip-go gomod github.com/golang/go/src go1.25.4 testing/T#) { |
| 224 | got, expect := aggregateSlowLogscip-go gomod github.com/percona/go-mysql . `github.com/percona/go-mysql/event_test`/aggregateSlowLog().("slow027.log", "slow027.golden", 0, true) |
| 225 | assertscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.10.0 `github.com/stretchr/testify/assert`/JSONEq().(t, expect, got) |
| 226 | } |