From cf461803fe15f5acaac159c02babcd37b1d920b1 Mon Sep 17 00:00:00 2001 From: Alexandre Yang Date: Fri, 6 Dec 2024 13:03:34 +0100 Subject: [PATCH] [HA Agent] Fix typo and use correct term (#31826) --- comp/haagent/def/component.go | 2 +- comp/haagent/impl/config.go | 2 +- comp/haagent/impl/haagent_test.go | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/comp/haagent/def/component.go b/comp/haagent/def/component.go index 7115988e5501b..bc5038265b76f 100644 --- a/comp/haagent/def/component.go +++ b/comp/haagent/def/component.go @@ -20,7 +20,7 @@ type Component interface { GetState() State // SetLeader takes the leader agent hostname as input, if it matches the current agent hostname, - // the isLeader state is set to true, otherwise false. + // the state is set to active, otherwise standby. SetLeader(leaderAgentHostname string) // ShouldRunIntegration returns true if the integration should be run diff --git a/comp/haagent/impl/config.go b/comp/haagent/impl/config.go index dc55f791264fc..2a6c4e20a8d12 100644 --- a/comp/haagent/impl/config.go +++ b/comp/haagent/impl/config.go @@ -10,7 +10,7 @@ import ( ) // validHaIntegrations represent the list of integrations that will be considered as -// an "HA Integration", meaning it will only run on the leader Agent. +// an "HA Integration", meaning it will only run on the active Agent. // At the moment, the list of HA Integrations is hardcoded here, but we might provide // more dynamic way to configure which integration should be considered HA Integration. var validHaIntegrations = map[string]bool{ diff --git a/comp/haagent/impl/haagent_test.go b/comp/haagent/impl/haagent_test.go index a83822de20431..88b1397f70456 100644 --- a/comp/haagent/impl/haagent_test.go +++ b/comp/haagent/impl/haagent_test.go @@ -57,7 +57,7 @@ func Test_GetGroup(t *testing.T) { assert.Equal(t, "my-group-01", haAgent.GetGroup()) } -func Test_IsLeader_SetLeader(t *testing.T) { +func Test_GetState(t *testing.T) { agentConfigs := map[string]interface{}{ "hostname": "my-agent-hostname", } @@ -201,7 +201,7 @@ func Test_haAgentImpl_ShouldRunIntegration(t *testing.T) { }, }, { - name: "ha agent enabled and agent is not leader", + name: "ha agent enabled and agent is not active", // should skip HA-integrations // should run "non HA integrations" agentConfigs: map[string]interface{}{ @@ -209,7 +209,7 @@ func Test_haAgentImpl_ShouldRunIntegration(t *testing.T) { "ha_agent.enabled": true, "ha_agent.group": testGroup, }, - leader: "another-agent-is-leader", + leader: "another-agent-is-active", expectShouldRunIntegration: map[string]bool{ "snmp": false, "cisco_aci": false,