Exemplo n.º 1
0
func TestKeyspaceNodesTabletTypes(t *testing.T) {
	input := KeyspaceNodes{
		ShardNodes: []*ShardNodes{
			&ShardNodes{
				TabletNodes: []*TabletNodesByType{
					&TabletNodesByType{
						TabletType: pb.TabletType_REPLICA,
					},
				},
			},
			&ShardNodes{
				TabletNodes: []*TabletNodesByType{
					&TabletNodesByType{
						TabletType: pb.TabletType_MASTER,
					},
					&TabletNodesByType{
						TabletType: pb.TabletType_REPLICA,
					},
				},
			},
		},
	}
	want := topo.MakeStringTypeList([]pb.TabletType{pb.TabletType_REPLICA, pb.TabletType_MASTER})
	got := topo.MakeStringTypeList(input.TabletTypes())
	if !reflect.DeepEqual(got, want) {
		t.Errorf("KeyspaceNodes.TabletTypes() = %v, want %v", got, want)
	}
}
Exemplo n.º 2
0
func TestKeyspaceNodesTabletTypes(t *testing.T) {
	input := KeyspaceNodes{
		ShardNodes: []*ShardNodes{
			&ShardNodes{TabletNodes: TabletNodesByType{topo.TYPE_REPLICA: nil}},
			&ShardNodes{TabletNodes: TabletNodesByType{topo.TYPE_MASTER: nil, topo.TYPE_REPLICA: nil}},
		},
	}
	want := topo.MakeStringTypeList([]topo.TabletType{topo.TYPE_REPLICA, topo.TYPE_MASTER})
	got := topo.MakeStringTypeList(input.TabletTypes())
	if !reflect.DeepEqual(got, want) {
		t.Errorf("KeyspaceNodes.TabletTypes() = %v, want %v", got, want)
	}
}