MCPcopy Create free account
hub / github.com/SeldonIO/seldon-core / TestModelSync

Function TestModelSync

scheduler/pkg/envoy/processor/incremental_test.go:450–596  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

448}
449
450func TestModelSync(t *testing.T) {
451 g := NewGomegaWithT(t)
452 type test struct {
453 name string
454 ops []func(proc *IncrementalProcessor, g *WithT)
455 pendingModelVersions []*pendingModelVersion
456 expectedReplicaStats map[string]map[int]store.ModelReplicaState
457 expectedModelState map[string]store.ModelState
458 }
459
460 tests := []test{
461 {
462 name: "test loaded",
463 ops: []func(inc *IncrementalProcessor, g *WithT){
464 createTestServer("server", 2),
465 createTestModel("model", "server", 1, []int{0}, 1, []store.ModelReplicaState{store.Loaded}),
466 },
467 pendingModelVersions: []*pendingModelVersion{
468 {name: "model", version: 1},
469 },
470 expectedReplicaStats: map[string]map[int]store.ModelReplicaState{"model": {0: store.Available}},
471 expectedModelState: map[string]store.ModelState{"model": store.ModelAvailable},
472 },
473 {
474 name: "test draining",
475 ops: []func(inc *IncrementalProcessor, g *WithT){
476 createTestServer("server", 2),
477 createTestModel("model", "server", 1, []int{0}, 1, []store.ModelReplicaState{store.Draining}),
478 },
479 expectedReplicaStats: map[string]map[int]store.ModelReplicaState{"model": {0: store.Draining}},
480 expectedModelState: map[string]store.ModelState{"model": store.ModelProgressing},
481 },
482 {
483 name: "test draining multiple replicas with other loaded",
484 ops: []func(inc *IncrementalProcessor, g *WithT){
485 createTestServer("server", 2),
486 createTestModel("model", "server", 1, []int{0, 1}, 1, []store.ModelReplicaState{store.Draining, store.Loaded}),
487 },
488 expectedReplicaStats: map[string]map[int]store.ModelReplicaState{"model": {0: store.Draining, 1: store.Available}},
489 expectedModelState: map[string]store.ModelState{"model": store.ModelAvailable},
490 },
491 {
492 name: "test draining multiple replicas with other loading",
493 ops: []func(inc *IncrementalProcessor, g *WithT){
494 createTestServer("server", 2),
495 createTestModel("model", "server", 1, []int{0, 1}, 1, []store.ModelReplicaState{store.Draining, store.Loading}),
496 },
497 expectedReplicaStats: map[string]map[int]store.ModelReplicaState{"model": {0: store.Draining, 1: store.Loading}},
498 expectedModelState: map[string]store.ModelState{"model": store.ModelProgressing},
499 },
500 {
501 name: "loaded unavailable turns to available",
502 ops: []func(inc *IncrementalProcessor, g *WithT){
503 createTestServer("server", 2),
504 createTestModel("model", "server", 1, []int{0}, 1, []store.ModelReplicaState{store.LoadedUnavailable}),
505 },
506 expectedReplicaStats: map[string]map[int]store.ModelReplicaState{"model": {0: store.Available}},
507 expectedModelState: map[string]store.ModelState{"model": store.ModelAvailable},

Callers

nothing calls this directly

Calls 8

modelSyncWithLockMethod · 0.95
createTestServerFunction · 0.85
createTestModelFunction · 0.85
RunMethod · 0.80
ReplicaStateMethod · 0.80
ModelStateMethod · 0.80
GetModelMethod · 0.65
GetLatestMethod · 0.45

Tested by

no test coverage detected