nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: syself/cluster-api-provider-hetzner
Pull request #883 (2023-09-01 08:29:13)

:seedling: rename Condition of loadbalancer
**What this PR does / why we need it**:

We took the naming of the aws provider:

https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/cdbaf654af78585d507ba333c10ce3e678944616/api/v1beta2/conditions_consts.go#L116



Patch:
diff --git a/api/v1beta1/conditions_const.go b/api/v1beta1/conditions_const.go
index 837a1fc5..1590294c 100644
--- a/api/v1beta1/conditions_const.go
+++ b/api/v1beta1/conditions_const.go
@@ -19,10 +19,10 @@ package v1beta1
 import clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
 
 const (
-	// LoadBalancerAttached reports on whether the load balancer is attached.
-	LoadBalancerAttached clusterv1.ConditionType = "LoadBalancerAttached"
-	// LoadBalancerUnreachableReason is used when load balancer is unreachable.
-	LoadBalancerUnreachableReason = "LoadBalancerUnreachable"
+	// LoadBalancerReadyCondition reports on whether a control plane load balancer was successfully reconciled.
+	LoadBalancerReadyCondition clusterv1.ConditionType = "LoadBalancerReady"
+	// LoadBalancerFailedReason used when an error occurs during load balancer reconciliation.
+	LoadBalancerFailedReason = "LoadBalancerFailed"
 )
 
 const (
diff --git a/controllers/hetznercluster_controller.go b/controllers/hetznercluster_controller.go
index e0329d81..f738ad77 100644
--- a/controllers/hetznercluster_controller.go
+++ b/controllers/hetznercluster_controller.go
@@ -184,10 +184,10 @@ func (r *HetznerClusterReconciler) reconcileNormal(ctx context.Context, clusterS
 
 	// reconcile the load balancers
 	if err := loadbalancer.NewService(clusterScope).Reconcile(ctx); err != nil {
-		conditions.MarkFalse(hetznerCluster, infrav1.LoadBalancerAttached, infrav1.LoadBalancerUnreachableReason, clusterv1.ConditionSeverityError, err.Error())
+		conditions.MarkFalse(hetznerCluster, infrav1.LoadBalancerReadyCondition, infrav1.LoadBalancerFailedReason, clusterv1.ConditionSeverityError, err.Error())
 		return reconcile.Result{}, fmt.Errorf("failed to reconcile load balancers for HetznerCluster %s/%s: %w", hetznerCluster.Namespace, hetznerCluster.Name, err)
 	}
-	conditions.MarkTrue(hetznerCluster, infrav1.LoadBalancerAttached)
+	conditions.MarkTrue(hetznerCluster, infrav1.LoadBalancerReadyCondition)
 
 	// reconcile the placement groups
 	if err := placementgroup.NewService(clusterScope).Reconcile(ctx); err != nil {


Test patch:
diff --git a/controllers/hetznercluster_controller_test.go b/controllers/hetznercluster_controller_test.go
index 865ec0cf..7299f161 100644
--- a/controllers/hetznercluster_controller_test.go
+++ b/controllers/hetznercluster_controller_test.go
@@ -170,7 +170,7 @@ var _ = Describe("Hetzner ClusterReconciler", func() {
 				if err := testEnv.Get(ctx, key, instance); err != nil {
 					return false
 				}
-				return isPresentAndTrue(key, instance, infrav1.LoadBalancerAttached)
+				return isPresentAndTrue(key, instance, infrav1.LoadBalancerReadyCondition)
 			}, timeout).Should(BeTrue())
 
 			By("updating load balancer specs")
Repository: matrixorigin/matrixone
Pull request #11285 (2023-08-18 02:22:40)

[enhancement] logservice: return error for unknown cmd instead of panic.
## What type of PR is this?

- [ ] API-change
- [ ] BUG
- [x] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue #11282 

## What this PR does / why we need it:
logservice does not panic for unknown RPC method, just
return not supported error to the client.


Patch:
diff --git a/pkg/logservice/service.go b/pkg/logservice/service.go
index 0e289a929..9a73474fe 100644
--- a/pkg/logservice/service.go
+++ b/pkg/logservice/service.go
@@ -19,6 +19,7 @@ package logservice
 
 import (
 	"context"
+	"fmt"
 	"sync"
 	"sync/atomic"
 
@@ -27,6 +28,7 @@ import (
 	"github.com/fagongzi/goetty/v2"
 	"github.com/lni/dragonboat/v4"
 
+	"github.com/matrixorigin/matrixone/pkg/common/moerr"
 	"github.com/matrixorigin/matrixone/pkg/common/morpc"
 	"github.com/matrixorigin/matrixone/pkg/common/mpool"
 	"github.com/matrixorigin/matrixone/pkg/common/runtime"
@@ -285,7 +287,11 @@ func (s *Service) handle(ctx context.Context, req pb.Request,
 	case pb.DELETE_CN_STORE:
 		return s.handleDeleteCNStore(ctx, req), pb.LogRecordResponse{}
 	default:
-		panic("unknown log service method type")
+		resp := getResponse(req)
+		resp.ErrorCode, resp.ErrorMessage = toErrorCode(
+			moerr.NewNotSupported(ctx,
+				fmt.Sprintf("logservice method type %d", req.Method)))
+		return resp, pb.LogRecordResponse{}
 	}
 }
 


Test patch:
diff --git a/pkg/logservice/service_test.go b/pkg/logservice/service_test.go
index 7619e7f31..1aa2d9202 100644
--- a/pkg/logservice/service_test.go
+++ b/pkg/logservice/service_test.go
@@ -119,6 +119,20 @@ func TestNewService(t *testing.T) {
 	assert.NoError(t, service.Close())
 }
 
+func TestNotSupportCmd(t *testing.T) {
+	fn := func(t *testing.T, s *Service) {
+		ctx, cancel := context.WithTimeout(context.Background(), time.Second)
+		defer cancel()
+
+		req := pb.Request{
+			Method: 999,
+		}
+		resp, _ := s.handle(ctx, req, nil)
+		assert.Equal(t, uint32(moerr.ErrNotSupported), resp.ErrorCode)
+	}
+	runServiceTest(t, false, true, fn)
+}
+
 func TestServiceConnect(t *testing.T) {
 	fn := func(t *testing.T, s *Service) {
 		ctx, cancel := context.WithTimeout(context.Background(), time.Second)