Skip to content

Commit

Permalink
Fixed : sdo block test should work properly, also increased speed by …
Browse files Browse the repository at this point in the history
…changing client processing period
  • Loading branch information
samsamfire committed Jan 16, 2025
1 parent 8125696 commit e172502
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/network/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,22 @@ func TestClientBlock(t *testing.T) {
node.GetOD().AddFile(0x3333, "File entry", file.Name(), os.O_RDWR|os.O_CREATE, os.O_RDWR|os.O_CREATE)
assert.Nil(t, err)

w, err := network2.SDOClient.NewRawWriter(NodeIdTest, 0x3333, 0, true, 0)
assert.Nil(t, err)

t.Run("small block", func(t *testing.T) {
data := []byte(`some random string some random string some random
string some random string some random
string some random string some random string`)
w, err := network2.SDOClient.NewRawWriter(NodeIdTest, 0x3333, 0, true, 0)
assert.Nil(t, err)
n, err := w.Write(data)
assert.Nil(t, err)
assert.EqualValues(t, len(data), n)
})

t.Run("big block", func(t *testing.T) {
data := make([]byte, 10_000)
network2.SDOClient.SetProcessingPeriod(100)
w, err := network2.SDOClient.NewRawWriter(NodeIdTest, 0x3333, 0, true, 10_000)

assert.Nil(t, err)
n, err := w.Write(data)
assert.Nil(t, err)
Expand All @@ -104,6 +105,8 @@ func TestClientBlock(t *testing.T) {
data := []byte(`some random string some random string some random
string some random string some random
string some random string some random string`)
w, err := network2.SDOClient.NewRawWriter(NodeIdTest, 0x3333, 0, true, 0)
assert.Nil(t, err)
n, err := w.Write(data)
assert.Nil(t, err)
assert.EqualValues(t, len(data), n)
Expand Down

0 comments on commit e172502

Please sign in to comment.