Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
load("@gazelle//:def.bzl", "gazelle")

# gazelle:prefix github.com/uber/submitqueue

# Resolve protobuf import ambiguities - use the actual protopb packages, not the proto aliases
# gazelle:resolve go github.com/uber/submitqueue/gateway/protopb //gateway/protopb
# gazelle:resolve go github.com/uber/submitqueue/orchestrator/protopb //orchestrator/protopb
# gazelle:resolve go github.com/uber/submitqueue/speculator/protopb //speculator/protopb

gazelle(name = "gazelle")
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,20 @@ gazelle:
# Run integration tests for a specific service (requires that service to be running)
integration-test-gateway:
@echo "Running Gateway integration tests..."
@$(BAZEL) test //gateway/integration_tests:integration_test --test_output=all
@$(BAZEL) test //gateway/integration_tests:integration_tests_test --test_output=all

integration-test-orchestrator:
@echo "Running Orchestrator integration tests..."
@$(BAZEL) test //orchestrator/integration_tests:integration_test --test_output=all
@$(BAZEL) test //orchestrator/integration_tests:integration_tests_test --test_output=all

integration-test-speculator:
@echo "Running Speculator integration tests..."
@$(BAZEL) test //speculator/integration_tests:integration_test --test_output=all
@$(BAZEL) test //speculator/integration_tests:integration_tests_test --test_output=all

# Run all service integration tests (requires all services to be running)
integration-test:
@echo "Running all service integration tests..."
@$(BAZEL) test //gateway/integration_tests:integration_test //orchestrator/integration_tests:integration_test //speculator/integration_tests:integration_test --test_output=all
@$(BAZEL) test //gateway/integration_tests:integration_tests_test //orchestrator/integration_tests:integration_tests_test //speculator/integration_tests:integration_tests_test --test_output=all

# Run end-to-end tests (requires all services to be running)
e2e-test:
Expand Down
8 changes: 8 additions & 0 deletions entities/storage/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "storage",
srcs = ["land_request.go"],
importpath = "github.com/uber/submitqueue/entities/storage",
visibility = ["//visibility:public"],
)
5 changes: 5 additions & 0 deletions entities/storage/land_request.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package storage

// LandRequest TODO: implement land request for storage
type LandRequest struct {
}
12 changes: 12 additions & 0 deletions extensions/storage/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "storage",
srcs = [
"factory.go",
"request_store.go",
],
importpath = "github.com/uber/submitqueue/extensions/storage",
visibility = ["//visibility:public"],
deps = ["//entities/storage"],
)
6 changes: 6 additions & 0 deletions extensions/storage/factory.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package storage

// Factory is an interface that defines methods for creating different stores.
type Factory interface {
RequestStore() RequestStore
}
15 changes: 15 additions & 0 deletions extensions/storage/mysql/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "mysql",
srcs = [
"factory.go",
"request_store.go",
],
importpath = "github.com/uber/submitqueue/extensions/storage/mysql",
visibility = ["//visibility:public"],
deps = [
"//entities/storage",
"//extensions/storage",
],
)
23 changes: 23 additions & 0 deletions extensions/storage/mysql/factory.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package mysql

import "github.com/uber/submitqueue/extensions/storage"

type factory struct {
requestStore storage.RequestStore
}

type FactoryParams struct {
requestStore storage.RequestStore
}

// NewFactory creates a new MySQL storage factory
func NewFactory(p FactoryParams) (storage.Factory, error) {
return &factory{
requestStore: p.requestStore,
}, nil
}

// RequestStore returns the MySQL-backed RequestStore
func (f *factory) RequestStore() storage.RequestStore {
return f.requestStore
}
24 changes: 24 additions & 0 deletions extensions/storage/mysql/request_store.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package mysql

import (
"context"

entities "github.com/uber/submitqueue/entities/storage"
"github.com/uber/submitqueue/extensions/storage"
)

type requestStore struct {
}

type RequestParam struct {
}

func NewRequestStore() storage.RequestStore {
return &requestStore{}
}

// Get retrieves a land request by ID
func (r *requestStore) Get(ctx context.Context, id string) (*entities.LandRequest, error) {
// TODO: implement GET operation
panic("not implemented")
}
13 changes: 13 additions & 0 deletions extensions/storage/request_store.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package storage

import (
"context"

"github.com/uber/submitqueue/entities/storage"
)

// RequestStore is an interface that defines methods for managing storage requests.
type RequestStore interface {
// Get retrieves a land request by ID
Get(ctx context.Context, id string) (*storage.LandRequest, error)
}
4 changes: 1 addition & 3 deletions gateway/controller/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ go_test(
name = "controller_test",
srcs = ["ping_test.go"],
embed = [":controller"],
deps = [
"//gateway/protopb",
],
deps = ["//gateway/protopb"],
)
4 changes: 3 additions & 1 deletion gateway/integration_tests/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# gazelle:ignore

load("@rules_go//go:def.bzl", "go_test")

go_test(
name = "integration_test",
name = "integration_tests_test",
srcs = ["ping_test.go"],
tags = [
"integration",
Expand Down
2 changes: 2 additions & 0 deletions integration_tests/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# gazelle:ignore

load("@rules_go//go:def.bzl", "go_test")

go_test(
Expand Down
14 changes: 7 additions & 7 deletions integration_tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ make integration-test # All services
./tools/bazel test //integration_tests:e2e_test --test_output=all

# Run individual service integration tests
./tools/bazel test //gateway:integration_test --test_output=all
./tools/bazel test //orchestrator:integration_test --test_output=all
./tools/bazel test //speculator:integration_test --test_output=all
./tools/bazel test //gateway/integration_tests:integration_tests_test --test_output=all
./tools/bazel test //orchestrator/integration_tests:integration_tests_test --test_output=all
./tools/bazel test //speculator/integration_tests:integration_tests_test --test_output=all

# Run all service integration tests
./tools/bazel test //gateway:integration_test //orchestrator:integration_test //speculator:integration_test --test_output=all
./tools/bazel test //gateway/integration_tests:integration_tests_test //orchestrator/integration_tests:integration_tests_test //speculator/integration_tests:integration_tests_test --test_output=all

# The tests are tagged as 'manual' so they won't run with 'bazel test //...'
# This is intentional since they require servers to be running
Expand Down Expand Up @@ -104,11 +104,11 @@ func TestNewMethod(t *testing.T) {

1. Create `newservice/integration_tests/` folder
2. Add test files like `newservice/integration_tests/ping_test.go`
3. Add `go_test` rule to `newservice/BUILD.bazel`:
3. Add `go_test` rule to `newservice/integration_tests/BUILD.bazel`:
```python
go_test(
name = "integration_test",
srcs = ["integration_tests/ping_test.go"],
name = "integration_tests_test",
srcs = ["ping_test.go"],
deps = [
"//newservice/protopb",
"@org_golang_google_grpc//:grpc",
Expand Down
4 changes: 1 addition & 3 deletions orchestrator/controller/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ go_test(
name = "controller_test",
srcs = ["ping_test.go"],
embed = [":controller"],
deps = [
"//orchestrator/protopb",
],
deps = ["//orchestrator/protopb"],
)
4 changes: 3 additions & 1 deletion orchestrator/integration_tests/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# gazelle:ignore

load("@rules_go//go:def.bzl", "go_test")

go_test(
name = "integration_test",
name = "integration_tests_test",
srcs = ["ping_test.go"],
tags = [
"integration",
Expand Down
4 changes: 1 addition & 3 deletions speculator/controller/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ go_test(
name = "controller_test",
srcs = ["ping_test.go"],
embed = [":controller"],
deps = [
"//speculator/protopb",
],
deps = ["//speculator/protopb"],
)
4 changes: 3 additions & 1 deletion speculator/integration_tests/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# gazelle:ignore

load("@rules_go//go:def.bzl", "go_test")

go_test(
name = "integration_test",
name = "integration_tests_test",
srcs = ["ping_test.go"],
tags = [
"integration",
Expand Down