Skip to content

Commit

Permalink
fix: add check for all platform offering on components (opendatahub-i…
Browse files Browse the repository at this point in the history
…o#1205)

* fix: add check for all platform offering on components

- wait for component's deployment is ready before return to caller
- reduce logging
- prolong timeout for workbench, trustyai, dsp, kserve

Signed-off-by: Wen Zhou <wenzhou@redhat.com>

* fix: wrong log

Signed-off-by: Wen Zhou <wenzhou@redhat.com>

* test: increase timeout and move a bit of order

Signed-off-by: Wen Zhou <wenzhou@redhat.com>

---------

Signed-off-by: Wen Zhou <wenzhou@redhat.com>
Co-authored-by: ajaypratap003 <ajay.pratap233@gmail.com>
(cherry picked from commit ab7e04e)
  • Loading branch information
zdtsw authored and VaishnaviHire committed Sep 16, 2024
1 parent 12867c1 commit 28408f1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 53 deletions.
39 changes: 0 additions & 39 deletions components/modelregistry/zz_generated.deepcopy.go

This file was deleted.

1 change: 0 additions & 1 deletion docs/upgrade-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ spec:
managementState: Managed
trainingoperator:
managementState: Managed
>>>>>>> 742b09bd (docs: update old docs (#1188))
workbenches:
managementState: Managed
trustyai:
Expand Down
28 changes: 15 additions & 13 deletions tests/e2e/creation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,21 @@ func creationTestSuite(t *testing.T) {
t.Run("Validate DSCInitialization instance", func(t *testing.T) {
err = testCtx.validateDSCI()
require.NoError(t, err, "error validating DSCInitialization instance")
})
t.Run("Check owned namespaces exist", func(t *testing.T) {
err = testCtx.testOwnedNamespacesAllExist()
require.NoError(t, err, "error owned namespace is missing")
})

// DSC
})
t.Run("Creation of DataScienceCluster instance", func(t *testing.T) {
err = testCtx.testDSCCreation()
require.NoError(t, err, "error creating DataScienceCluster instance")
})
t.Run("Creation of more than one of DataScienceCluster instance", func(t *testing.T) {
testCtx.testDSCDuplication(t)
})

t.Run("Validate DSCInitialization instance", func(t *testing.T) {
err = testCtx.validateDSCI()
require.NoError(t, err, "error validating DSCInitialization instance")
})

t.Run("Validate Ownerrefrences exist", func(t *testing.T) {
err = testCtx.testOwnerrefrences()
require.NoError(t, err, "error getting all DataScienceCluster's Ownerrefrences")
Expand Down Expand Up @@ -216,25 +217,20 @@ func (tc *testContext) requireInstalled(t *testing.T, gvk schema.GroupVersionKin
list.SetGroupVersionKind(gvk)

err := tc.customClient.List(tc.ctx, list)
require.NoErrorf(t, err, "Could not get %s list", gvk.Kind)

require.NotEmptyf(t, list.Items, "%s has not been installed", gvk.Kind)
require.NotEmptyf(t, err, "Could not get %s list", gvk.Kind)
require.Greaterf(t, len(list.Items), 0, "%s has not been installed", gvk.Kind)
}

func (tc *testContext) testDuplication(t *testing.T, gvk schema.GroupVersionKind, o any) {
t.Helper()
tc.requireInstalled(t, gvk)

u, err := runtime.DefaultUnstructuredConverter.ToUnstructured(o)
require.NoErrorf(t, err, "Could not unstructure %s", gvk.Kind)

obj := &unstructured.Unstructured{
Object: u,
}
obj.SetGroupVersionKind(gvk)

err = tc.customClient.Create(tc.ctx, obj)

require.Errorf(t, err, "Could create second %s", gvk.Kind)
}

Expand Down Expand Up @@ -289,6 +285,12 @@ func (tc *testContext) testAllComponentCreation(t *testing.T) error { //nolint:f
require.NoError(t, err, "error validating component %v when "+c.GetManagementState())
})
}

// Verify DSC instance is in Ready phase in the end when all components are up and running
if tc.testDsc.Status.Phase != "Ready" {
return fmt.Errorf("DSC instance is not in Ready phase. Current phase: %v", tc.testDsc.Status.Phase)
}

return nil
}

Expand Down

0 comments on commit 28408f1

Please sign in to comment.