@@ -75,7 +75,7 @@ func TestHttpResolverWithGet(t *testing.T) {
7575 resolver .Resolve ()
7676
7777 // check snapshot saved
78- filePath := resolver .getSnapshotFilePath ("DEFAULT" )
78+ filePath := resolver .getSnapshotFilePath ()
7979 body := strings .Join (srvs , ";" )
8080 bs , _ := ioutil .ReadFile (filePath )
8181 So (string (bs ), ShouldEqual , body )
@@ -112,7 +112,7 @@ func TestHttpResolverWithGetUnitName(t *testing.T) {
112112 resolver .Resolve ()
113113
114114 // check snapshot saved
115- filePath := resolver .getSnapshotFilePath ("DEFAULT" )
115+ filePath := resolver .getSnapshotFilePath ()
116116 body := strings .Join (srvs , ";" )
117117 bs , _ := ioutil .ReadFile (filePath )
118118 So (string (bs ), ShouldEqual , body )
@@ -133,7 +133,7 @@ func TestHttpResolverWithSnapshotFile(t *testing.T) {
133133
134134 os .Setenv ("NAMESRV_ADDR" , "" ) // clear env
135135 // setup local snapshot file
136- filePath := resolver .getSnapshotFilePath ("DEFAULT" )
136+ filePath := resolver .getSnapshotFilePath ()
137137 body := strings .Join (srvs , ";" )
138138 _ = ioutil .WriteFile (filePath , []byte (body ), 0644 )
139139
@@ -143,7 +143,7 @@ func TestHttpResolverWithSnapshotFile(t *testing.T) {
143143 })
144144}
145145
146- func TesHttpReslverWithSnapshotFileOnce (t * testing.T ) {
146+ func TestHttpResolverWithSnapshotFileOnce (t * testing.T ) {
147147 Convey ("Test UpdateNameServerAddress Load Local Snapshot Once" , t , func () {
148148 srvs := []string {
149149 "192.168.100.1" ,
@@ -157,18 +157,18 @@ func TesHttpReslverWithSnapshotFileOnce(t *testing.T) {
157157
158158 os .Setenv ("NAMESRV_ADDR" , "" ) // clear env
159159 // setup local snapshot file
160- filePath := resolver .getSnapshotFilePath ("DEFAULT" )
160+ filePath := resolver .getSnapshotFilePath ()
161161 body := strings .Join (srvs , ";" )
162162 _ = ioutil .WriteFile (filePath , []byte (body ), 0644 )
163163 // load local snapshot file first time
164164 addrs1 := resolver .Resolve ()
165165
166- // change the local snapshot file to check load once
166+ // change the local snapshot file
167167 _ = ioutil .WriteFile (filePath , []byte ("127.0.0.1;127.0.0.2" ), 0644 )
168168
169169 addrs2 := resolver .Resolve ()
170170
171- So (Diff (addrs1 , addrs2 ), ShouldBeFalse )
171+ So (Diff (addrs1 , addrs2 ), ShouldBeTrue )
172172 So (Diff (addrs1 , srvs ), ShouldBeFalse )
173173 })
174174}
0 commit comments