nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: numaproj/numaflow
Pull request #179 (2022-09-19 23:14:30)

fix: use scale.max if it is set
Signed-off-by: Derek Wang <whynowy@gmail.com>

Explain what this PR does.

<!--

Before you push your changes:

* Run `make pre-push -B` to fix codegen and lint problems.

Then, you MUST:

* Sign-off your commit (otherwise the DCO check will fail).
* Use [a conventional commit message](https://www.conventionalcommits.org/en/v1.0.0/) (otherwise the commit message check will fail).

If you did not do this, reset all your commit and replace them with a single commit:

```
git reset HEAD~1 ;# change 1 to how many commits you made
git commit --signoff -m 'feat: my feat. Fixes #1234'
```

When creating your PR: 

* Make sure that "Fixes #" or "Closes #" is in both the PR title (for release notes) and description (to automatically link and close the issue).
* Say how you tested your changes. If you changed the UI, attach screenshots.
* Set your PR as a draft initially.
* Your PR needs to pass the required checks before it can be approved. 
* Once required tests have passed, mark your PR "Ready for review".

If changes were requested, once you've made them, you MUST dismiss the review to get it reviewed again.

-->



Patch:
diff --git a/pkg/apis/numaflow/v1alpha1/vertex_types.go b/pkg/apis/numaflow/v1alpha1/vertex_types.go
index 4fff97c8..51404c32 100644
--- a/pkg/apis/numaflow/v1alpha1/vertex_types.go
+++ b/pkg/apis/numaflow/v1alpha1/vertex_types.go
@@ -469,7 +469,7 @@ func (s Scale) GetMinReplicas() int32 {
 }
 
 func (s Scale) GetMaxReplicas() int32 {
-	if x := s.Max; x == nil || *x > DefaultMaxReplicas {
+	if x := s.Max; x == nil {
 		return DefaultMaxReplicas
 	} else {
 		return *x


Test patch:
diff --git a/pkg/apis/numaflow/v1alpha1/vertex_types_test.go b/pkg/apis/numaflow/v1alpha1/vertex_types_test.go
index b9ce79a3..3f02e6de 100644
--- a/pkg/apis/numaflow/v1alpha1/vertex_types_test.go
+++ b/pkg/apis/numaflow/v1alpha1/vertex_types_test.go
@@ -407,4 +407,6 @@ func Test_Scale_Parameters(t *testing.T) {
 	assert.Equal(t, int(tbu), s.GetTargetBufferUsage())
 	assert.Equal(t, int(tps), s.GetTargetProcessingSeconds())
 	assert.Equal(t, int(zrss), s.GetZeroReplicaSleepSeconds())
+	s.Max = pointer.Int32(500)
+	assert.Equal(t, int32(500), s.GetMaxReplicas())
 }