-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: make heartbeat interval configurable
Signed-off-by: Alex Castilio dos Santos <[email protected]>
- Loading branch information
1 parent
0c019cb
commit 381a090
Showing
15 changed files
with
157 additions
and
11 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package config_test | ||
|
||
import ( | ||
"errors" | ||
"testing" | ||
"time" | ||
|
||
"github.com/microsoft/retina/operator/config" | ||
) | ||
|
||
func TestGetConfig(t *testing.T) { | ||
c, err := config.GetConfig("./testwith/config.yaml") | ||
if err != nil { | ||
t.Errorf("Expected no error, instead got %+v", err) | ||
} | ||
|
||
if !c.InstallCRDs || | ||
!c.EnableTelemetry || | ||
c.LogLevel != "info" || | ||
!c.EnableRetinaEndpoint || | ||
!c.RemoteContext || | ||
c.TelemetryInterval != 15*time.Minute { | ||
t.Errorf("Expeted config should be same as ./testwith/config.yaml; instead got %+v", c) | ||
} | ||
} | ||
|
||
func TestGetConfig_DefaultTelemetryInterval(t *testing.T) { | ||
c, err := config.GetConfig("./testwith/config-without-telemetry-interval.yaml") | ||
if err != nil { | ||
t.Errorf("Expected no error, instead got %+v", err) | ||
} | ||
|
||
if c.TelemetryInterval != config.DefaultTelemetryInterval { | ||
t.Errorf("Expected telemetry interval to be %v, instead got %v", config.DefaultTelemetryInterval, c.TelemetryInterval) | ||
} | ||
} | ||
|
||
func TestGetConfig_SmallTelemetryInterval(t *testing.T) { | ||
_, err := config.GetConfig("./testwith/config-small-telemetry-interval.yaml") | ||
if !errors.Is(err, config.ErrorTelemetryIntervalTooSmall) { | ||
t.Errorf("Expected error %s, instead got %s", config.ErrorTelemetryIntervalTooSmall, err) | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
operator/config/testwith/config-small-telemetry-interval.yaml
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,9 @@ | ||
apiServer: | ||
host: "0.0.0.0" | ||
port: 10093 | ||
installCRDs: true | ||
enableTelemetry: true | ||
logLevel: info | ||
enableRetinaEndpoint: true | ||
remoteContext: true | ||
telemetryInterval: "10s" |
8 changes: 8 additions & 0 deletions
8
operator/config/testwith/config-without-telemetry-interval.yaml
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,8 @@ | ||
apiServer: | ||
host: "0.0.0.0" | ||
port: 10093 | ||
installCRDs: true | ||
enableTelemetry: true | ||
logLevel: info | ||
enableRetinaEndpoint: true | ||
remoteContext: true |
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,9 @@ | ||
apiServer: | ||
host: "0.0.0.0" | ||
port: 10093 | ||
installCRDs: true | ||
enableTelemetry: true | ||
logLevel: info | ||
enableRetinaEndpoint: true | ||
remoteContext: true | ||
telemetryInterval: "15m" |
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,12 @@ | ||
apiServer: | ||
host: "0.0.0.0" | ||
port: 10093 | ||
# Supported - debug, info, error, warn, panic, fatal. | ||
logLevel: info | ||
enabledPlugin: ["dropreason", "packetforward", "linuxutil"] | ||
# Interval, in seconds, to scrape/publish metrics. | ||
metricsIntervalDuration: "10s" | ||
# used to export telemetry to AppInsights | ||
telemetryEnabled: true | ||
dataAggregationLevel: "low" | ||
telemetryInterval: "10s" |
11 changes: 11 additions & 0 deletions
11
pkg/config/testwith/config-without-telemetry-interval.yaml
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,11 @@ | ||
apiServer: | ||
host: "0.0.0.0" | ||
port: 10093 | ||
# Supported - debug, info, error, warn, panic, fatal. | ||
logLevel: info | ||
enabledPlugin: ["dropreason", "packetforward", "linuxutil"] | ||
# Interval, in seconds, to scrape/publish metrics. | ||
metricsIntervalDuration: "10s" | ||
# used to export telemetry to AppInsights | ||
telemetryEnabled: true | ||
dataAggregationLevel: "low" |
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