@@ -10,7 +10,6 @@ import (
10
10
"time"
11
11
12
12
"github.com/DoNewsCode/core/config"
13
- "github.com/DoNewsCode/core/config/remote"
14
13
"github.com/DoNewsCode/core/contract"
15
14
"github.com/DoNewsCode/core/di"
16
15
"github.com/DoNewsCode/core/events"
@@ -135,14 +134,14 @@ func TestC_Remote(t *testing.T) {
135
134
addr := os .Getenv ("ETCD_ADDR" )
136
135
if addr == "" {
137
136
t .Skip ("set ETCD_ADDR for run remote test" )
137
+ return
138
138
}
139
139
key := "core.yaml"
140
140
envEtcdAddrs := strings .Split (addr , "," )
141
141
cfg := clientv3.Config {
142
142
Endpoints : envEtcdAddrs ,
143
143
DialTimeout : 2 * time .Second ,
144
144
}
145
- _ = remote .Provider (key , & cfg )
146
145
if err := put (cfg , key , "name: remote" ); err != nil {
147
146
t .Fatal (err )
148
147
}
@@ -210,9 +209,14 @@ func put(cfg clientv3.Config, key, val string) error {
210
209
}
211
210
defer client .Close ()
212
211
213
- _ , err = client .Put (context .Background (), key , val )
214
- if err != nil {
215
- return err
212
+ ctx , cancel := context .WithTimeout (context .Background (), time .Second )
213
+ defer cancel ()
214
+
215
+ for i := 0 ; i < 2 ; i ++ {
216
+ _ , err = client .Put (ctx , key , val )
217
+ if err != nil {
218
+ continue
219
+ }
216
220
}
217
- return nil
221
+ return err
218
222
}
0 commit comments