Skip to content

Commit

Permalink
feat: run e2e test in parallel (#667)
Browse files Browse the repository at this point in the history
**Reason for Change**:
<!-- What does this PR improve or fix in Kaito? Why is it needed? -->

**Requirements**

- [ ] added unit tests and e2e tests (if applicable).

**Issue Fixed**:
<!-- If this PR fixes GitHub issue 4321, add "Fixes #4321" to the next
line. -->

**Notes for Reviewers**:

---------

Signed-off-by: zhuangqh <zhuangqhc@gmail.com>
Co-authored-by: Fei Guo <guofei@microsoft.com>
  • Loading branch information
zhuangqh and Fei-Guo committed Nov 15, 2024
1 parent ddc3a36 commit 6cffe7a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ inference-api-e2e:
# Ginkgo configurations
GINKGO_FOCUS ?=
GINKGO_SKIP ?=
GINKGO_NODES ?= 1
GINKGO_NODES ?= 2
GINKGO_NO_COLOR ?= false
GINKGO_TIMEOUT ?= 120m
GINKGO_ARGS ?= -focus="$(GINKGO_FOCUS)" -skip="$(GINKGO_SKIP)" -nodes=$(GINKGO_NODES) -no-color=$(GINKGO_NO_COLOR) -timeout=$(GINKGO_TIMEOUT)
Expand Down
8 changes: 4 additions & 4 deletions pkg/controllers/workspace_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ func (c *WorkspaceReconciler) Reconcile(ctx context.Context, req reconcile.Reque

klog.InfoS("Reconciling", "workspace", req.NamespacedName)

if err := c.syncControllerRevision(ctx, workspaceObj); err != nil {
return reconcile.Result{}, err
}

if err := c.ensureFinalizer(ctx, workspaceObj); err != nil {
return reconcile.Result{}, err
}
Expand All @@ -99,6 +95,10 @@ func (c *WorkspaceReconciler) Reconcile(ctx context.Context, req reconcile.Reque
return c.deleteWorkspace(ctx, workspaceObj)
}

if err := c.syncControllerRevision(ctx, workspaceObj); err != nil {
return reconcile.Result{}, err
}

if workspaceObj.Inference != nil && workspaceObj.Inference.Preset != nil {
if !plugin.KaitoModelRegister.Has(string(workspaceObj.Inference.Preset.Name)) {
return reconcile.Result{}, fmt.Errorf("the preset model name %s is not registered for workspace %s/%s",
Expand Down
14 changes: 8 additions & 6 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ var (
nodeProvisionerName = os.Getenv("TEST_SUITE")
)

var _ = SynchronizedBeforeSuite(func() []byte {
var _ = BeforeSuite(func() {
utils.GetClusterClient(utils.TestingCluster)

namespaceName = fmt.Sprintf("%s-%d", namespaceName, GinkgoParallelProcess())
GinkgoWriter.Printf("Namespace %q for e2e tests\n", namespaceName)

kaitoNamespace := os.Getenv("KAITO_NAMESPACE")

if nodeProvisionerName == "azkarpenter" {
Expand Down Expand Up @@ -89,11 +93,9 @@ var _ = SynchronizedBeforeSuite(func() []byte {
},
})
Expect(err).NotTo(HaveOccurred())
})

return nil
}, func(data []byte) {})

var _ = SynchronizedAfterSuite(func() {
var _ = AfterSuite(func() {
// delete testing namespace
Eventually(func() error {
return utils.TestingCluster.KubeClient.Delete(ctx, &corev1.Namespace{
Expand All @@ -103,7 +105,7 @@ var _ = SynchronizedAfterSuite(func() {
}, &client.DeleteOptions{})
}, utils.PollTimeout, utils.PollInterval).Should(Succeed(), "Failed to delete namespace for e2e")

}, func() {})
})

func RunE2ETests(t *testing.T) {
RegisterFailHandler(Fail)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/preset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func createCustomWorkspaceWithAdapter(numOfNode int, validAdapters []kaitov1alph
uniqueID := fmt.Sprint("preset-", rand.Intn(1000))
workspaceObj = utils.GenerateInferenceWorkspaceManifest(uniqueID, namespaceName, "", numOfNode, "Standard_NC12s_v3",
&metav1.LabelSelector{
MatchLabels: map[string]string{"kaito-workspace": "public-preset-e2e-test-falcon"},
MatchLabels: map[string]string{"kaito-workspace": "custom-preset-e2e-test-falcon"},
}, nil, PresetFalcon7BModel, kaitov1alpha1.ModelImageAccessModePublic, nil, nil, validAdapters)

createAndValidateWorkspace(workspaceObj)
Expand Down

0 comments on commit 6cffe7a

Please sign in to comment.