Set read deadline correctly

This commit is contained in:
2023-02-25 22:30:31 +01:00
parent ebdbc92693
commit 8c33fd2a89
2 changed files with 9 additions and 6 deletions

View File

@@ -8,7 +8,7 @@ import (
)
func TestReadOneRegisterKeepAlive(t *testing.T) {
c, err := New("IAM_248000012514.solver.nu:502", 1, 100*time.Millisecond)
c, err := New("IAM_248000012514.solver.nu:502", 1, 100*time.Millisecond, 5*time.Second)
t.Log("Connect")
assert.NoError(t, err)
for n := 0; n < 5; n++ {
@@ -36,7 +36,7 @@ func TestReadOneRegisterKeepAlive(t *testing.T) {
}
func TestReadOneRegisterShortKeepAlive(t *testing.T) {
c, err := New("IAM_248000012514.solver.nu:502", 1, 10*time.Nanosecond)
c, err := New("IAM_248000012514.solver.nu:502", 1, 10*time.Nanosecond, 5*time.Second)
t.Log("Connect")
assert.NoError(t, err)
for n := 0; n < 5; n++ {
@@ -68,7 +68,7 @@ func TestReadOneRegisterShortKeepAlive(t *testing.T) {
}
func TestReadALot(t *testing.T) {
c, err := New("IAM_248000012514.solver.nu:502", 1, 100*time.Millisecond)
c, err := New("IAM_248000012514.solver.nu:502", 1, 100*time.Millisecond, 5*time.Second)
t.Log("Connect")
assert.NoError(t, err)
for n := 0; n < 500; n++ {