Skip to content

Commit

Permalink
Merge pull request #5790 from planetscale/tal_merge_sharding
Browse files Browse the repository at this point in the history
Merge Sharding tests in Go migrated from Python
  • Loading branch information
deepthi authored Feb 6, 2020
2 parents c0c927a + 85410f1 commit ebe6d45
Show file tree
Hide file tree
Showing 6 changed files with 725 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cluster_endtoend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
name: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
name: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22]

steps:
- name: Set up Go
Expand Down
8 changes: 4 additions & 4 deletions go/test/endtoend/sharding/base_sharding.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,16 @@ func CheckBinlogPlayerVars(t *testing.T, vttablet cluster.Vttablet, sourceShards
replicationSourceObj := reflect.ValueOf(tabletVars["VReplicationSource"])
replicationSourceValue := []string{}

assert.Equal(t,
fmt.Sprintf("%v", replicationSourceObj.MapKeys()),
fmt.Sprintf("%v", reflect.ValueOf(tabletVars["VReplicationSourceTablet"]).MapKeys()))
assert.Equal(t, len(replicationSourceObj.MapKeys()), len(reflect.ValueOf(tabletVars["VReplicationSourceTablet"]).MapKeys()))

for _, key := range replicationSourceObj.MapKeys() {
replicationSourceValue = append(replicationSourceValue,
fmt.Sprintf("%v", replicationSourceObj.MapIndex(key)))
}

assert.True(t, reflect.DeepEqual(replicationSourceValue, sourceShards))
for _, shard := range sourceShards {
assert.Containsf(t, replicationSourceValue, shard, "Source shard is not matched with vReplication shard value")
}

if secondBehindMaster != 0 {
secondBehindMaserMaxStr := fmt.Sprintf("%v", reflect.ValueOf(tabletVars["VReplicationSecondsBehindMasterMax"]))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
Copyright 2019 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 v3

import (
"testing"

sharding "vitess.io/vitess/go/test/endtoend/sharding/mergesharding"
)

// TestMergeShardingIntShardingKey - tests merge sharding using a INT column
func TestMergeShardingIntShardingKey(t *testing.T) {
sharding.TestMergesharding(t, false /* useVarbinaryShardingKeyType */)

}
Loading

0 comments on commit ebe6d45

Please sign in to comment.