Skip to content

Commit

Permalink
Create gearmin server with listener
Browse files Browse the repository at this point in the history
This means now we can create a listener with crypto/tls.
  • Loading branch information
sevein committed May 6, 2024
1 parent c26ee04 commit b15e478
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion hack/ccp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
connectrpc.com/connect v1.16.0
connectrpc.com/grpchealth v1.3.0
connectrpc.com/grpcreflect v1.2.0
github.com/artefactual-labs/gearmin v0.0.0-20240503085057-24b15200761a
github.com/artefactual-labs/gearmin v0.0.0-20240506072626-8c1a583fd630
github.com/doug-martin/goqu/v9 v9.19.0
github.com/elliotchance/orderedmap/v2 v2.2.0
github.com/fsnotify/fsnotify v1.7.0
Expand Down
6 changes: 2 additions & 4 deletions hack/ccp/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ github.com/alecthomas/chroma/v2 v2.13.0 h1:VP72+99Fb2zEcYM0MeaWJmV+xQvz5v5cxRHd+
github.com/alecthomas/chroma/v2 v2.13.0/go.mod h1:BUGjjsD+ndS6eX37YgTchSEG+Jg9Jv1GiZs9sqPqztk=
github.com/armon/go-radix v1.0.1-0.20221118154546-54df44f2176c h1:651/eoCRnQ7YtSjAnSzRucrJz+3iGEFt+ysraELS81M=
github.com/armon/go-radix v1.0.1-0.20221118154546-54df44f2176c/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/artefactual-labs/gearmin v0.0.0-20240503085057-24b15200761a h1:BVog6YUNmBoxv/nGSeoHT2eCTRqtRKh1Uw5ySzihTWc=
github.com/artefactual-labs/gearmin v0.0.0-20240503085057-24b15200761a/go.mod h1:aN5kqGkz5XmmJ/vTm/meKbLS1DezOuSlprnWSIk7gzA=
github.com/artefactual-labs/gearmin v0.0.0-20240506072626-8c1a583fd630 h1:eJfMprHs8o9O6cRbp3O8V92IG3vHsqplH48BkI7WpQo=
github.com/artefactual-labs/gearmin v0.0.0-20240506072626-8c1a583fd630/go.mod h1:C+JaJpQwRvWN3sa2z2jy+ziy7mQuuTIsTiRFJbUBO38=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/bep/clocks v0.5.0 h1:hhvKVGLPQWRVsBP/UB7ErrHYIO42gINVbvqxvYTPVps=
Expand Down Expand Up @@ -253,8 +253,6 @@ github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX
github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw=
github.com/peterbourgon/ff/v3 v3.4.0 h1:QBvM/rizZM1cB0p0lGMdmR7HxZeI/ZrBWB4DqLkMUBc=
github.com/peterbourgon/ff/v3 v3.4.0/go.mod h1:zjJVUhx+twciwfDl0zBcFzl4dW8axCRyXE/eKY9RztQ=
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5 h1:Ii+DKncOVM8Cu1Hc+ETb5K+23HdAMvESYE3ZJ5b5cMI=
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5/go.mod h1:iIss55rKnNBTvrwdmkUpLnDpZoAHvWaiq5+iMmen4AE=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down
7 changes: 3 additions & 4 deletions hack/ccp/internal/controller/submit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,9 @@ func TestSubmitJob(t *testing.T) {
func fakeGearman(t *testing.T) *gearmin.Server {
t.Helper()

srv := gearmin.NewServer(gearmin.Config{ListenAddr: "127.0.0.1:0"})
t.Cleanup(func() {
srv.Stop()
})
srv, err := gearmin.NewServerWithAddr("127.0.0.1:0")
assert.NilError(t, err)
t.Cleanup(func() { srv.Stop() })

return srv
}
9 changes: 6 additions & 3 deletions hack/ccp/internal/servercmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"net"
"path/filepath"
"time"

Expand Down Expand Up @@ -98,9 +99,11 @@ func (s *Server) Run() error {
}

s.logger.V(1).Info("Creating Gearman job server.")
s.gearman = gearmin.NewServer(gearmin.Config{ListenAddr: s.config.gearmin.addr})
if err := s.gearman.Start(); err != nil {
return fmt.Errorf("error creating Gearmin job server: %v", err)
ln, err := net.Listen("tcp", s.config.gearmin.addr)
if err != nil {
return fmt.Errorf("error creating gearmin listener: %v", err)
} else {
s.gearman = gearmin.NewServer(ln)
}

s.logger.V(1).Info("Creating controller.")
Expand Down

0 comments on commit b15e478

Please sign in to comment.