@@ -18,9 +18,7 @@ import (
18
18
const (
19
19
errFailedDecrypt = "could not decrypt bytes with viewing key"
20
20
dummyParams = "dummyParams"
21
- jsonKeyTopics = "topics"
22
21
_hostWSPort = integration .StartPortWalletExtensionUnitTest
23
- _testOffset = 100 // offset each test by a multiplier of the offset to avoid port colision. ie: hostPort := _hostWSPort + _testOffset*2
24
22
)
25
23
26
24
type testHelper struct {
@@ -41,14 +39,13 @@ func TestWalletExtension(t *testing.T) {
41
39
"canRegisterViewingKeyAndMakeRequestsOverWebsockets" : canRegisterViewingKeyAndMakeRequestsOverWebsockets ,
42
40
} {
43
41
t .Run (name , func (t * testing.T ) {
44
- hostPort := _hostWSPort + i * _testOffset
45
- dummyAPI , shutDownHost := createDummyHost (t , hostPort )
46
- shutdownWallet := createWalExt (t , createWalExtCfg (hostPort , hostPort + 1 , hostPort + 2 ))
42
+ dummyAPI , shutDownHost := createDummyHost (t , _hostWSPort )
43
+ shutdownWallet := createWalExt (t , createWalExtCfg (_hostWSPort , _hostWSPort + 1 , _hostWSPort + 2 ))
47
44
48
45
h := & testHelper {
49
- hostPort : hostPort ,
50
- walletHTTPPort : hostPort + 1 ,
51
- walletWSPort : hostPort + 2 ,
46
+ hostPort : _hostWSPort ,
47
+ walletHTTPPort : _hostWSPort + 1 ,
48
+ walletWSPort : _hostWSPort + 2 ,
52
49
hostAPI : dummyAPI ,
53
50
}
54
51
@@ -173,14 +170,13 @@ func canRegisterViewingKeyAndMakeRequestsOverWebsockets(t *testing.T, testHelper
173
170
}
174
171
175
172
func TestCannotInvokeSensitiveMethodsWithoutViewingKey (t * testing.T ) {
176
- hostPort := _hostWSPort + _testOffset * 7
177
- walletHTTPPort := hostPort + 1
178
- walletWSPort := hostPort + 2
173
+ walletHTTPPort := _hostWSPort + 1
174
+ walletWSPort := _hostWSPort + 2
179
175
180
- _ , shutdownHost := createDummyHost (t , hostPort )
176
+ _ , shutdownHost := createDummyHost (t , _hostWSPort )
181
177
defer shutdownHost () //nolint: errcheck
182
178
183
- shutdownWallet := createWalExt (t , createWalExtCfg (hostPort , walletHTTPPort , walletWSPort ))
179
+ shutdownWallet := createWalExt (t , createWalExtCfg (_hostWSPort , walletHTTPPort , walletWSPort ))
184
180
defer shutdownWallet () //nolint: errcheck
185
181
186
182
conn , err := openWSConn (walletWSPort )
@@ -202,13 +198,12 @@ func TestCannotInvokeSensitiveMethodsWithoutViewingKey(t *testing.T) {
202
198
}
203
199
204
200
func TestKeysAreReloadedWhenWalletExtensionRestarts (t * testing.T ) {
205
- hostPort := _hostWSPort + _testOffset * 8
206
- walletHTTPPort := hostPort + 1
207
- walletWSPort := hostPort + 2
201
+ walletHTTPPort := _hostWSPort + 1
202
+ walletWSPort := _hostWSPort + 2
208
203
209
- dummyAPI , shutdownHost := createDummyHost (t , hostPort )
204
+ dummyAPI , shutdownHost := createDummyHost (t , _hostWSPort )
210
205
defer shutdownHost () //nolint: errcheck
211
- walExtCfg := createWalExtCfg (hostPort , walletHTTPPort , walletWSPort )
206
+ walExtCfg := createWalExtCfg (_hostWSPort , walletHTTPPort , walletWSPort )
212
207
shutdownWallet := createWalExt (t , walExtCfg )
213
208
214
209
addr , viewingKeyBytes , signature := simulateViewingKeyRegister (t , walletHTTPPort , walletWSPort , false )
@@ -278,13 +273,12 @@ func TestKeysAreReloadedWhenWalletExtensionRestarts(t *testing.T) {
278
273
//}
279
274
280
275
func TestGetStorageAtForReturningUserID (t * testing.T ) {
281
- hostPort := _hostWSPort + _testOffset * 8
282
- walletHTTPPort := hostPort + 1
283
- walletWSPort := hostPort + 2
276
+ walletHTTPPort := _hostWSPort + 1
277
+ walletWSPort := _hostWSPort + 2
284
278
285
- createDummyHost (t , hostPort )
286
- walExtCfg := createWalExtCfg (hostPort , walletHTTPPort , walletWSPort )
287
- createWalExtCfg (hostPort , walletHTTPPort , walletWSPort )
279
+ createDummyHost (t , _hostWSPort )
280
+ walExtCfg := createWalExtCfg (_hostWSPort , walletHTTPPort , walletWSPort )
281
+ createWalExtCfg (_hostWSPort , walletHTTPPort , walletWSPort )
288
282
createWalExt (t , walExtCfg )
289
283
290
284
// create userID
0 commit comments