Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: create initial Integration tests #4895

Merged
merged 11 commits into from
Jun 15, 2023
Merged

test: create initial Integration tests #4895

merged 11 commits into from
Jun 15, 2023

Conversation

ukclivecox
Copy link
Contributor

Initial integration tests PoC

  • Updates CLI to simplfy usage to allow simple Load, Unload, Status, Infer to be used easily from integration tests
  • Add k8s integration for Load, Unload, Status, Infer
  • Adds a generic SeldonBackedAPI getter for tests to get either docker or k8s integration to test locally or via k8s. Defaults to local docker integration if it finds it first.
  • Adds initial example tests for loading, waiting for ready, infer and unload of Model
make test
go test -v ./pkg/... -coverprofile cover.out
=== RUN   TestSingleModelLoadInferUnload
=== RUN   TestSingleModelLoadInferUnload/rest
=== RUN   TestSingleModelLoadInferUnload/grpc
=== RUN   TestSingleModelLoadInferUnload/unknown
--- PASS: TestSingleModelLoadInferUnload (0.00s)
    --- PASS: TestSingleModelLoadInferUnload/rest (0.00s)
    --- PASS: TestSingleModelLoadInferUnload/grpc (0.00s)
    --- PASS: TestSingleModelLoadInferUnload/unknown (0.00s)
PASS
coverage: 8.6% of statements
ok  	github.com/seldonio/seldon-core/tests/integration/v2/pkg/resources	0.013s	coverage: 8.6% of statements
=== RUN   TestSingleModelLoadInferUnload
=== RUN   TestSingleModelLoadInferUnload/sklearn_-_iris
    model_test.go:46: Waiting for model testdata/sklearn-iris.yaml:false
    model_test.go:46: Waiting for model testdata/sklearn-iris.yaml:true
=== RUN   TestSingleModelLoadInferUnload/tensorflow_-_tfsimple
    model_test.go:46: Waiting for model testdata/tensorflow-tfsimple.yaml:false
    model_test.go:46: Waiting for model testdata/tensorflow-tfsimple.yaml:true
=== RUN   TestSingleModelLoadInferUnload/xgboost_-_income
    model_test.go:46: Waiting for model testdata/xgboost-income.yaml:false
    model_test.go:46: Waiting for model testdata/xgboost-income.yaml:true
--- PASS: TestSingleModelLoadInferUnload (3.95s)
    --- PASS: TestSingleModelLoadInferUnload/sklearn_-_iris (1.02s)
    --- PASS: TestSingleModelLoadInferUnload/tensorflow_-_tfsimple (1.03s)
    --- PASS: TestSingleModelLoadInferUnload/xgboost_-_income (1.04s)
PASS
coverage: [no statements]
ok  	github.com/seldonio/seldon-core/tests/integration/v2/pkg/tests	3.962s	coverage: [no statements]

Notes:

  • Initial investigation to use go testcontainers with compose. However, gave up as that tries to use googleapis/gnostic via 3rd party dependency and we use more recent google/gnostic. As both define protos fails by default due to proto clash. This can be overridden but for not left the ability to create Seldon via Compose as part of tests as not done and assume its already installed by some previous method.

@ukclivecox ukclivecox added the v2 label Jun 7, 2023
@ukclivecox ukclivecox requested a review from agrski June 7, 2023 18:06
@ukclivecox ukclivecox changed the title Integration tests test: create initial Integration tests Jun 7, 2023
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Contributor

@agrski agrski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Various clarifications and changes suggestions requested, as well as a few suggestions for now and the future.

As general comments from offline discussion:

  • Relying on an existing setup from the environment is fine for a first pass to show the functionality, but highly brittle for actually running integration tests.
  • We should add in mechanisms to isolate test cases so they aren't accidental interactions between them, e.g. leaving a model loaded.
  • We should be clear about whether we expect the test to run in k8s or local Docker/Compose rather than trying to infer this too.
  • Using hard-coded endpoints is also awkward for running different test cases concurrently.
  • It'd be nice in the future to separate the definition of test scenarios from the runner code, if possible. This would make it easier for non-Go devs to write and understand test cases.

operator/cmd/seldon/cli/experiment_start.go Show resolved Hide resolved
flags.BoolP(flagShowRequest, "r", false, "show request")
flags.BoolP(flagShowResponse, "o", true, "show response")
flags.Int64P(flagTimeout, "t", flagTimeoutDefault, "timeout seconds")
flags.BoolP(flagVerbose, "v", false, "verbose output")
flags.String(flagSchedulerHost, env.GetString(envScheduler, defaultSchedulerHost), helpSchedulerHost)
flags.String(flagAuthority, "", helpAuthority)
flags.StringP(flagWaitCondition, "w", "", "model wait condition")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💭 Just noticed this - experiment_status has wait as a Boolean, whereas here the user is expected to know what condition to apply. For pipelines I can understand that there are two underlying conditions (pipeline infra + models), but here it's slightly awkward, no?

Not directly related to this PR, but thought I'd raise anyway

Copy link
Contributor Author

@ukclivecox ukclivecox Jun 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes could change or consolidate in a future PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving unresolved to track

operator/cmd/seldon/cli/pipeline_inspect.go Outdated Show resolved Hide resolved
operator/pkg/cli/infer.go Show resolved Hide resolved
operator/pkg/cli/generic.go Outdated Show resolved Hide resolved
)

func TestSingleModelLoadInferUnload(t *testing.T) {
g := NewGomegaWithT(t)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💭 Not a change for this PR, but I'd have a preference for using testify for assertions instead of Gomega as it's lighter, simpler, and less verbose. One to discuss offline perhaps

tests/integration/pkg/tests/model_test.go Outdated Show resolved Hide resolved
sapi, err := resources.NewSeldonBackendAPI()
g.Expect(err).To(BeNil())
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💭 This could be more nicely expressed as multiple subtests with t.Run() to capture the load, infer, and unload parts. That way, if something fails then it's immediately clear which bit failed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe future PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure - it's an easy and small enough change to leave. Leaving comment unresolved as a reminder

@ukclivecox
Copy link
Contributor Author

Review fixes and also added build target for integration so just make test does internal tests only (no seldon required)

Copy link
Contributor

@agrski agrski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor change left, but approving as this does not affect functionality if not done -- just confusing/surprising to see

@ukclivecox ukclivecox merged commit 623b792 into SeldonIO:v2 Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants