Skip to content

Commit

Permalink
chore: upgrade and remove some dependencies (#644)
Browse files Browse the repository at this point in the history
* chore: upgrade and remove some dependecies
* feat: allow maestro to deal with multiple matches per game server (#646)
* feat: allow maestro to deaul with multiple matches per game server
* fix: removing cooling status
* feat: add new metrics (#649)
* feat: add new metrics
* fix: metrics reporter tests
* fix: protobuf linter offenses
* fix: update buf dependencies before running linter
* fix: add max validation to minFreeSlots fields
  • Loading branch information
reinaldooli authored Nov 25, 2024
1 parent dce31af commit 6440c57
Show file tree
Hide file tree
Showing 99 changed files with 4,659 additions and 7,656 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ kubeconfig.yaml
e2e/framework/maestro/kubeconfig.yaml

# MkDocs
site/
site/
buf.lock
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ SOURCES := $(shell \
find . -not \( \( -name .git -o -name .go -o -name vendor -o -name '*.pb.go' -o -name '*.pb.gw.go' -o -name '*_gen.go' -o -name '*mock*' \) -prune \) \
-name '*.go')

BUF := github.com/bufbuild/buf/cmd/[email protected]

.PHONY: help
help: Makefile ## Show list of commands.
@echo "Choose a command to run in "$(APP_NAME)":"
Expand Down Expand Up @@ -36,7 +38,7 @@ lint/go: ## Execute golangci-lint.

.PHONY: lint/protobuf
lint/protobuf: ## Execute buf linter.
@go run github.com/bufbuild/buf/cmd/buf lint
@go run $(BUF) dep update && go run $(BUF) lint

.PHONY: run/tests
run/tests: run/unit-tests run/integration-tests ## Execute all unit and integration tests
Expand Down Expand Up @@ -103,8 +105,10 @@ run/metrics-reporter: build ## Runs maestro metrics-reporter.

.PHONY: generate
generate: ## Execute code generation.
@go run $(BUF) dep update && go run $(BUF) generate
@go generate ./gen


#-------------------------------------------------------------------------------
# Migration and database make targets
#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -148,13 +152,13 @@ deps/down: ## Delete containers dependencies.
.PHONY: maestro/start
maestro/start: build-linux-x86_64 ## Start Maestro with all of its dependencies.
@echo "Starting maestro..."
@cd ./e2e/framework/maestro; docker-compose up --build -d
@cd ./e2e/framework/maestro; docker compose up --build -d
@MAESTRO_MIGRATION_PATH="file://internal/service/migrations" go run main.go migrate;
@cd ./e2e/framework/maestro; docker-compose up --build -d worker runtime-watcher #Worker and watcher do not work before migration, so we start them after it.
@cd ./e2e/framework/maestro; docker compose up --build -d worker runtime-watcher #Worker and watcher do not work before migration, so we start them after it.
@echo "Maestro is up and running!"

.PHONY: maestro/down
maestro/down: ## Delete Maestro and all of its dependencies.
@echo "Deleting maestro..."
@cd ./e2e/framework/maestro; docker-compose down
@cd ./e2e/framework/maestro; docker compose down
@echo "Maestro was deleted with success!"
14 changes: 14 additions & 0 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: v2
plugins:
- remote: buf.build/protocolbuffers/go:v1.35.1
out: pkg/
opt: paths=source_relative
- remote: buf.build/grpc/go:v1.5.1
out: pkg/
opt: paths=source_relative
- remote: buf.build/grpc-ecosystem/gateway:v2.22.0
out: pkg/
opt: paths=source_relative
- remote: buf.build/grpc-ecosystem/openapiv2:v2.22.0
out: proto/
opt: allow_merge=true
6 changes: 0 additions & 6 deletions buf.work.yaml

This file was deleted.

18 changes: 18 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: v2
deps:
- buf.build/googleapis/googleapis
- buf.build/grpc-ecosystem/grpc-gateway

modules:
- path: proto

breaking:
use:
- FILE

lint:
use:
- DEFAULT
- COMMENTS
except:
- PACKAGE_VERSION_SUFFIX
10 changes: 5 additions & 5 deletions cmd/roomsapi/wire_gen.go

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

2 changes: 1 addition & 1 deletion cmd/runtimewatcher/wire_gen.go

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

2 changes: 1 addition & 1 deletion cmd/worker/wire_gen.go

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

26 changes: 16 additions & 10 deletions e2e/framework/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,34 @@ import (
"io"
"net/http"

"github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/proto"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
)

type APIClient struct {
baseAddr string
httpClient *http.Client
marshaler *jsonpb.Marshaler
unmarshaler *jsonpb.Unmarshaler
marshaler *protojson.MarshalOptions
unmarshaler *protojson.UnmarshalOptions
}

func NewAPIClient(baseAddr string) *APIClient {
return &APIClient{
httpClient: &http.Client{},
marshaler: &jsonpb.Marshaler{},
unmarshaler: &jsonpb.Unmarshaler{},
marshaler: &protojson.MarshalOptions{},
unmarshaler: &protojson.UnmarshalOptions{},
baseAddr: baseAddr,
}
}

func (c *APIClient) Do(verb, path string, request proto.Message, response proto.Message) error {
buf := new(bytes.Buffer)
err := c.marshaler.Marshal(buf, request)
var buf []byte
_, err := c.marshaler.MarshalAppend(buf, request)
if err != nil {
return fmt.Errorf("failed to encode request: %w", err)
}

req, err := http.NewRequest(verb, fmt.Sprintf("%s%s", c.baseAddr, path), buf)
req, err := http.NewRequest(verb, fmt.Sprintf("%s%s", c.baseAddr, path), bytes.NewBuffer(buf))
if err != nil {
return fmt.Errorf("failed to build request: %w", err)
}
Expand All @@ -75,10 +75,16 @@ func (c *APIClient) Do(verb, path string, request proto.Message, response proto.
return fmt.Errorf("failed with status %d", resp.StatusCode)
}

err = c.unmarshaler.Unmarshal(resp.Body, response)
var out []byte
err = c.unmarshaler.Unmarshal(out, response)
if err != nil {
return fmt.Errorf("failed to decode response: %w", err)
}

err = resp.Write(bytes.NewBuffer(out))
if err != nil {
return fmt.Errorf("failed to write response: %w", err)
}

return nil
}
104 changes: 52 additions & 52 deletions e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,92 +4,92 @@ go 1.20

require (
github.com/go-redis/redis/v8 v8.11.5
github.com/golang/protobuf v1.5.3
github.com/google/uuid v1.3.0
github.com/stretchr/testify v1.8.2
github.com/golang/protobuf v1.5.4
github.com/google/uuid v1.6.0
github.com/stretchr/testify v1.9.0
github.com/testcontainers/testcontainers-go v0.11.1
github.com/topfreegames/maestro v0.0.0-00010101000000-000000000000
go.uber.org/zap v1.18.1
google.golang.org/protobuf v1.31.0
k8s.io/api v0.23.0
k8s.io/apimachinery v0.23.0
go.uber.org/zap v1.27.0
google.golang.org/protobuf v1.35.1
k8s.io/api v0.31.1
k8s.io/apimachinery v0.31.1
k8s.io/apiserver v0.22.1
k8s.io/client-go v0.23.0
k8s.io/client-go v0.31.1
)

require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3 // indirect
github.com/Masterminds/semver/v3 v3.3.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Microsoft/hcsshim v0.8.16 // indirect
github.com/avast/retry-go/v4 v4.1.0 // indirect
github.com/avast/retry-go/v4 v4.6.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/containerd/cgroups v0.0.0-20210114181951-8a68de567b68 // indirect
github.com/containerd/containerd v1.5.0-beta.4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/docker/docker v20.10.7+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.10.0 // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker v27.3.1+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.22.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/moby/sys/mount v0.2.0 // indirect
github.com/moby/sys/mountinfo v0.4.1 // indirect
github.com/moby/term v0.0.0-20210610120745-9d4ed1856297 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/opencontainers/runc v1.0.0-rc93 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.12.1 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.20.5 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.59.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/topfreegames/protos v1.8.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/oauth2 v0.6.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.28.0 // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/term v0.25.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/time v0.6.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
google.golang.org/grpc v1.55.0 // indirect
google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/grpc v1.67.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.30.0 // indirect
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b // indirect
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace github.com/topfreegames/maestro => ../
Loading

0 comments on commit 6440c57

Please sign in to comment.