Skip to content

Commit

Permalink
Respect CI env like in other tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sameh-farouk committed Nov 17, 2024
1 parent 19211f4 commit 2ffd833
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions clients/tfchain-client-go/impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

func TestPoolInitialization(t *testing.T) {
urls := []string{"ws://127.0.0.1:9944"}
urls := []string{getUrlBasedOnEnv()}

Check failure on line 16 in clients/tfchain-client-go/impl_test.go

View workflow job for this annotation

GitHub Actions / lint

undefined: getUrlBasedOnEnv (typecheck)
mgr := NewManager(urls...)
defer mgr.Close()

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

func TestConnectionReuse(t *testing.T) {
mgr := NewManager("ws://127.0.0.1:9944")
urls := []string{getUrlBasedOnEnv()}

Check failure on line 31 in clients/tfchain-client-go/impl_test.go

View workflow job for this annotation

GitHub Actions / lint

undefined: getUrlBasedOnEnv (typecheck)
mgr := NewManager(urls...)
defer mgr.Close()

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

func TestConcurrentAccess(t *testing.T) {
mgr := NewManager("ws://127.0.0.1:9944")
urls := []string{getUrlBasedOnEnv()}

Check failure on line 63 in clients/tfchain-client-go/impl_test.go

View workflow job for this annotation

GitHub Actions / lint

undefined: getUrlBasedOnEnv (typecheck)
mgr := NewManager(urls...)
defer mgr.Close()

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

func TestFailover(t *testing.T) {
mgr := NewManager("ws://fail1", "ws://127.0.0.1:9944")
urls := []string{"ws://fail1", getUrlBasedOnEnv()}
mgr := NewManager(urls...)
defer mgr.Close()

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

func TestHealthChecking(t *testing.T) {
mgr := NewManager("ws://127.0.0.1:9944")
urls := []string{getUrlBasedOnEnv()}
mgr := NewManager(urls...)
defer mgr.Close()

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

mgr := NewManagerWithConfig(config, "ws://127.0.0.1:9944")
urls := []string{getUrlBasedOnEnv()}
mgr := NewManagerWithConfig(config, urls...)
defer mgr.Close()

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

0 comments on commit 2ffd833

Please sign in to comment.