|
| 1 | +package routerreplaypostgres |
| 2 | + |
| 3 | +import ( |
| 4 | + "context" |
| 5 | + |
| 6 | + "github.com/vllm-project/semantic-router/e2e/pkg/framework" |
| 7 | + gatewaystack "github.com/vllm-project/semantic-router/e2e/pkg/stacks/gateway" |
| 8 | +) |
| 9 | + |
| 10 | +const ( |
| 11 | + valuesFile = "e2e/profiles/router-replay-postgres/values.yaml" |
| 12 | + postgresManifest = "deploy/kubernetes/router-replay/postgres.yaml" |
| 13 | +) |
| 14 | + |
| 15 | +var resourceManifests = []string{ |
| 16 | + "deploy/kubernetes/response-api/mock-vllm.yaml", |
| 17 | + "deploy/kubernetes/response-api/gwapi-resources.yaml", |
| 18 | +} |
| 19 | + |
| 20 | +// Profile implements the Router Replay Postgres test profile. |
| 21 | +type Profile struct { |
| 22 | + stack *gatewaystack.Stack |
| 23 | +} |
| 24 | + |
| 25 | +// NewProfile creates a new Router Replay Postgres profile. |
| 26 | +func NewProfile() *Profile { |
| 27 | + return &Profile{ |
| 28 | + stack: gatewaystack.New(gatewaystack.Config{ |
| 29 | + Name: "router-replay-postgres", |
| 30 | + SemanticRouterValuesFile: valuesFile, |
| 31 | + PrerequisiteManifests: []string{postgresManifest}, |
| 32 | + ResourceManifests: resourceManifests, |
| 33 | + }), |
| 34 | + } |
| 35 | +} |
| 36 | + |
| 37 | +// Name returns the profile name. |
| 38 | +func (p *Profile) Name() string { |
| 39 | + return "router-replay-postgres" |
| 40 | +} |
| 41 | + |
| 42 | +// Description returns the profile description. |
| 43 | +func (p *Profile) Description() string { |
| 44 | + return "Tests Router Replay restart recovery using the default Postgres backend" |
| 45 | +} |
| 46 | + |
| 47 | +// Setup deploys Postgres, the router, and gateway resources. |
| 48 | +func (p *Profile) Setup(ctx context.Context, opts *framework.SetupOptions) error { |
| 49 | + return p.stack.Setup(ctx, opts) |
| 50 | +} |
| 51 | + |
| 52 | +// Teardown removes the stack. |
| 53 | +func (p *Profile) Teardown(ctx context.Context, opts *framework.TeardownOptions) error { |
| 54 | + return p.stack.Teardown(ctx, opts) |
| 55 | +} |
| 56 | + |
| 57 | +// GetTestCases returns the test cases for this profile. |
| 58 | +func (p *Profile) GetTestCases() []string { |
| 59 | + return []string{ |
| 60 | + "router-replay-restart-recovery", |
| 61 | + } |
| 62 | +} |
| 63 | + |
| 64 | +// GetServiceConfig returns the service configuration for accessing the deployed service. |
| 65 | +func (p *Profile) GetServiceConfig() framework.ServiceConfig { |
| 66 | + return p.stack.ServiceConfig() |
| 67 | +} |
0 commit comments