oceanbase
42 строки · 1.1 Кб
1/**
2* Copyright (c) 2021 OceanBase
3* OceanBase CE is licensed under Mulan PubL v2.
4* You can use this software according to the terms and conditions of the Mulan PubL v2.
5* You may obtain a copy of Mulan PubL v2 at:
6* http://license.coscl.org.cn/MulanPubL-2.0
7* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10* See the Mulan PubL v2 for more details.
11*/
12
13package model
14
15import (
16"github.com/stretchr/testify/require"
17"testing"
18)
19
20type Service struct {
21Address string `json:"address"`
22}
23
24func TestFillObRegion(t *testing.T) {
25info := &ObRootServiceInfo{
26ObCluster: "helloworld",
27ObClusterId: 1,
28}
29info.Fill()
30require.Equal(t, int64(1), info.ObRegionId)
31require.Equal(t, "helloworld", info.ObRegion)
32}
33
34func TestFillObCluster(t *testing.T) {
35info := &ObRootServiceInfo{
36ObRegion: "helloworld",
37ObRegionId: 1,
38}
39info.Fill()
40require.Equal(t, int64(1), info.ObClusterId)
41require.Equal(t, "helloworld", info.ObCluster)
42}
43