Skip to content

Commit 2090c48

Browse files
Slop some tests and production deploy, minor refactorings
1 parent 7e76dc0 commit 2090c48

71 files changed

Lines changed: 5859 additions & 506 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/tests.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,27 @@ jobs:
2424
- name: Run tests
2525
run: make test
2626

27+
e2e-tests:
28+
runs-on: ubuntu-latest
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
preset: [simple, production]
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Set up Go
38+
uses: actions/setup-go@v5
39+
with:
40+
go-version-file: 'go.mod'
41+
42+
- name: Create .fastad_root marker
43+
run: touch .fastad_root
44+
45+
- name: Run E2E tests (${{ matrix.preset }} preset)
46+
run: go test -tags "e2e e2e_${{ matrix.preset }}" -v ./tests/e2e/... -timeout 15m
47+
2748
lint-go:
2849
runs-on: ubuntu-latest
2950
steps:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ __pycache__
99
.env
1010
/compose.yml
1111
/game.yml
12+
.sisyphus
13+
/fastad

cmd/allinone/main.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import (
1313
receiverImpl "github.com/c4t-but-s4d/fastad/cmd/receiver/impl"
1414
schedulerImpl "github.com/c4t-but-s4d/fastad/cmd/scheduler/impl"
1515
slacImpl "github.com/c4t-but-s4d/fastad/cmd/slac/impl"
16-
"github.com/c4t-but-s4d/fastad/internal/api"
1716
"github.com/c4t-but-s4d/fastad/internal/checkers"
1817
"github.com/c4t-but-s4d/fastad/internal/dataservice"
18+
"github.com/c4t-but-s4d/fastad/internal/handlers"
1919
"github.com/c4t-but-s4d/fastad/internal/receiver"
2020
"github.com/c4t-but-s4d/fastad/internal/scheduler"
2121
"github.com/c4t-but-s4d/fastad/internal/slac"
@@ -38,7 +38,7 @@ type Config struct {
3838
DataService dataservice.Config `mapstructure:"data_service"`
3939
Scheduler scheduler.Config `mapstructure:"scheduler"`
4040
Slac slac.Config `mapstructure:"slac"`
41-
API api.Config `mapstructure:"api"`
41+
API handlers.Config `mapstructure:"api"`
4242
Checkers checkers.Config `mapstructure:"checkers"`
4343
Receiver receiver.Config `mapstructure:"receiver"`
4444
}
@@ -69,7 +69,18 @@ func main() {
6969
return nil
7070
})
7171

72-
// Receiver depends on API, start it first.
72+
if err := apiwait.GRPC(gctx, cfg.DataService.ListenAddress); err != nil {
73+
zap.L().Error("waiting for DataService", zap.Error(err))
74+
cancel()
75+
return
76+
}
77+
78+
if err := apiwait.GRPC(gctx, cfg.Slac.ListenAddress); err != nil {
79+
zap.L().Error("waiting for SLAC", zap.Error(err))
80+
cancel()
81+
return
82+
}
83+
7384
cfg.API.DataService.Address = cfg.DataService.ListenAddress
7485
cfg.API.SlacAddress = cfg.Slac.ListenAddress
7586
cfg.API.ReceiverAddress = cfg.Receiver.ListenAddress
@@ -83,6 +94,7 @@ func main() {
8394
if err := apiwait.HTTP(gctx, cfg.API.ListenAddress); err != nil {
8495
zap.L().Error("waiting for API", zap.Error(err))
8596
cancel()
97+
return
8698
}
8799

88100
cfg.Receiver.DataService.Address = cfg.DataService.ListenAddress

cmd/api/impl/run.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
"go.uber.org/zap"
1313
"golang.org/x/sync/errgroup"
1414

15-
"github.com/c4t-but-s4d/fastad/internal/api"
1615
"github.com/c4t-but-s4d/fastad/internal/centutil"
16+
"github.com/c4t-but-s4d/fastad/internal/handlers"
1717
"github.com/c4t-but-s4d/fastad/pkg/clients/gamestate"
1818
"github.com/c4t-but-s4d/fastad/pkg/clients/services"
1919
"github.com/c4t-but-s4d/fastad/pkg/clients/teams"
@@ -27,7 +27,7 @@ import (
2727
slacpb "github.com/c4t-but-s4d/fastad/pkg/proto/slac"
2828
)
2929

30-
func Run(runCtx, shutdownCtx context.Context, cfg *api.Config) error {
30+
func Run(runCtx, shutdownCtx context.Context, cfg *handlers.Config) error {
3131
dataServiceConn, err := grpcext.Dial(
3232
cfg.DataService.Address,
3333
cfg.Installation,
@@ -79,7 +79,7 @@ func Run(runCtx, shutdownCtx context.Context, cfg *api.Config) error {
7979

8080
producer := centutil.NewNodeProducer(node, cfg.ScoreboardChannel)
8181

82-
boardBuilder := api.NewBoardBuilder(
82+
boardBuilder := handlers.NewBoardBuilder(
8383
teamsClient,
8484
servicesClient,
8585
receiverClient,
@@ -89,7 +89,7 @@ func Run(runCtx, shutdownCtx context.Context, cfg *api.Config) error {
8989

9090
db := cfg.Postgres.BunDB()
9191

92-
apiService := api.NewService(
92+
apiService := handlers.NewService(
9393
cfg,
9494
db,
9595
node,

cmd/api/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"go.uber.org/zap"
55

66
"github.com/c4t-but-s4d/fastad/cmd/api/impl"
7-
"github.com/c4t-but-s4d/fastad/internal/api"
7+
"github.com/c4t-but-s4d/fastad/internal/handlers"
88
"github.com/c4t-but-s4d/fastad/pkg/baseconfig"
99
"github.com/c4t-but-s4d/fastad/pkg/logging"
1010
"github.com/c4t-but-s4d/fastad/pkg/stop"
@@ -13,7 +13,7 @@ import (
1313
func main() {
1414
defer logging.Init().Close()
1515

16-
cfg := baseconfig.MustSetupAll(&api.Config{}, baseconfig.WithEnvPrefix("FASTAD_API"))
16+
cfg := baseconfig.MustSetupAll(&handlers.Config{}, baseconfig.WithEnvPrefix("FASTAD_API"))
1717

1818
runCtx, shutdownCtx, cancel := stop.SetupCtx()
1919
defer cancel()

cmd/fastad/cli/common/context.go

Lines changed: 0 additions & 3 deletions
This file was deleted.

cmd/fastad/cli/run/preset_simple.go

Lines changed: 0 additions & 208 deletions
This file was deleted.

0 commit comments

Comments
 (0)