Closed zamonia500 closed 4 months ago
/remove-kind bug
@zamonia500 , can you provide some details on what are you trying to test for? Are you testing a pipeline end to end? or it's more like local unit test for a component's implementation code?
This code implemented in a way that uses the methods of kfp.Client.
And now I'm trying to test this code, but this code holds bunch of kfp_server_api & kfp.Client methods.
If you're not looking for pipeline e2e test, your code probably shouldn't be bundled with kfp.Client.
@zamonia500 , can you provide some details on what are you trying to test for? Are you testing a pipeline end to end? or it's more like local unit test for a component's implementation code?
This code implemented in a way that uses the methods of kfp.Client. And now I'm trying to test this code, but this code holds bunch of kfp_server_api & kfp.Client methods.
If you're not looking for pipeline e2e test, your code probably shouldn't be bundled with kfp.Client.
@chensun , sorry for late reply :( It's unit test for a client code to get list of pipelines and execute some of it using kfp.Client code.
looks like this
pipeline_id = kfp_client.get_pipeline_id(pipeline_name)
pipeline_versions = kfp_client.list_pipeline_versions(
pipeline_id,
page_size=1,
sort_by="created_at desc",
)
experiment = kfp_client.create_experiment("zamonia500-exp")
generated_run = kfp_client.run_pipeline(
experiment_id=experiment.id,
job_name="zamonia500-job",
params=pipeline_params, # retrieved from somewhere
version_id=pipeline_version.id,
)
KFPv2 has test cases for sample pipelines, you can take a look and reuse in your tests. I'm closing this issue, but feel free if you think you have unanswered questions
https://github.com/kubeflow/pipelines/blob/master/samples/v2/component_with_optional_inputs_test.py
/close
@rimolive: Closing this issue.
/kind question
Environment
I implemented a python code to get the list of updated pipeline versions after a certain time offset using kfp.Client . This code implemented in a way that uses the methods of kfp.Client.
And now I'm trying to test this code, but this code holds bunch of kfp_server_api & kfp.Client methods. It's very inconvenient to mock these SDK code to write test code. Is there anyone who has tested the code using kfp.Client? Please share some good ideas thanks!