Skip to content

Commit f49e9e5

Browse files
committed
model steps
1 parent 8155c77 commit f49e9e5

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

tests/integration/godog/scenario/scenario.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ package scenario
1212
import (
1313
"context"
1414
"fmt"
15+
"time"
1516

1617
"github.com/cucumber/godog"
1718
v "github.com/seldonio/seldon-core/operator/v2/pkg/generated/clientset/versioned"
@@ -107,6 +108,7 @@ func InitializeScenario(scenarioCtx *godog.ScenarioContext) {
107108

108109
// After: optional cleanup / rollback
109110
scenarioCtx.After(func(ctx context.Context, scenario *godog.Scenario, err error) (context.Context, error) {
111+
time.Sleep(5 * time.Second)
110112
if err := world.KubeClient.DeleteScenarioResources(ctx, world.Label); err != nil {
111113
return ctx, fmt.Errorf("error when deleting models on before steps: %w", err)
112114
}

tests/integration/godog/steps/model_steps.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/seldonio/seldon-core/tests/integration/godog/scenario/assertions"
2121
"gopkg.in/yaml.v3"
2222
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23+
"k8s.io/utils/ptr"
2324
)
2425

2526
type Model struct {
@@ -63,7 +64,7 @@ func LoadModelSteps(scenario *godog.ScenarioContext, w *World) {
6364
scenario.Step(`^the model (?:should )?eventually become(?:s)? Ready$`, func() error {
6465
return w.CurrentModel.ModelReady(w.WatcherStorage)
6566
})
66-
scenario.Step(`^the model status message should be "([^"]+)"$`, w.CurrentModel.AssertModelStatus)
67+
scenario.Step(`^the model status message should eventually be "([^"]+)"$`, w.CurrentModel.AssertModelStatus)
6768
}
6869

6970
func LoadExplicitModelSteps(scenario *godog.ScenarioContext, w *World) {
@@ -170,12 +171,16 @@ func (m *Model) Reset(world *World) {
170171
}
171172

172173
func (m *Model) SetMinReplicas(replicas int) {
173-
174+
m.model.Spec.ScalingSpec.MinReplicas = ptr.To(int32(replicas))
174175
}
175176

176-
func (m *Model) SetMaxReplicas(replicas int) {}
177+
func (m *Model) SetMaxReplicas(replicas int) {
178+
m.model.Spec.ScalingSpec.MaxReplicas = ptr.To(int32(replicas))
179+
}
177180

178-
func (m *Model) SetReplicas(replicas int) {}
181+
func (m *Model) SetReplicas(replicas int) {
182+
m.model.Spec.ScalingSpec.Replicas = ptr.To(int32(replicas))
183+
}
179184

180185
// ApplyModel model is aware of namespace and testsuite config and it might add extra information to the cr that the step hasn't added like namespace
181186
func (m *Model) ApplyModel(k *k8sclient.K8sClient) error {

0 commit comments

Comments
 (0)