|
15 | 15 | package registry
|
16 | 16 |
|
17 | 17 | import (
|
| 18 | + "github.com/cloudwego-contrib/cwgo-pkg/registry/servicecomb/options" |
18 | 19 | "net"
|
19 | 20 | "testing"
|
20 |
| - "time" |
21 |
| - |
22 |
| - "github.com/cloudwego-contrib/cwgo-pkg/registry/servicecomb/options" |
23 | 21 |
|
24 | 22 | "github.com/go-chassis/sc-client"
|
25 | 23 |
|
@@ -130,41 +128,3 @@ func TestSCRegistryDeregister(t *testing.T) {
|
130 | 128 | })
|
131 | 129 | }
|
132 | 130 | }
|
133 |
| - |
134 |
| -// test register several instances and deregister |
135 |
| -func TestSCMultipleInstances(t *testing.T) { |
136 |
| - client, err := getSCClient() |
137 |
| - assert.Nil(t, err) |
138 |
| - time.Sleep(time.Second) |
139 |
| - got := NewSCRegistry(client, options.WithAppId(AppId), options.WithVersionRule(Version), options.WithHostName(HostName), options.WithHeartbeatInterval(5)) |
140 |
| - if !assert.NotNil(t, got) { |
141 |
| - t.Errorf("err: new registry fail") |
142 |
| - return |
143 |
| - } |
144 |
| - time.Sleep(time.Second) |
145 |
| - |
146 |
| - err = got.Register(®istry.Info{ |
147 |
| - ServiceName: ServiceName, |
148 |
| - Addr: &net.TCPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 8081}, |
149 |
| - }) |
150 |
| - assert.Nil(t, err) |
151 |
| - err = got.Register(®istry.Info{ |
152 |
| - ServiceName: ServiceName, |
153 |
| - Addr: &net.TCPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 8082}, |
154 |
| - }) |
155 |
| - assert.Nil(t, err) |
156 |
| - err = got.Register(®istry.Info{ |
157 |
| - ServiceName: ServiceName, |
158 |
| - Addr: &net.TCPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 8083}, |
159 |
| - }) |
160 |
| - assert.Nil(t, err) |
161 |
| - |
162 |
| - time.Sleep(5 * time.Second) |
163 |
| - err = got.Deregister(®istry.Info{ |
164 |
| - ServiceName: ServiceName, |
165 |
| - Addr: &net.TCPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 8083}, |
166 |
| - }) |
167 |
| - assert.Nil(t, err) |
168 |
| - _, err = client.FindMicroServiceInstances("", AppId, ServiceName, LatestVersion, sc.WithoutRevision()) |
169 |
| - assert.Nil(t, err) |
170 |
| -} |
0 commit comments