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

Refactor integration test suite to use testify #589

Merged
merged 1 commit into from
Mar 20, 2024

Conversation

DharmitD
Copy link
Member

@DharmitD DharmitD commented Mar 6, 2024

The issue resolved by this Pull Request:

Resolves https://issues.redhat.com/browse/RHOAIENG-1672

Description of your changes:

Convert integration tests to leverage testify instead of gomega/ginkgo.

Testing instructions

Deploy DSPO. In a fresh namespace, run the following command:

go test ./... --tags=test_integration -v -kubeconfig=${KUBECONFIG_PATH} -k8sApiServerHost=${TARGET_CLUSTER}   -DSPANamespace=${TARGET_NAMESPACE} -DSPAPath=resources/dspa-lite.yaml

For the impatient developer, you can use the following flag to skip DSPA install. This is useful when you want to make changes to a live environment and run the tests against it:

go test ./... --tags=test_integration -v -kubeconfig=${KUBECONFIG_PATH} -k8sApiServerHost=${TARGET_CLUSTER}   -DSPANamespace=${TARGET_NAMESPACE} -DSPAPath=resources/dspa-lite.yaml -skipDeploy=true -skipCleanup=true

Checklist

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

@openshift-ci openshift-ci bot requested review from gmfrasca and rimolive March 6, 2024 18:24
@DharmitD DharmitD marked this pull request as draft March 6, 2024 18:24
@DharmitD DharmitD marked this pull request as ready for review March 11, 2024 21:40
@openshift-ci openshift-ci bot requested a review from HumairAK March 11, 2024 21:40
@DharmitD DharmitD marked this pull request as draft March 11, 2024 21:42
@DharmitD DharmitD marked this pull request as ready for review March 12, 2024 02:42
@openshift-ci openshift-ci bot requested a review from hbelmiro March 12, 2024 02:42
@DharmitD DharmitD changed the title WIP: Refactor integration test suite to use testify Refactor integration test suite to use testify Mar 12, 2024
Copy link
Contributor

@amadhusu amadhusu left a comment

Choose a reason for hiding this comment

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

Worked perfectly fine for complete integration test but the test case where we skip the DSPA install using the flag fails as it expects a DSPA named test-dspa. Is that a requirement?

Full Test Case
go test ./... --tags=test_integration -v -kubeconfig=${KUBECONFIG_PATH} -k8sApiServerHost=${TARGET_CLUSTER}   -DSPANamespace=${TARGET_NAMESPACE} -DSPAPath=resources/dspa-lite.yaml
?   	github.com/opendatahub-io/data-science-pipelines-operator	[no test files]
?   	github.com/opendatahub-io/data-science-pipelines-operator/api/v1alpha1	[no test files]
?   	github.com/opendatahub-io/data-science-pipelines-operator/controllers	[no test files]
?   	github.com/opendatahub-io/data-science-pipelines-operator/controllers/config	[no test files]
?   	github.com/opendatahub-io/data-science-pipelines-operator/controllers/testutil	[no test files]
?   	github.com/opendatahub-io/data-science-pipelines-operator/controllers/util	[no test files]
?   	github.com/opendatahub-io/data-science-pipelines-operator/tests/util	[no test files]
=== RUN   TestIntegrationTestSuite
SetupSuite started
2024-03-12T23:49:09+05:30	INFO	Deploying DSPA...
2024-03-12T23:49:10+05:30	INFO	Waiting for DSPA pods to ready...
2024-03-12T23:50:40+05:30	INFO	DSPA Deployed.
2024-03-12T23:50:40+05:30	INFO	Setting up Portforwarding service.
Forwarding service: ds-pipeline-test-dspa to pod ds-pipeline-test-dspa-77d8ff84cd-nmp25 ...
Forwarding from 127.0.0.1:8888 -> 8888
Forwarding from [::1]:8888 -> 8888
2024-03-12T23:50:42+05:30	INFO	Portforwarding service Successfully set up.
SetupSuite completed
=== RUN   TestIntegrationTestSuite/TestAPIServerDeployment
=== RUN   TestIntegrationTestSuite/TestAPIServerDeployment/Should_successfully_fetch_pipelines
Handling connection for 8888
2024-03-12T23:50:43+05:30	INFO	{"pipelines":[{"pipeline_id":"a4c0a3aa-c953-4b21-80cd-fabf0629a898","display_name":"[Demo] iris-training","description":"[source code](https://github.com/opendatahub-io/data-science-pipelines/tree/master/samples/iris-sklearn) A simple pipeline to demonstrate a basic ML Training workflow","created_at":"2024-03-12T18:20:32Z"}],"total_size":1}
=== RUN   TestIntegrationTestSuite/TestAPIServerDeployment/Should_successfully_upload_a_pipeline
2024-03-12T23:50:44+05:30	INFO	{"pipeline_id":"74c97e0f-fb39-4d1a-9a5a-ac239fabab3f","display_name":"test-pipeline-run.yaml","created_at":"2024-03-12T18:20:43Z"}
=== RUN   TestIntegrationTestSuite/TestDSPADeployment
=== RUN   TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio
=== RUN   TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_8_pods
=== RUN   TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_ds-pipeline-test-dspa_deployment
=== RUN   TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_ds-pipeline-persistenceagent-test-dspa_deployment
=== RUN   TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_ds-pipeline-scheduledworkflow-test-dspa_deployment
=== RUN   TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_mariadb-test-dspa_deployment
=== RUN   TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_minio-test-dspa_deployment
=== RUN   TestIntegrationTestSuite/TestFetchExperiments
=== RUN   TestIntegrationTestSuite/TestFetchExperiments/Should_successfully_fetch_experiments
2024-03-12T23:50:47+05:30	INFO	{"experiments":[{"experiment_id":"125e7b72-4ddc-4cd9-b17f-bc93a548ffa8","display_name":"Default","description":"All runs created without specifying an experiment will be grouped here.","created_at":"2024-03-12T18:20:34Z","storage_state":"AVAILABLE"}],"total_size":1}
--- PASS: TestIntegrationTestSuite (100.86s)
    --- PASS: TestIntegrationTestSuite/TestAPIServerDeployment (1.82s)
        --- PASS: TestIntegrationTestSuite/TestAPIServerDeployment/Should_successfully_fetch_pipelines (0.82s)
        --- PASS: TestIntegrationTestSuite/TestAPIServerDeployment/Should_successfully_upload_a_pipeline (1.00s)
    --- PASS: TestIntegrationTestSuite/TestDSPADeployment (2.78s)
        --- PASS: TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio (2.78s)
            --- PASS: TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_8_pods (1.15s)
            --- PASS: TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_ds-pipeline-test-dspa_deployment (0.54s)
            --- PASS: TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_ds-pipeline-persistenceagent-test-dspa_deployment (0.28s)
            --- PASS: TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_ds-pipeline-scheduledworkflow-test-dspa_deployment (0.27s)
            --- PASS: TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_mariadb-test-dspa_deployment (0.27s)
            --- PASS: TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_minio-test-dspa_deployment (0.27s)
    --- PASS: TestIntegrationTestSuite/TestFetchExperiments (0.72s)
        --- PASS: TestIntegrationTestSuite/TestFetchExperiments/Should_successfully_fetch_experiments (0.72s)
PASS
ok  	github.com/opendatahub-io/data-science-pipelines-operator/tests	100.873s
Test case skipping the DSPA install with the flag
go test ./... --tags=test_integration -v -kubeconfig=${KUBECONFIG_PATH} -k8sApiServerHost=${TARGET_CLUSTER}   -DSPANamespace=${TARGET_NAMESPACE} -DSPAPath=resources/dspa-lite.yaml -skipDeploy=true -skipCleanup=true
?   	github.com/opendatahub-io/data-science-pipelines-operator	[no test files]
?   	github.com/opendatahub-io/data-science-pipelines-operator/api/v1alpha1	[no test files]
?   	github.com/opendatahub-io/data-science-pipelines-operator/controllers	[no test files]
?   	github.com/opendatahub-io/data-science-pipelines-operator/controllers/config	[no test files]
?   	github.com/opendatahub-io/data-science-pipelines-operator/controllers/testutil	[no test files]
?   	github.com/opendatahub-io/data-science-pipelines-operator/controllers/util	[no test files]
?   	github.com/opendatahub-io/data-science-pipelines-operator/tests/util	[no test files]
=== RUN   TestIntegrationTestSuite
SetupSuite started
    suite_test.go:158:
        	Error Trace:	/tmp/tmp.xhMjGe55ls/data-science-pipelines-operator/tests/suite_test.go:158
        	            				/home/amadhusu/kogitooperator/go/pkg/pkg/mod/github.com/stretchr/testify@v1.8.3/suite/suite.go:154
        	            				/tmp/tmp.xhMjGe55ls/data-science-pipelines-operator/tests/suite_test.go:193
        	Error:      	Received unexpected error:
        	            	datasciencepipelinesapplications.datasciencepipelinesapplications.opendatahub.io "test-dspa" not found
        	Test:       	TestIntegrationTestSuite
2024-03-13T00:02:10+05:30	INFO	DSPA Deployed.
2024-03-13T00:02:10+05:30	INFO	Setting up Portforwarding service.
    suite_test.go:172:
        	Error Trace:	/tmp/tmp.xhMjGe55ls/data-science-pipelines-operator/tests/suite_test.go:172
        	            				/home/amadhusu/kogitooperator/go/pkg/pkg/mod/github.com/stretchr/testify@v1.8.3/suite/suite.go:154
        	            				/tmp/tmp.xhMjGe55ls/data-science-pipelines-operator/tests/suite_test.go:193
        	Error:      	Received unexpected error:
        	            	services "ds-pipeline-test-dspa" not found
        	Test:       	TestIntegrationTestSuite
--- FAIL: TestIntegrationTestSuite (2.43s)
FAIL
FAIL	github.com/opendatahub-io/data-science-pipelines-operator/tests	2.443s
FAIL

@DharmitD
Copy link
Member Author

Worked perfectly fine for complete integration test but the test case where we skip the DSPA install using the flag fails as it expects a DSPA named test-dspa. Is that a requirement?

Full Test Case

go test ./... --tags=test_integration -v -kubeconfig=${KUBECONFIG_PATH} -k8sApiServerHost=${TARGET_CLUSTER}   -DSPANamespace=${TARGET_NAMESPACE} -DSPAPath=resources/dspa-lite.yaml
?   	github.com/opendatahub-io/data-science-pipelines-operator	[no test files]
?   	github.com/opendatahub-io/data-science-pipelines-operator/api/v1alpha1	[no test files]
?   	github.com/opendatahub-io/data-science-pipelines-operator/controllers	[no test files]
?   	github.com/opendatahub-io/data-science-pipelines-operator/controllers/config	[no test files]
?   	github.com/opendatahub-io/data-science-pipelines-operator/controllers/testutil	[no test files]
?   	github.com/opendatahub-io/data-science-pipelines-operator/controllers/util	[no test files]
?   	github.com/opendatahub-io/data-science-pipelines-operator/tests/util	[no test files]
=== RUN   TestIntegrationTestSuite
SetupSuite started
2024-03-12T23:49:09+05:30	INFO	Deploying DSPA...
2024-03-12T23:49:10+05:30	INFO	Waiting for DSPA pods to ready...
2024-03-12T23:50:40+05:30	INFO	DSPA Deployed.
2024-03-12T23:50:40+05:30	INFO	Setting up Portforwarding service.
Forwarding service: ds-pipeline-test-dspa to pod ds-pipeline-test-dspa-77d8ff84cd-nmp25 ...
Forwarding from 127.0.0.1:8888 -> 8888
Forwarding from [::1]:8888 -> 8888
2024-03-12T23:50:42+05:30	INFO	Portforwarding service Successfully set up.
SetupSuite completed
=== RUN   TestIntegrationTestSuite/TestAPIServerDeployment
=== RUN   TestIntegrationTestSuite/TestAPIServerDeployment/Should_successfully_fetch_pipelines
Handling connection for 8888
2024-03-12T23:50:43+05:30	INFO	{"pipelines":[{"pipeline_id":"a4c0a3aa-c953-4b21-80cd-fabf0629a898","display_name":"[Demo] iris-training","description":"[source code](https://github.com/opendatahub-io/data-science-pipelines/tree/master/samples/iris-sklearn) A simple pipeline to demonstrate a basic ML Training workflow","created_at":"2024-03-12T18:20:32Z"}],"total_size":1}
=== RUN   TestIntegrationTestSuite/TestAPIServerDeployment/Should_successfully_upload_a_pipeline
2024-03-12T23:50:44+05:30	INFO	{"pipeline_id":"74c97e0f-fb39-4d1a-9a5a-ac239fabab3f","display_name":"test-pipeline-run.yaml","created_at":"2024-03-12T18:20:43Z"}
=== RUN   TestIntegrationTestSuite/TestDSPADeployment
=== RUN   TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio
=== RUN   TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_8_pods
=== RUN   TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_ds-pipeline-test-dspa_deployment
=== RUN   TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_ds-pipeline-persistenceagent-test-dspa_deployment
=== RUN   TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_ds-pipeline-scheduledworkflow-test-dspa_deployment
=== RUN   TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_mariadb-test-dspa_deployment
=== RUN   TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_minio-test-dspa_deployment
=== RUN   TestIntegrationTestSuite/TestFetchExperiments
=== RUN   TestIntegrationTestSuite/TestFetchExperiments/Should_successfully_fetch_experiments
2024-03-12T23:50:47+05:30	INFO	{"experiments":[{"experiment_id":"125e7b72-4ddc-4cd9-b17f-bc93a548ffa8","display_name":"Default","description":"All runs created without specifying an experiment will be grouped here.","created_at":"2024-03-12T18:20:34Z","storage_state":"AVAILABLE"}],"total_size":1}
--- PASS: TestIntegrationTestSuite (100.86s)
    --- PASS: TestIntegrationTestSuite/TestAPIServerDeployment (1.82s)
        --- PASS: TestIntegrationTestSuite/TestAPIServerDeployment/Should_successfully_fetch_pipelines (0.82s)
        --- PASS: TestIntegrationTestSuite/TestAPIServerDeployment/Should_successfully_upload_a_pipeline (1.00s)
    --- PASS: TestIntegrationTestSuite/TestDSPADeployment (2.78s)
        --- PASS: TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio (2.78s)
            --- PASS: TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_8_pods (1.15s)
            --- PASS: TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_ds-pipeline-test-dspa_deployment (0.54s)
            --- PASS: TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_ds-pipeline-persistenceagent-test-dspa_deployment (0.28s)
            --- PASS: TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_ds-pipeline-scheduledworkflow-test-dspa_deployment (0.27s)
            --- PASS: TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_mariadb-test-dspa_deployment (0.27s)
            --- PASS: TestIntegrationTestSuite/TestDSPADeployment/with_default_MariaDB_and_Minio/should_have_a_ready_minio-test-dspa_deployment (0.27s)
    --- PASS: TestIntegrationTestSuite/TestFetchExperiments (0.72s)
        --- PASS: TestIntegrationTestSuite/TestFetchExperiments/Should_successfully_fetch_experiments (0.72s)
PASS
ok  	github.com/opendatahub-io/data-science-pipelines-operator/tests	100.873s

Test case skipping the DSPA install with the flag

Yep, this is expected. Basically the skip deploy command works when you have a DSPA instance already up with a DSP CR named "test-dspa". Hence it would fail on not finding that CR.

@HumairAK
Copy link
Contributor

@DharmitD can you either edit the message to be more clear or squash this commit "fixes"

@HumairAK HumairAK requested review from diegolovison and removed request for hbelmiro March 15, 2024 16:20
@HumairAK
Copy link
Contributor

@diegolovison should review this as well, as he'll need to update the test script that runs downstream

tests/suite_test.go Outdated Show resolved Hide resolved
tests/suite_test.go Outdated Show resolved Hide resolved
tests/suite_test.go Outdated Show resolved Hide resolved
tests/suite_test.go Outdated Show resolved Hide resolved
tests/experiments_test.go Outdated Show resolved Hide resolved
tests/experiments_test.go Outdated Show resolved Hide resolved
@openshift-ci openshift-ci bot removed the lgtm label Mar 18, 2024
@VaniHaripriya
Copy link
Contributor

/lgtm

Makefile Show resolved Hide resolved
Copy link
Contributor

openshift-ci bot commented Mar 20, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amadhusu, gmfrasca

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@HumairAK
Copy link
Contributor

/hold

@openshift-merge-bot openshift-merge-bot bot merged commit 259315b into opendatahub-io:main Mar 20, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants