forked from argoproj/argo-cd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add ENV variable to configure GRPC Keep Alive Time (argoproj#15656…
…) (argoproj#15806) * Add ENV variables to configure GRPC Keep Alive Time Signed-off-by: Bhavika Sharma <bsharma@splunk.com> * Retrigger CI pipeline Signed-off-by: Bhavika Sharma <bsharma@splunk.com> * Resolve conflict with master Signed-off-by: Bhavika Sharma <bsharma@splunk.com> * Update docs/user-guide/environment-variables.md Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: BhavikaSharma <BhavikaSharma@users.noreply.github.com> --------- Signed-off-by: Bhavika Sharma <bsharma@splunk.com> Signed-off-by: BhavikaSharma <BhavikaSharma@users.noreply.github.com> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
- Loading branch information
Showing
8 changed files
with
72 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package common | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
// Test env var not set for EnvGRPCKeepAliveMin | ||
func Test_GRPCKeepAliveMinNotSet(t *testing.T) { | ||
grpcKeepAliveMin := GetGRPCKeepAliveEnforcementMinimum() | ||
grpcKeepAliveExpectedMin := defaultGRPCKeepAliveEnforcementMinimum | ||
assert.Equal(t, grpcKeepAliveExpectedMin, grpcKeepAliveMin) | ||
|
||
grpcKeepAliveTime := GetGRPCKeepAliveTime() | ||
assert.Equal(t, 2*grpcKeepAliveExpectedMin, grpcKeepAliveTime) | ||
} | ||
|
||
// Test valid env var set for EnvGRPCKeepAliveMin | ||
func Test_GRPCKeepAliveMinIsSet(t *testing.T) { | ||
numSeconds := 15 | ||
os.Setenv(EnvGRPCKeepAliveMin, fmt.Sprintf("%ds", numSeconds)) | ||
|
||
grpcKeepAliveMin := GetGRPCKeepAliveEnforcementMinimum() | ||
grpcKeepAliveExpectedMin := time.Duration(numSeconds) * time.Second | ||
assert.Equal(t, grpcKeepAliveExpectedMin, grpcKeepAliveMin) | ||
|
||
grpcKeepAliveTime := GetGRPCKeepAliveTime() | ||
assert.Equal(t, 2*grpcKeepAliveExpectedMin, grpcKeepAliveTime) | ||
} | ||
|
||
// Test invalid env var set for EnvGRPCKeepAliveMin | ||
func Test_GRPCKeepAliveMinIncorrectlySet(t *testing.T) { | ||
numSeconds := 15 | ||
os.Setenv(EnvGRPCKeepAliveMin, fmt.Sprintf("%d", numSeconds)) | ||
|
||
grpcKeepAliveMin := GetGRPCKeepAliveEnforcementMinimum() | ||
grpcKeepAliveExpectedMin := defaultGRPCKeepAliveEnforcementMinimum | ||
assert.Equal(t, grpcKeepAliveExpectedMin, grpcKeepAliveMin) | ||
|
||
grpcKeepAliveTime := GetGRPCKeepAliveTime() | ||
assert.Equal(t, 2*grpcKeepAliveExpectedMin, grpcKeepAliveTime) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters