Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
grutt committed Jan 30, 2025
1 parent 0903b8f commit d5840fb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
10 changes: 0 additions & 10 deletions cmd/hatchet-engine/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ import (
"github.com/hatchet-dev/hatchet/cmd/hatchet-engine/engine"
"github.com/hatchet-dev/hatchet/pkg/cmdutils"
"github.com/hatchet-dev/hatchet/pkg/config/loader"

"net/http"
_ "net/http/pprof"
)

var printVersion bool
Expand All @@ -41,13 +38,6 @@ var rootCmd = &cobra.Command{
context = ctx
}

// enable pprof if requested
if os.Getenv("PPROF_ENABLED") == "true" {
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))
}()
}

if err := engine.Run(context, cf, Version); err != nil {
log.Printf("engine failure: %s", err.Error())
os.Exit(1)
Expand Down
12 changes: 6 additions & 6 deletions pkg/scheduling/v2/lease_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ func TestLeaseManager_AcquireWorkerLeases(t *testing.T) {
}

mockWorkers := []*repository.ListActiveWorkersResult{
{ID: pgtype.UUID{}, Labels: nil},
{ID: pgtype.UUID{}, Labels: nil},
{ID: "worker-1", Labels: nil},
{ID: "worker-2", Labels: nil},
}
mockLeases := []*dbsqlc.Lease{
{ID: 1, ResourceId: "worker-1"},
Expand Down Expand Up @@ -106,7 +106,7 @@ func TestLeaseManager_SendWorkerIds(t *testing.T) {
}

mockWorkers := []*repository.ListActiveWorkersResult{
{ID: pgtype.UUID{}, Labels: nil},
{ID: "worker-1", Labels: nil},
}

go leaseManager.sendWorkerIds(mockWorkers)
Expand Down Expand Up @@ -140,11 +140,11 @@ func TestLeaseManager_AcquireWorkersBeforeListenerReady(t *testing.T) {
}

mockWorkers1 := []*repository.ListActiveWorkersResult{
{ID: pgtype.UUID{}, Labels: nil},
{ID: "worker-1", Labels: nil},
}
mockWorkers2 := []*repository.ListActiveWorkersResult{
{ID: pgtype.UUID{}, Labels: nil},
{ID: pgtype.UUID{}, Labels: nil},
{ID: "worker-1", Labels: nil},
{ID: "worker-2", Labels: nil},
}

// Send workers before listener is ready
Expand Down
18 changes: 9 additions & 9 deletions pkg/scheduling/v2/slot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ func TestGetRankedSlots(t *testing.T) {
DesiredWorkerId: sqlchelpers.UUIDFromStr(stableWorkerId1),
},
slots: []*slot{
newSlot(&worker{ListActiveWorkersResult: &repository.ListActiveWorkersResult{ID: sqlchelpers.UUIDFromStr(stableWorkerId1)}}, []string{}),
newSlot(&worker{ListActiveWorkersResult: &repository.ListActiveWorkersResult{ID: sqlchelpers.UUIDFromStr(uuid.New().String())}}, []string{}),
newSlot(&worker{ListActiveWorkersResult: &repository.ListActiveWorkersResult{ID: (stableWorkerId1)}}, []string{}),
newSlot(&worker{ListActiveWorkersResult: &repository.ListActiveWorkersResult{ID: (uuid.New().String())}}, []string{}),
},
expectedWorker: []string{stableWorkerId1},
},
Expand All @@ -42,8 +42,8 @@ func TestGetRankedSlots(t *testing.T) {
DesiredWorkerId: sqlchelpers.UUIDFromStr(uuid.New().String()),
},
slots: []*slot{
newSlot(&worker{ListActiveWorkersResult: &repository.ListActiveWorkersResult{ID: sqlchelpers.UUIDFromStr(uuid.New().String())}}, []string{}),
newSlot(&worker{ListActiveWorkersResult: &repository.ListActiveWorkersResult{ID: sqlchelpers.UUIDFromStr(uuid.New().String())}}, []string{}),
newSlot(&worker{ListActiveWorkersResult: &repository.ListActiveWorkersResult{ID: (uuid.New().String())}}, []string{}),
newSlot(&worker{ListActiveWorkersResult: &repository.ListActiveWorkersResult{ID: (uuid.New().String())}}, []string{}),
},
expectedWorker: []string{},
},
Expand All @@ -54,9 +54,9 @@ func TestGetRankedSlots(t *testing.T) {
DesiredWorkerId: sqlchelpers.UUIDFromStr(stableWorkerId1),
},
slots: []*slot{
newSlot(&worker{ListActiveWorkersResult: &repository.ListActiveWorkersResult{ID: sqlchelpers.UUIDFromStr(stableWorkerId2)}}, []string{}),
newSlot(&worker{ListActiveWorkersResult: &repository.ListActiveWorkersResult{ID: sqlchelpers.UUIDFromStr(stableWorkerId1)}}, []string{}),
newSlot(&worker{ListActiveWorkersResult: &repository.ListActiveWorkersResult{ID: sqlchelpers.UUIDFromStr(stableWorkerId1)}}, []string{}),
newSlot(&worker{ListActiveWorkersResult: &repository.ListActiveWorkersResult{ID: (stableWorkerId2)}}, []string{}),
newSlot(&worker{ListActiveWorkersResult: &repository.ListActiveWorkersResult{ID: (stableWorkerId1)}}, []string{}),
newSlot(&worker{ListActiveWorkersResult: &repository.ListActiveWorkersResult{ID: (stableWorkerId1)}}, []string{}),
},
expectedWorker: []string{stableWorkerId1, stableWorkerId1, stableWorkerId2},
},
Expand All @@ -80,11 +80,11 @@ func TestGetRankedSlots(t *testing.T) {
},
},
slots: []*slot{
newSlot(&worker{ListActiveWorkersResult: &repository.ListActiveWorkersResult{ID: sqlchelpers.UUIDFromStr(stableWorkerId1), Labels: []*dbsqlc.ListManyWorkerLabelsRow{{
newSlot(&worker{ListActiveWorkersResult: &repository.ListActiveWorkersResult{ID: (stableWorkerId1), Labels: []*dbsqlc.ListManyWorkerLabelsRow{{
Key: "key1",
IntValue: pgtype.Int4{Int32: 2, Valid: true},
}}}}, []string{}),
newSlot(&worker{ListActiveWorkersResult: &repository.ListActiveWorkersResult{ID: sqlchelpers.UUIDFromStr(stableWorkerId2), Labels: []*dbsqlc.ListManyWorkerLabelsRow{{
newSlot(&worker{ListActiveWorkersResult: &repository.ListActiveWorkersResult{ID: (stableWorkerId2), Labels: []*dbsqlc.ListManyWorkerLabelsRow{{
Key: "key1",
IntValue: pgtype.Int4{Int32: 4, Valid: true},
}, {
Expand Down

0 comments on commit d5840fb

Please sign in to comment.