Skip to content

Commit

Permalink
Revert "Use goakt testing framework (#478)"
Browse files Browse the repository at this point in the history
This reverts commit b0115bf.
Additional tests have added flake for unknown reason
  • Loading branch information
jordan-rash committed Jan 6, 2025
1 parent b0115bf commit ff933c4
Show file tree
Hide file tree
Showing 15 changed files with 350 additions and 539 deletions.
5 changes: 5 additions & 0 deletions api/nodecontrol/auction-response.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"type": "string",
"description": "A one-time identifier used to target deployments"
},
"nexus": {
"type": "string",
"description": "The name of the nexus"
},
"version": {
"type": "string",
"description": "The version of the node"
Expand Down Expand Up @@ -46,6 +50,7 @@
},
"required": [
"bidder_id",
"nexus",
"version",
"uptime",
"target_xkey",
Expand Down
6 changes: 6 additions & 0 deletions api/nodecontrol/gen/auction_response.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions cmd/nex/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ require (
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/charmbracelet/lipgloss v1.0.0 // indirect
github.com/charmbracelet/x/ansi v0.6.0 // indirect
github.com/deckarep/golang-set/v2 v2.7.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/flowchartsman/retry v1.2.0 // indirect
Expand Down Expand Up @@ -65,7 +64,7 @@ require (
github.com/tidwall/btree v1.7.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/redcon v1.6.2 // indirect
github.com/tochemey/goakt/v2 v2.11.0 // indirect
github.com/tochemey/goakt/v2 v2.10.2 // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
Expand All @@ -80,6 +79,6 @@ require (
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.8.0 // indirect
golang.org/x/tools v0.28.0 // indirect
google.golang.org/protobuf v1.36.1 // indirect
google.golang.org/protobuf v1.36.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
10 changes: 4 additions & 6 deletions cmd/nex/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-xdr v0.0.0-20161123171359-e6a2ba005892/go.mod h1:CTDl0pzVzE5DEzZhPfvhY/9sPFMQIxaJ9VAMs9AagrE=
github.com/dchest/siphash v1.2.3/go.mod h1:0NvQU092bT0ipiFN++/rXm69QG9tVxLAlQHIXMPAkHc=
github.com/deckarep/golang-set/v2 v2.7.0 h1:gIloKvD7yH2oip4VLhsv3JyLLFnC0Y2mlusgcvJYW5k=
github.com/deckarep/golang-set/v2 v2.7.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
github.com/dgryski/go-ddmin v0.0.0-20210904190556-96a6d69f1034/go.mod h1:zz4KxBkcXUWKjIcrc+uphJ1gPh/t18ymGm3PmQ+VGTk=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
Expand Down Expand Up @@ -266,8 +264,8 @@ github.com/tidwall/redcon v1.6.2 h1:5qfvrrybgtO85jnhSravmkZyC0D+7WstbfCs3MmPhow=
github.com/tidwall/redcon v1.6.2/go.mod h1:p5Wbsgeyi2VSTBWOcA5vRXrOb9arFTcU2+ZzFjqV75Y=
github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg=
github.com/tinylib/msgp v1.1.8/go.mod h1:qkpG+2ldGg4xRFmx+jfTvZPxfGFhi64BcnL9vkCm/Tw=
github.com/tochemey/goakt/v2 v2.11.0 h1:4reuqeN8mvsUWu9ecn3Vd+qtpTASj/kEI9W3FRYHofM=
github.com/tochemey/goakt/v2 v2.11.0/go.mod h1:gMba2xHDzLSDojw5m1SPHDzVFgNWn1I6G9zoagym5e0=
github.com/tochemey/goakt/v2 v2.10.2 h1:ZR/bqT71sg4jYg+JG2xLPcPX3EH1heOEie3OU5N1nt4=
github.com/tochemey/goakt/v2 v2.10.2/go.mod h1:53SxOqOoPLkg3QxPKShGhmkpUT2JOGAl9hPMIZ+kD1o=
github.com/travisjeffery/go-dynaport v1.0.0 h1:m/qqf5AHgB96CMMSworIPyo1i7NZueRsnwdzdCJ8Ajw=
github.com/travisjeffery/go-dynaport v1.0.0/go.mod h1:0LHuDS4QAx+mAc4ri3WkQdavgVoBIZ7cE9ob17KIAJk=
github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q=
Expand Down Expand Up @@ -432,8 +430,8 @@ google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCID
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk=
google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.0 h1:mjIs9gYtt56AzC4ZaffQuh88TZurBGhIJMBZGSxNerQ=
google.golang.org/protobuf v1.36.0/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ require (
github.com/nats-io/nuid v1.0.1
github.com/opencontainers/image-spec v1.1.0
github.com/stretchr/testify v1.10.0
github.com/tochemey/goakt/v2 v2.11.0
github.com/tochemey/goakt/v2 v2.10.2
golang.org/x/sys v0.28.0
google.golang.org/protobuf v1.36.1
google.golang.org/protobuf v1.36.0
oras.land/oras-go/v2 v2.5.0
)

Expand All @@ -30,7 +30,6 @@ require (
github.com/charmbracelet/lipgloss v1.0.0 // indirect
github.com/charmbracelet/x/ansi v0.6.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/deckarep/golang-set/v2 v2.7.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/flowchartsman/retry v1.2.0 // indirect
github.com/google/btree v1.1.3 // indirect
Expand Down
10 changes: 4 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-xdr v0.0.0-20161123171359-e6a2ba005892/go.mod h1:CTDl0pzVzE5DEzZhPfvhY/9sPFMQIxaJ9VAMs9AagrE=
github.com/dchest/siphash v1.2.3/go.mod h1:0NvQU092bT0ipiFN++/rXm69QG9tVxLAlQHIXMPAkHc=
github.com/deckarep/golang-set/v2 v2.7.0 h1:gIloKvD7yH2oip4VLhsv3JyLLFnC0Y2mlusgcvJYW5k=
github.com/deckarep/golang-set/v2 v2.7.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
github.com/dgryski/go-ddmin v0.0.0-20210904190556-96a6d69f1034/go.mod h1:zz4KxBkcXUWKjIcrc+uphJ1gPh/t18ymGm3PmQ+VGTk=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
Expand Down Expand Up @@ -250,8 +248,8 @@ github.com/tidwall/redcon v1.6.2 h1:5qfvrrybgtO85jnhSravmkZyC0D+7WstbfCs3MmPhow=
github.com/tidwall/redcon v1.6.2/go.mod h1:p5Wbsgeyi2VSTBWOcA5vRXrOb9arFTcU2+ZzFjqV75Y=
github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg=
github.com/tinylib/msgp v1.1.8/go.mod h1:qkpG+2ldGg4xRFmx+jfTvZPxfGFhi64BcnL9vkCm/Tw=
github.com/tochemey/goakt/v2 v2.11.0 h1:4reuqeN8mvsUWu9ecn3Vd+qtpTASj/kEI9W3FRYHofM=
github.com/tochemey/goakt/v2 v2.11.0/go.mod h1:gMba2xHDzLSDojw5m1SPHDzVFgNWn1I6G9zoagym5e0=
github.com/tochemey/goakt/v2 v2.10.2 h1:ZR/bqT71sg4jYg+JG2xLPcPX3EH1heOEie3OU5N1nt4=
github.com/tochemey/goakt/v2 v2.10.2/go.mod h1:53SxOqOoPLkg3QxPKShGhmkpUT2JOGAl9hPMIZ+kD1o=
github.com/travisjeffery/go-dynaport v1.0.0 h1:m/qqf5AHgB96CMMSworIPyo1i7NZueRsnwdzdCJ8Ajw=
github.com/travisjeffery/go-dynaport v1.0.0/go.mod h1:0LHuDS4QAx+mAc4ri3WkQdavgVoBIZ7cE9ob17KIAJk=
github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q=
Expand Down Expand Up @@ -414,8 +412,8 @@ google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCID
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk=
google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.0 h1:mjIs9gYtt56AzC4ZaffQuh88TZurBGhIJMBZGSxNerQ=
google.golang.org/protobuf v1.36.0/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
6 changes: 3 additions & 3 deletions node/internal/actors/agent_supervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package actors

import (
"context"
"io"
"log/slog"

"github.com/tochemey/goakt/v2/goaktpb"
Expand All @@ -17,8 +16,8 @@ const AgentSupervisorActorName = "agent_supervisor"

var _ goakt.Actor = (*AgentSupervisor)(nil)

func CreateAgentSupervisor(options models.NodeOptions) *AgentSupervisor {
return &AgentSupervisor{logger: slog.New(slog.NewTextHandler(io.Discard, nil)), nodeOptions: options}
func CreateAgentSupervisor(system goakt.ActorSystem, options models.NodeOptions) *AgentSupervisor {
return &AgentSupervisor{nodeOptions: options}
}

// Agent manager is responsible for starting one agent per workload type, supplying it with
Expand All @@ -31,6 +30,7 @@ type AgentSupervisor struct {
}

func (s *AgentSupervisor) PreStart(ctx context.Context) error {

return nil
}

Expand Down
50 changes: 0 additions & 50 deletions node/internal/actors/agent_supervisor_test.go

This file was deleted.

30 changes: 19 additions & 11 deletions node/internal/actors/artifacts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,22 @@ import (
"testing"
"time"

"github.com/carlmjohnson/be"
"github.com/nats-io/nats-server/v2/server"
"github.com/nats-io/nats.go"
"github.com/nats-io/nats.go/jetstream"
)

func startNatsServer(t testing.TB, workingDir string) *server.Server {
func startNatsServer(t testing.TB) (*server.Server, error) {
t.Helper()

s, err := server.NewServer(&server.Options{
Port: -1,
JetStream: true,
StoreDir: workingDir,
})
be.NilErr(t, err)

if err != nil {
return nil, err
}

go func() {
if err := server.Run(s); err != nil {
Expand All @@ -39,18 +40,22 @@ func startNatsServer(t testing.TB, workingDir string) *server.Server {
time.Sleep(1 * time.Second)

nc, err := nats.Connect(s.ClientURL())
be.NilErr(t, err)

if err != nil {
return nil, err
}
jsCtx, err := jetstream.New(nc)
be.NilErr(t, err)

if err != nil {
return nil, err
}
_, err = jsCtx.CreateKeyValue(context.TODO(), jetstream.KeyValueConfig{
Bucket: "registry",
})
be.NilErr(t, err)
if err != nil {
return nil, err
}
nc.Close()

return s
return s, nil
}

func createTestBinary(t testing.TB, tmpDir string) (string, string, int) {
Expand Down Expand Up @@ -97,7 +102,10 @@ func createTestBinary(t testing.TB, tmpDir string) (string, string, int) {
}

func prepNatsObjStoreArtifact(t testing.TB, workingDir, binPath string) (string, *nats.Conn, error) {
s := startNatsServer(t, t.TempDir())
s, err := startNatsServer(t)
if err != nil {
return "", nil, err
}

nc, err := nats.Connect(s.ClientURL())
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions node/internal/actors/control_api_conversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func auctionResponseFromProto(response *actorproto.AuctionResponse) *api.Auction
}

return &api.AuctionResponseJson{
Nexus: response.Nexus,
BidderId: response.BidderId,
Status: gen.AuctionResponseJsonStatus{Status: convertedStatus},
Tags: api.AuctionResponseJsonTags{Tags: response.Tags},
Expand Down
Loading

0 comments on commit ff933c4

Please sign in to comment.