Skip to content

Commit 2ffd833

Browse files
committed
Respect CI env like in other tests
1 parent 19211f4 commit 2ffd833

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

clients/tfchain-client-go/impl_test.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
)
1414

1515
func TestPoolInitialization(t *testing.T) {
16-
urls := []string{"ws://127.0.0.1:9944"}
16+
urls := []string{getUrlBasedOnEnv()}
1717
mgr := NewManager(urls...)
1818
defer mgr.Close()
1919

@@ -28,7 +28,8 @@ func TestPoolInitialization(t *testing.T) {
2828
}
2929

3030
func TestConnectionReuse(t *testing.T) {
31-
mgr := NewManager("ws://127.0.0.1:9944")
31+
urls := []string{getUrlBasedOnEnv()}
32+
mgr := NewManager(urls...)
3233
defer mgr.Close()
3334

3435
// Wait for pool initialization
@@ -59,7 +60,8 @@ func TestConnectionReuse(t *testing.T) {
5960
}
6061

6162
func TestConcurrentAccess(t *testing.T) {
62-
mgr := NewManager("ws://127.0.0.1:9944")
63+
urls := []string{getUrlBasedOnEnv()}
64+
mgr := NewManager(urls...)
6365
defer mgr.Close()
6466

6567
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
@@ -87,7 +89,8 @@ func TestConcurrentAccess(t *testing.T) {
8789
}
8890

8991
func TestFailover(t *testing.T) {
90-
mgr := NewManager("ws://fail1", "ws://127.0.0.1:9944")
92+
urls := []string{"ws://fail1", getUrlBasedOnEnv()}
93+
mgr := NewManager(urls...)
9194
defer mgr.Close()
9295

9396
sub1, err := mgr.GetConnection(context.Background())
@@ -96,12 +99,13 @@ func TestFailover(t *testing.T) {
9699
sub2, err := mgr.GetConnection(context.Background())
97100
require.NoError(t, err)
98101
defer sub2.Release()
99-
assert.Equal(t, sub1.conn.url, "ws://127.0.0.1:9944")
100-
assert.Equal(t, sub2.conn.url, "ws://127.0.0.1:9944")
102+
assert.Equal(t, sub1.conn.url, urls[1])
103+
assert.Equal(t, sub2.conn.url, urls[1])
101104
}
102105

103106
func TestHealthChecking(t *testing.T) {
104-
mgr := NewManager("ws://127.0.0.1:9944")
107+
urls := []string{getUrlBasedOnEnv()}
108+
mgr := NewManager(urls...)
105109
defer mgr.Close()
106110

107111
sub, err := mgr.GetConnection(context.Background())
@@ -131,7 +135,8 @@ func TestStressWithFailures(t *testing.T) {
131135
ConnectionTimeout: time.Second,
132136
}
133137

134-
mgr := NewManagerWithConfig(config, "ws://127.0.0.1:9944")
138+
urls := []string{getUrlBasedOnEnv()}
139+
mgr := NewManagerWithConfig(config, urls...)
135140
defer mgr.Close()
136141

137142
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)

0 commit comments

Comments
 (0)