Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Up Go Version #309

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ addons:
- libczmq-dev

go:
- 1.12.6
- 1.21.7
script:
- go get -t -v ./...
- go test -v .
57 changes: 15 additions & 42 deletions auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package goczmq
import (
"bufio"
"fmt"
"github.com/stretchr/testify/require"
"os"
"path"
"testing"
Expand Down Expand Up @@ -326,18 +327,14 @@ func TestAuthCurveAllowAny(t *testing.T) {
func TestAuthCurveAllowCertificate(t *testing.T) {
testpath := path.Join("testauth")
err := os.Mkdir(testpath, 0777)
if err != nil {
t.Error(err)
}
require.NoError(t, err)

auth := NewAuth()
defer auth.Destroy()

if testing.Verbose() {
err = auth.Verbose()
if err != nil {
t.Error(err)
}
require.NoError(t, err)
}

server := NewSock(Pull, SockSetZapDomain("global"))
Expand All @@ -355,9 +352,7 @@ func TestAuthCurveAllowCertificate(t *testing.T) {

certfile := path.Join("testauth", "goodClient.txt")
err = goodClientCert.SavePublic(certfile)
if err != nil {
t.Error(err)
}
require.NoError(t, err)

badClient := NewSock(Push, SockSetCurveServerkey(serverKey))
defer badClient.Destroy()
Expand All @@ -366,70 +361,48 @@ func TestAuthCurveAllowCertificate(t *testing.T) {
badClientCert.Apply(badClient)

err = auth.Curve(testpath)
if err != nil {
t.Error(err)
}
require.NoError(t, err)

port, err := server.Bind("tcp://127.0.0.1:*")
if err != nil {
t.Error(err)
}
require.NoError(t, err)

err = goodClient.Connect(fmt.Sprintf("tcp://127.0.0.1:%d", port))
if err != nil {
t.Error(err)
}
require.NoError(t, err)

err = badClient.Connect(fmt.Sprintf("tcp://127.0.0.1:%d", port))
if err != nil {
t.Error(err)
}
require.NoError(t, err)

err = goodClient.SendFrame([]byte("Hello, Good World!"), 0)
if err != nil {
t.Error(err)
}
require.NoError(t, err)

poller, err := NewPoller(server)
if err != nil {
t.Error(err)
}
require.NoError(t, err)
defer poller.Destroy()

s, err := poller.Wait(200)
if err != nil {
t.Error(err)
}
require.NoError(t, err)
if want, have := server, s; want != have {
t.Errorf("want '%#v', have '%#v'", want, have)
}

msg, err := s.RecvMessage()
if err != nil {
t.Error(err)
}
require.NoError(t, err)

if want, have := "Hello, Good World!", string(msg[0]); want != have {
t.Errorf("want '%#v', have '%#v'", want, have)
}

err = badClient.SendFrame([]byte("Hello, Bad World"), 0)
if err != nil {
t.Error(err)
}
require.NoError(t, err)

s, err = poller.Wait(200)
if err != nil {
t.Error(err)
}
require.NoError(t, err)
if s != nil {
t.Errorf("want '%#v', have '%#v", nil, s)
}

err = os.RemoveAll(testpath)
if err != nil {
t.Error(err)
}
require.NoError(t, err)
}

func ExampleAuth() {
Expand Down
21 changes: 6 additions & 15 deletions beacon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package goczmq

import (
"fmt"
"github.com/stretchr/testify/require"
"testing"
)

Expand All @@ -18,33 +19,23 @@ func TestBeacon(t *testing.T) {
}

_, err = speaker.Configure(9999)
if err != nil {
t.Error(err)
}
require.NoError(t, err)

listener := NewBeacon()

if testing.Verbose() {
err = listener.Verbose()
if err != nil {
t.Error(err)
}
require.NoError(t, err)
}

_, err = listener.Configure(9999)
if err != nil {
t.Error(err)
}
require.NoError(t, err)

err = listener.Subscribe("HI")
if err != nil {
t.Error(err)
}
require.NoError(t, err)

err = speaker.Publish("HI", 100)
if err != nil {
t.Error(err)
}
require.NoError(t, err)

msg := listener.Recv(500)
if len(msg) == 2 {
Expand Down
17 changes: 5 additions & 12 deletions cert_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package goczmq

import (
"github.com/stretchr/testify/require"
"os"
"testing"
)
Expand Down Expand Up @@ -47,14 +48,10 @@ func TestCert(t *testing.T) {
}

err := cert.Save("./test_cert")
if err != nil {
t.Error(err)
}
require.NoError(t, err)

loaded, err := NewCertFromFile("./test_cert")
if err != nil {
t.Error(err)
}
require.NoError(t, err)
defer loaded.Destroy()

if want, have := true, loaded.Equal(cert); want != have {
Expand All @@ -66,14 +63,10 @@ func TestCert(t *testing.T) {
}

err = os.Remove("./test_cert")
if err != nil {
t.Error(err)
}
require.NoError(t, err)

err = os.Remove("./test_cert_secret")
if err != nil {
t.Error(err)
}
require.NoError(t, err)
}

func TestNewCertFromFile(t *testing.T) {
Expand Down
9 changes: 3 additions & 6 deletions certstore_test.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package goczmq

import (
"github.com/stretchr/testify/require"
"os"
"testing"
)

func TestCertStore(t *testing.T) {
testDir := ".test_zcertstore"
err := os.Mkdir(testDir, 0777)
if err != nil {
t.Error(err)
}
require.NoError(t, err)

certstore := NewCertStore(testDir)
defer certstore.Destroy()
Expand All @@ -29,9 +28,7 @@ func TestCertStore(t *testing.T) {
client1Key := client1.PublicText()

err = client1.Save(testDir + "/mycert.txt")
if err != nil {
t.Error(err)
}
require.NoError(t, err)

client1.Destroy()

Expand Down
2 changes: 1 addition & 1 deletion cmd/perf/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/zeromq/goczmq/v4/cmd/perf

go 1.12
go 1.21

replace github.com/zeromq/goczmq/v4 => ../../

Expand Down
16 changes: 16 additions & 0 deletions cmd/perf/go.sum
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/nofeaturesonlybugs/errors v1.1.1/go.mod h1:nduBPri47dRYPSfaHxuboF0/Z2835DHp4qw9mtz8WeI=
github.com/nofeaturesonlybugs/z85 v1.0.2/go.mod h1:ZPmpZx9dP1tlJ1dUkosEOvlLXXChbE6+QwCjXzzU0Fo=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tilinna/z85 v1.0.0/go.mod h1:EfpFU/DUY4ddEy6CRvk2l+UQNEzHbh+bqBQS+04Nkxs=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
12 changes: 10 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
module github.com/zeromq/goczmq/v4

go 1.12
go 1.21

require github.com/tilinna/z85 v1.0.0
require github.com/nofeaturesonlybugs/z85 v1.0.2

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/nofeaturesonlybugs/errors v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v1.9.0
gopkg.in/yaml.v3 v3.0.1 // indirect
)
16 changes: 14 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
github.com/tilinna/z85 v1.0.0 h1:uqFnJBlD01dosSeo5sK1G1YGbPuwqVHqR+12OJDRjUw=
github.com/tilinna/z85 v1.0.0/go.mod h1:EfpFU/DUY4ddEy6CRvk2l+UQNEzHbh+bqBQS+04Nkxs=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/nofeaturesonlybugs/errors v1.1.1 h1:hB+r5k391E9p/RwXYfLbkzmyzM+U4QLLe+Kt4SXa3uQ=
github.com/nofeaturesonlybugs/errors v1.1.1/go.mod h1:nduBPri47dRYPSfaHxuboF0/Z2835DHp4qw9mtz8WeI=
github.com/nofeaturesonlybugs/z85 v1.0.2 h1:aIWIDO4qMRxfnqkL1FHQhzcEn2X7v7/ogwH5mwMi+e0=
github.com/nofeaturesonlybugs/z85 v1.0.2/go.mod h1:ZPmpZx9dP1tlJ1dUkosEOvlLXXChbE6+QwCjXzzU0Fo=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Loading