Skip to content

Commit 5a2afbd

Browse files
authored
tests: move the orchestrator scenarios next to the integration suites (#123)
## Summary Moves the orchestrator scenario code from `test/e2e/acceleratororchestrator/` to `tests/integration/orchestrator/scenarios/` — a shared test library consumed by both the fakes tier (in-process, every PR) and the composed integration tier (#129). Files moved (package rename only, content unchanged): - `scenarios.go` — scenario drivers (`RunSingleRLJobScenario`, `RunQueuedRLJobsScenario`) - `fake_rl_job.go` — scripted RL job actor driving Acquire/Yield - `pod_factory.go` — workload pod templates - `fakes_test.go` — fake agent store, fake scheduler, fake queue - `scenarios_test.go` — fakes-tier test cases (test the orchestrator against fakes) The `test/e2e/` directory is deleted. The `rlts test` subcommand is unchanged; its removal is tracked separately in #140. Directory structure within `orchestrator/scenarios/` will be refined in a follow-up (see Jessica's review feedback on separating the test harness from the scenario library). ## Testing - Cloud Build green (build + unit tests including moved scenario tests + lint). - SA integration suite (9/9 on H100) unaffected — this PR touches no snapshot-agent code. Signed-off-by: Aishu Kamal <aishuk@google.com>
1 parent 2818cc2 commit 5a2afbd

6 files changed

Lines changed: 22 additions & 21 deletions

File tree

cmd/rlts/cmd/test_e2e.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"k8s.io/client-go/tools/clientcmd"
2828

2929
pb "github.com/llm-d-incubation/llm-d-rl-time-slicing/pkg/accelerator-orchestrator/api/v1alpha1"
30-
"github.com/llm-d-incubation/llm-d-rl-time-slicing/test/e2e/acceleratororchestrator"
30+
"github.com/llm-d-incubation/llm-d-rl-time-slicing/tests/integration/orchestrator/scenarios"
3131
)
3232

3333
var testCmd = &cobra.Command{
@@ -163,7 +163,7 @@ var orchestratorTestCmd = &cobra.Command{
163163

164164
// Scenario 1: Single RL Job
165165
fmt.Println("--- Running Scenario: Single RL Job ---")
166-
err = acceleratororchestrator.RunSingleRLJobScenario(ctx, clientset, client, cliLogger, samplerTemplateKey, trainerTemplateKey)
166+
err = scenarios.RunSingleRLJobScenario(ctx, clientset, client, cliLogger, samplerTemplateKey, trainerTemplateKey)
167167
scenario1Passed := err == nil
168168
if !scenario1Passed {
169169
fmt.Printf("[FAIL] Single RL Job Scenario failed: %v\n\n", err)
@@ -173,7 +173,7 @@ var orchestratorTestCmd = &cobra.Command{
173173

174174
// Scenario 2: Queued RL Jobs
175175
fmt.Println("--- Running Scenario: Queued RL Jobs ---")
176-
err = acceleratororchestrator.RunQueuedRLJobsScenario(ctx, clientset, client, cliLogger, samplerTemplateKey, trainerTemplateKey)
176+
err = scenarios.RunQueuedRLJobsScenario(ctx, clientset, client, cliLogger, samplerTemplateKey, trainerTemplateKey)
177177
scenario2Passed := err == nil
178178
if !scenario2Passed {
179179
fmt.Printf("[FAIL] Queued RL Jobs Scenario failed: %v\n\n", err)
@@ -220,7 +220,7 @@ func init() {
220220
"Name of the Kubernetes PodTemplate to use for trainer pods (blank for default pause pod)")
221221
}
222222

223-
// cliLogger implements acceleratororchestrator.Logger interface to print to stdout.
223+
// cliLogger implements scenarios.Logger interface to print to stdout.
224224
type cliLogger struct{}
225225

226226
func (c *cliLogger) Log(args ...interface{}) {

test/e2e/acceleratororchestrator/fake_rl_job.go renamed to tests/integration/orchestrator/scenarios/fake_rl_job.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package acceleratororchestrator
1+
package scenarios
22

33
import (
44
"context"

test/e2e/acceleratororchestrator/pod_factory.go renamed to tests/integration/orchestrator/scenarios/pod_factory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package acceleratororchestrator
15+
package scenarios
1616

1717
import (
1818
"sync"

test/e2e/acceleratororchestrator/scenarios.go renamed to tests/integration/orchestrator/scenarios/scenarios.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package acceleratororchestrator
15+
package scenarios
1616

1717
import (
1818
"context"

test/e2e/acceleratororchestrator/fakes.go renamed to tests/integration/orchestrator/simulate/fakes.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package acceleratororchestrator
1+
package simulate
22

33
import (
44
"context"
@@ -10,34 +10,34 @@ import (
1010
)
1111

1212
// trackQueue wraps a rate limiting queue and tracks Done() and AddRateLimited() calls.
13-
type trackQueue struct {
13+
type TrackQueue struct {
1414
workqueue.TypedRateLimitingInterface[string]
1515
mu sync.Mutex
1616
doneCount int
1717
addRateLimitedCount int
1818
}
1919

20-
func (t *trackQueue) Done(item string) {
20+
func (t *TrackQueue) Done(item string) {
2121
t.mu.Lock()
2222
defer t.mu.Unlock()
2323
t.doneCount++
2424
t.TypedRateLimitingInterface.Done(item)
2525
}
2626

27-
func (t *trackQueue) AddRateLimited(item string) {
27+
func (t *TrackQueue) AddRateLimited(item string) {
2828
t.mu.Lock()
2929
defer t.mu.Unlock()
3030
t.addRateLimitedCount++
3131
t.TypedRateLimitingInterface.AddRateLimited(item)
3232
}
3333

34-
func (t *trackQueue) getDoneCount() int {
34+
func (t *TrackQueue) getDoneCount() int {
3535
t.mu.Lock()
3636
defer t.mu.Unlock()
3737
return t.doneCount
3838
}
3939

40-
func (t *trackQueue) getAddRateLimitedCount() int {
40+
func (t *TrackQueue) getAddRateLimitedCount() int {
4141
t.mu.Lock()
4242
defer t.mu.Unlock()
4343
return t.addRateLimitedCount

test/e2e/acceleratororchestrator/e2e_test.go renamed to tests/integration/orchestrator/simulate/orchestrator_simulated_test.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
//nolint:testpackage // Integration E2E tests require package-level access to unexported helper trackQueue
2-
package acceleratororchestrator
1+
package simulate_test
32

43
import (
54
"context"
@@ -13,6 +12,8 @@ import (
1312
"github.com/llm-d-incubation/llm-d-rl-time-slicing/pkg/accelerator-orchestrator/infrastructure"
1413
"github.com/llm-d-incubation/llm-d-rl-time-slicing/pkg/accelerator-orchestrator/server"
1514
"github.com/llm-d-incubation/llm-d-rl-time-slicing/pkg/accelerator-orchestrator/store"
15+
"github.com/llm-d-incubation/llm-d-rl-time-slicing/tests/integration/orchestrator/scenarios"
16+
"github.com/llm-d-incubation/llm-d-rl-time-slicing/tests/integration/orchestrator/simulate"
1617
google_grpc "google.golang.org/grpc"
1718
"google.golang.org/grpc/credentials/insecure"
1819

@@ -68,10 +69,10 @@ func TestE2E_SingleRLJob(t *testing.T) {
6869
jobStore := store.NewJobStore()
6970

7071
// 3. Setup Agent State Simulator (Fake)
71-
fakeAgentStore := NewFakeSnapshotAgentStore()
72+
fakeAgentStore := simulate.NewFakeSnapshotAgentStore()
7273

7374
// 4. Initialize Infrastructure Orchestrator and Controller
74-
testQueue := &trackQueue{
75+
testQueue := &simulate.TrackQueue{
7576
TypedRateLimitingInterface: workqueue.NewTypedRateLimitingQueueWithConfig(
7677
workqueue.DefaultTypedControllerRateLimiter[string](),
7778
workqueue.TypedRateLimitingQueueConfig[string]{Name: "test-e2e-single-job"},
@@ -152,7 +153,7 @@ func TestE2E_SingleRLJob(t *testing.T) {
152153
t.Log("Store initialized with samplers and trainers groups")
153154

154155
// Run Scenario
155-
if err := RunSingleRLJobScenario(ctx, clientset, client, t, "", ""); err != nil {
156+
if err := scenarios.RunSingleRLJobScenario(ctx, clientset, client, t, "", ""); err != nil {
156157
t.Fatalf("Scenario failed: %v", err)
157158
}
158159
}
@@ -199,10 +200,10 @@ func TestE2E_QueuedRLJobs(t *testing.T) {
199200
jobStore := store.NewJobStore()
200201

201202
// 3. Setup Agent State Simulator (Fake)
202-
fakeAgentStore := NewFakeSnapshotAgentStore()
203+
fakeAgentStore := simulate.NewFakeSnapshotAgentStore()
203204

204205
// 4. Initialize Infrastructure Orchestrator and Controller
205-
testQueue := &trackQueue{
206+
testQueue := &simulate.TrackQueue{
206207
TypedRateLimitingInterface: workqueue.NewTypedRateLimitingQueueWithConfig(
207208
workqueue.DefaultTypedControllerRateLimiter[string](),
208209
workqueue.TypedRateLimitingQueueConfig[string]{Name: "test-e2e-queued-jobs"},
@@ -283,7 +284,7 @@ func TestE2E_QueuedRLJobs(t *testing.T) {
283284
t.Log("Store initialized with samplers and trainers groups")
284285

285286
// Run Scenario
286-
if err := RunQueuedRLJobsScenario(ctx, clientset, client, t, "", ""); err != nil {
287+
if err := scenarios.RunQueuedRLJobsScenario(ctx, clientset, client, t, "", ""); err != nil {
287288
t.Fatalf("Scenario failed: %v", err)
288289
}
289290
}

0 commit comments

Comments
 (0)