Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ gen-check: generate

.PHONY: test
test: generate ## Run tests. Exclude e2e, client-go.
go test $$(go list ./... | grep -v /e2e | grep -v /client-go) -coverprofile cover.out
go test $$(go list ./... | grep -v /e2e | grep -v /client-go | grep -v '/test$$') -coverprofile cover.out

.PHONY: test-docs
test-docs: ## Run documentation tests (type check and build)
Expand All @@ -98,7 +98,7 @@ test-e2e: ## Run the e2e tests. Expected an isolated environment using Kind.
@echo "Setting up Kind cluster for E2E tests..."
@./test/e2e/setup.sh
@echo "Running E2E tests sequentially..."
@KUBECONFIG=/tmp/kubeconfig-e2e go test -p 1 $$(go list ./... | grep /test/e2e) -v -timeout=15m
@KUBECONFIG=/tmp/kubeconfig-e2e go test -p 1 $$(go list -f '{{if or .TestGoFiles .XTestGoFiles}}{{.ImportPath}}{{end}}' ./... | grep /test/e2e | grep -v '^$$') -v -timeout=15m
Copy link
Contributor

Choose a reason for hiding this comment

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

#731 (comment)
? so wdum in this one.why different again in above pr

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this change only avoids failing cl on packages with (no test files) actual e2e tests are still executed and will fail the build if they fail ,the goal is to avoid false negatives not to relax real test coverage

@echo "E2E tests completed"

.PHONY: test-e2e-cleanup
Expand Down
2 changes: 0 additions & 2 deletions charts/kthena/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}

{{ template "chart.requirementsSection" . }}

Copy link
Contributor

Choose a reason for hiding this comment

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

we dont need this one anymore or what?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this template is still needed the change only affects generated docs to fix invalid markdown it doesn’t remove or deprecate the chart template

{{ template "chart.valuesSection" . }}


Expand Down
7 changes: 0 additions & 7 deletions docs/kthena/docs/reference/helm-chart-values.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ A Helm chart for deploying Kthena

![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square)

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| https://ghcr.io/volcano-sh/charts/kthena | networking | 1.0.0 |
| https://ghcr.io/volcano-sh/charts/kthena | workload | 1.0.0 |

Copy link
Contributor

Choose a reason for hiding this comment

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

? why all instead of partly in
#731 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the table was invalid as a whole (column mismatch) and was breaking gen check
removing it entirely was the minimal and safest fix to unblock cl rather than keeping a partially broken structure

## Values

| Key | Type | Default | Description |
Expand Down
2 changes: 1 addition & 1 deletion pkg/kthena-router/controller/gateway_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (c *GatewayController) syncHandler(key string) error {
}

func (c *GatewayController) enqueueGateway(obj interface{}) {
key, err := cache.MetaNamespaceKeyFunc(obj)
key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
Copy link
Contributor

Choose a reason for hiding this comment

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

acceptable(since we also get a DeleteFunc in NewHTTPRouteController or else).

controller.registration, _ = httpRouteInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: controller.enqueueHTTPRoute,
UpdateFunc: func(old, new interface{}) { controller.enqueueHTTPRoute(new) },
DeleteFunc: controller.enqueueHTTPRoute,
})

k8s standard FYI:
https://github.com/kubernetes/client-go/blob/f651faf89451a2a3263d06653561101c26675659/examples/workqueue/main.go#L177-L202

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for confirming

if err != nil {
utilruntime.HandleError(err)
return
Expand Down
86 changes: 86 additions & 0 deletions pkg/kthena-router/controller/gateway_controller_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
Copyright The Volcano Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package controller

import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/workqueue"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"

"github.com/volcano-sh/kthena/pkg/kthena-router/datastore"
)

func TestEnqueueGateway(t *testing.T) {
tests := []struct {
name string
obj interface{}
expectedKey string
}{
{
name: "normal Gateway object",
obj: &gatewayv1.Gateway{
ObjectMeta: metav1.ObjectMeta{
Name: "test-gateway",
Namespace: "default",
},
},
expectedKey: "default/test-gateway",
},
{
name: "tombstone with DeletedFinalStateUnknown",
obj: cache.DeletedFinalStateUnknown{
Key: "default/deleted-gateway",
Obj: &gatewayv1.Gateway{
ObjectMeta: metav1.ObjectMeta{
Name: "deleted-gateway",
Namespace: "default",
},
},
},
expectedKey: "default/deleted-gateway",
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
queue := workqueue.NewTypedRateLimitingQueue(workqueue.DefaultTypedControllerRateLimiter[any]())
defer queue.ShutDown()

c := &GatewayController{
workqueue: queue,
store: datastore.New(),
}

c.enqueueGateway(tt.obj)

if queue.Len() != 1 {
t.Fatalf("expected 1 item in queue, got %d", queue.Len())
}

item, shutdown := queue.Get()
if shutdown {
t.Fatal("unexpected queue shutdown")
}
if item != tt.expectedKey {
t.Errorf("expected key %q, got %q", tt.expectedKey, item)
}
})
}
}
2 changes: 1 addition & 1 deletion pkg/kthena-router/controller/httproute_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (c *HTTPRouteController) syncHandler(key string) error {
}

func (c *HTTPRouteController) enqueueHTTPRoute(obj interface{}) {
key, err := cache.MetaNamespaceKeyFunc(obj)
key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
if err != nil {
utilruntime.HandleError(err)
return
Expand Down
86 changes: 86 additions & 0 deletions pkg/kthena-router/controller/httproute_controller_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
Copyright The Volcano Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package controller

import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/workqueue"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"

"github.com/volcano-sh/kthena/pkg/kthena-router/datastore"
)

func TestEnqueueHTTPRoute(t *testing.T) {
tests := []struct {
name string
obj interface{}
expectedKey string
}{
{
name: "normal HTTPRoute object",
obj: &gatewayv1.HTTPRoute{
ObjectMeta: metav1.ObjectMeta{
Name: "test-httproute",
Namespace: "default",
},
},
expectedKey: "default/test-httproute",
},
{
name: "tombstone with DeletedFinalStateUnknown",
obj: cache.DeletedFinalStateUnknown{
Key: "default/deleted-httproute",
Obj: &gatewayv1.HTTPRoute{
ObjectMeta: metav1.ObjectMeta{
Name: "deleted-httproute",
Namespace: "default",
},
},
},
expectedKey: "default/deleted-httproute",
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
queue := workqueue.NewTypedRateLimitingQueue(workqueue.DefaultTypedControllerRateLimiter[any]())
defer queue.ShutDown()

c := &HTTPRouteController{
workqueue: queue,
store: datastore.New(),
}

c.enqueueHTTPRoute(tt.obj)

if queue.Len() != 1 {
t.Fatalf("expected 1 item in queue, got %d", queue.Len())
}

item, shutdown := queue.Get()
if shutdown {
t.Fatal("unexpected queue shutdown")
}
if item != tt.expectedKey {
t.Errorf("expected key %q, got %q", tt.expectedKey, item)
}
})
}
}
2 changes: 1 addition & 1 deletion pkg/kthena-router/controller/inferencepool_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (c *InferencePoolController) syncHandler(key string) error {
}

func (c *InferencePoolController) enqueueInferencePool(obj interface{}) {
key, err := cache.MetaNamespaceKeyFunc(obj)
key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
if err != nil {
utilruntime.HandleError(err)
return
Expand Down
86 changes: 86 additions & 0 deletions pkg/kthena-router/controller/inferencepool_controller_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
Copyright The Volcano Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package controller

import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/workqueue"
inferencev1 "sigs.k8s.io/gateway-api-inference-extension/api/v1"

"github.com/volcano-sh/kthena/pkg/kthena-router/datastore"
)

func TestEnqueueInferencePool(t *testing.T) {
tests := []struct {
name string
obj interface{}
expectedKey string
}{
{
name: "normal InferencePool object",
obj: &inferencev1.InferencePool{
ObjectMeta: metav1.ObjectMeta{
Name: "test-pool",
Namespace: "default",
},
},
expectedKey: "default/test-pool",
},
{
name: "tombstone with DeletedFinalStateUnknown",
obj: cache.DeletedFinalStateUnknown{
Key: "default/deleted-pool",
Obj: &inferencev1.InferencePool{
ObjectMeta: metav1.ObjectMeta{
Name: "deleted-pool",
Namespace: "default",
},
},
},
expectedKey: "default/deleted-pool",
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
queue := workqueue.NewTypedRateLimitingQueue(workqueue.DefaultTypedControllerRateLimiter[any]())
defer queue.ShutDown()

c := &InferencePoolController{
workqueue: queue,
store: datastore.New(),
}

c.enqueueInferencePool(tt.obj)

if queue.Len() != 1 {
t.Fatalf("expected 1 item in queue, got %d", queue.Len())
}

item, shutdown := queue.Get()
if shutdown {
t.Fatal("unexpected queue shutdown")
}
if item != tt.expectedKey {
t.Errorf("expected key %q, got %q", tt.expectedKey, item)
}
})
}
}
2 changes: 1 addition & 1 deletion pkg/kthena-router/controller/modelroute_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (c *ModelRouteController) syncHandler(key string) error {
}

func (c *ModelRouteController) enqueueModelRoute(obj interface{}) {
key, err := cache.MetaNamespaceKeyFunc(obj)
key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
if err != nil {
utilruntime.HandleError(err)
return
Expand Down
Loading
Loading