Skip to content

Commit

Permalink
features missing defaults (#43)
Browse files Browse the repository at this point in the history
* features missing defaults and fixed tests

Co-authored-by: o.omahony <[email protected]>
  • Loading branch information
oliveromahony and o.omahony authored Sep 9, 2022
1 parent 1695327 commit bcf7ef2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ func main() {
log.Infof("setting displayName to %s", loadedConfig.DisplayName)
}

log.Infof("NGINX Agent %s at %s with pid %d, clientID=%s name=%s",
version, commit, os.Getpid(), loadedConfig.ClientID, loadedConfig.DisplayName)
log.Infof("NGINX Agent %s at %s with pid %d, clientID=%s name=%s features=%v",
version, commit, os.Getpid(), loadedConfig.ClientID, loadedConfig.DisplayName, loadedConfig.Features)
sdkGRPC.InitMeta(loadedConfig.ClientID, loadedConfig.CloudAccountID)

controller, commander, reporter := createGrpcClients(ctx, loadedConfig)
Expand Down
1 change: 1 addition & 0 deletions src/core/config/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ var (
&StringSliceFlag{
Name: FeaturesKey,
Usage: "A comma-separated list of features enabled for the agent.",
DefaultValue: Defaults.Features,
},
// NGINX Config
&StringFlag{
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/dataplane_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,23 @@ func TestDPSSyncAgentConfigChange(t *testing.T) {
testName: "ValuesToUpdate",
config: &config.Config{
Tags: tutils.InitialConfTags,
Features: config.Defaults.Features,
},
expUpdatedConfig: &config.Config{
Tags: updateTags,
Features: config.Defaults.Features,
},
updatedTags: true,
},
{
testName: "NoValuesToUpdate",
config: &config.Config{
Tags: tutils.InitialConfTags,
Features: config.Defaults.Features,
},
expUpdatedConfig: &config.Config{
Tags: tutils.InitialConfTags,
Features: config.Defaults.Features,
},
updatedTags: false,
},
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ func TestMetrics_Process_AgentConfigChanged(t *testing.T) {
CollectionInterval: 10,
Mode: "streaming",
},
Features: config.Defaults.Features,
},
expUpdatedConfig: &config.Config{
ClientID: "12345",
Expand All @@ -221,6 +222,7 @@ func TestMetrics_Process_AgentConfigChanged(t *testing.T) {
CollectionInterval: 10,
Mode: "aggregated",
},
Features: config.Defaults.Features,
},
updatedTags: false,
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bcf7ef2

Please sign in to comment.