From dbe5cffa2ed30af4e291525cedbc59b72967d972 Mon Sep 17 00:00:00 2001 From: Helber Belmiro Date: Mon, 4 Nov 2024 14:15:13 -0300 Subject: [PATCH 1/3] Added retry for integration test Signed-off-by: Helber Belmiro (cherry picked from commit c4c8bc07f2e1e762322e5312f8816afbf53abebf) --- tests/dspa_v2_test.go | 50 +++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/tests/dspa_v2_test.go b/tests/dspa_v2_test.go index 719c5c73a..93ff0f0b2 100644 --- a/tests/dspa_v2_test.go +++ b/tests/dspa_v2_test.go @@ -21,9 +21,9 @@ package integration import ( "fmt" "testing" + "time" testUtil "github.com/opendatahub-io/data-science-pipelines-operator/tests/util" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" "sigs.k8s.io/controller-runtime/pkg/client" @@ -51,30 +51,38 @@ func (suite *IntegrationTestSuite) TestDSPADeployment() { } suite.T().Run("with default MariaDB and Minio", func(t *testing.T) { t.Run(fmt.Sprintf("should have %d pods", podCount), func(t *testing.T) { - podList := &corev1.PodList{} - // retrieve the running pods only, to allow for multiple reruns of the test suite - listOpts := []client.ListOption{ - client.InNamespace(suite.DSPANamespace), - client.MatchingFields{"status.phase": string(corev1.PodRunning)}, - } - err := suite.Clientmgr.k8sClient.List(suite.Ctx, podList, listOpts...) - require.NoError(t, err) - actualPodCount := len(podList.Items) - assert.Equal(t, podCount, actualPodCount) + timeout := time.Second * 10 + interval := time.Millisecond * 2 + actualPodCount := 0 - // Print out pod statuses for troubleshooting - if podCount != actualPodCount { - t.Log(fmt.Sprintf("expected %d pods to successfully deploy, got %d instead. Pods in the namespace:", podCount, actualPodCount)) - totalPodList := &corev1.PodList{} - listOpts1 := []client.ListOption{ + require.Eventually(t, func() bool { + podList := &corev1.PodList{} + // retrieve the running pods only, to allow for multiple reruns of the test suite + listOpts := []client.ListOption{ client.InNamespace(suite.DSPANamespace), + client.MatchingFields{"status.phase": string(corev1.PodRunning)}, } - err1 := suite.Clientmgr.k8sClient.List(suite.Ctx, totalPodList, listOpts1...) - require.NoError(t, err1) - for _, pod := range totalPodList.Items { - t.Log(fmt.Sprintf("Pod Name: %s, Status: %s", pod.Name, pod.Status.Phase)) + err := suite.Clientmgr.k8sClient.List(suite.Ctx, podList, listOpts...) + require.NoError(suite.T(), err) + actualPodCount = len(podList.Items) + + // Print out pod statuses for troubleshooting + if podCount != actualPodCount { + t.Log(fmt.Sprintf("expected %d pods to successfully deploy, got %d instead. Pods in the namespace:", podCount, actualPodCount)) + totalPodList := &corev1.PodList{} + listOpts1 := []client.ListOption{ + client.InNamespace(suite.DSPANamespace), + } + err1 := suite.Clientmgr.k8sClient.List(suite.Ctx, totalPodList, listOpts1...) + require.NoError(t, err1) + for _, pod := range totalPodList.Items { + t.Log(fmt.Sprintf("Pod Name: %s, Status: %s", pod.Name, pod.Status.Phase)) + } + return false + } else { + return true } - } + }, timeout, interval) }) for _, deployment := range deployments { t.Run(fmt.Sprintf("should have a ready %s deployment", deployment), func(t *testing.T) { From cd1cda68158a64c7f8f6a655f81642c740319b77 Mon Sep 17 00:00:00 2001 From: Diego Lovison Date: Wed, 13 Nov 2024 15:26:14 -0300 Subject: [PATCH 2/3] Bump DSPO test suite to KFP 2.10.0 (cherry picked from commit 0fc7597021aef9cd811c5649b2519caa56a2bf6e) --- tests/dspa_v2_test.go | 4 ++-- tests/resources/test-pipeline-run.yaml | 4 ++-- tests/resources/test-pipeline-with-custom-pip-server-run.yaml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/dspa_v2_test.go b/tests/dspa_v2_test.go index 93ff0f0b2..ce6eeedf5 100644 --- a/tests/dspa_v2_test.go +++ b/tests/dspa_v2_test.go @@ -51,8 +51,8 @@ func (suite *IntegrationTestSuite) TestDSPADeployment() { } suite.T().Run("with default MariaDB and Minio", func(t *testing.T) { t.Run(fmt.Sprintf("should have %d pods", podCount), func(t *testing.T) { - timeout := time.Second * 10 - interval := time.Millisecond * 2 + timeout := time.Second * 120 + interval := time.Second * 2 actualPodCount := 0 require.Eventually(t, func() bool { diff --git a/tests/resources/test-pipeline-run.yaml b/tests/resources/test-pipeline-run.yaml index f33ddf5e6..1ba3703ed 100644 --- a/tests/resources/test-pipeline-run.yaml +++ b/tests/resources/test-pipeline-run.yaml @@ -29,7 +29,7 @@ deploymentSpec: - -c - "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\ \ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\ - \ python3 -m pip install --quiet --no-warn-script-location 'kfp==2.9.0'\ + \ python3 -m pip install --quiet --no-warn-script-location 'kfp==2.10.0'\ \ '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"3.9\"' && \"\ $0\" \"$@\"\n" - sh @@ -77,4 +77,4 @@ root: Output: parameterType: STRING schemaVersion: 2.1.0 -sdkVersion: kfp-2.9.0 +sdkVersion: kfp-2.10.0 diff --git a/tests/resources/test-pipeline-with-custom-pip-server-run.yaml b/tests/resources/test-pipeline-with-custom-pip-server-run.yaml index d6713716f..06d2095ab 100644 --- a/tests/resources/test-pipeline-with-custom-pip-server-run.yaml +++ b/tests/resources/test-pipeline-with-custom-pip-server-run.yaml @@ -24,7 +24,7 @@ deploymentSpec: - "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\ \ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\ \ python3 -m pip install --quiet --no-warn-script-location --index-url https://nginx-service.test-pypiserver.svc.cluster.local/simple/\ - \ 'kfp==2.9.0' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\ + \ 'kfp==2.10.0' '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"\ 3.9\"' && python3 -m pip install --quiet --no-warn-script-location --index-url\ \ https://nginx-service.test-pypiserver.svc.cluster.local/simple/ 'numpy'\ \ && \"$0\" \"$@\"\n" @@ -66,4 +66,4 @@ root: Output: parameterType: STRING schemaVersion: 2.1.0 -sdkVersion: kfp-2.9.0 +sdkVersion: kfp-2.10.0 From 51277adb7cb480dd91940890fd46e59cc92513e2 Mon Sep 17 00:00:00 2001 From: Helber Belmiro Date: Wed, 13 Nov 2024 08:31:46 -0300 Subject: [PATCH 3/3] Trimmed certificates Signed-off-by: Helber Belmiro (cherry picked from commit 7b35ab5ce9c296499d2870ae6946116b2e961d77) --- controllers/dspipeline_params.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/controllers/dspipeline_params.go b/controllers/dspipeline_params.go index 2908a01d1..4efdbe4af 100644 --- a/controllers/dspipeline_params.go +++ b/controllers/dspipeline_params.go @@ -654,7 +654,7 @@ func (p *DSPAParams) ExtractParams(ctx context.Context, dsp *dspa.DataSciencePip // "odh-trusted-ca-bundle" can have fields: "odh-ca-bundle.crt" and "ca-bundle.crt", we need to utilize both for _, val := range globalCerts { // If the ca-bundle field is empty, ignore it - if val != "" { + if strings.TrimSpace(val) != "" { p.APICustomPemCerts = append(p.APICustomPemCerts, []byte(val)) } } @@ -679,7 +679,7 @@ func (p *DSPAParams) ExtractParams(ctx context.Context, dsp *dspa.DataSciencePip } dspaProvidedCABundle := util.GetConfigMapValue(dspaCaBundleCfgKey, dspaCAConfigMap) // If the ca-bundle field is empty, ignore it - if dspaProvidedCABundle != "" { + if strings.TrimSpace(dspaProvidedCABundle) != "" { p.APICustomPemCerts = append(p.APICustomPemCerts, []byte(dspaProvidedCABundle)) } } @@ -694,7 +694,7 @@ func (p *DSPAParams) ExtractParams(ctx context.Context, dsp *dspa.DataSciencePip return serviceCACfgErr } serviceCABundle := util.GetConfigMapValue(config.OpenshiftServiceCAConfigMapKey, serviceCA) - if serviceCABundle == "" { + if strings.TrimSpace(serviceCABundle) == "" { return fmt.Errorf("expected key %s from configmap %s not found", config.OpenshiftServiceCAConfigMapKey, config.OpenshiftServiceCAConfigMapName) } p.APICustomPemCerts = append(p.APICustomPemCerts, []byte(serviceCABundle)) @@ -729,7 +729,7 @@ func (p *DSPAParams) ExtractParams(ctx context.Context, dsp *dspa.DataSciencePip return sysCertsErr } - if len(certs) != 0 { + if len(bytes.TrimSpace(certs)) != 0 { p.APICustomPemCerts = append(p.APICustomPemCerts, certs) } }