Skip to content

Commit 048f07a

Browse files
committed
Lint isuue fixed for a constant
1 parent 36ddb59 commit 048f07a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

go/ironic-hardware-exporter/internal/parser/node_state_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"time"
66
)
77

8+
const powerStateOn = "power on"
9+
810
// TestParseNodeState_PowerSetEnd checks that a power_set.end event is parsed correctly.
911
func TestParseNodeState_PowerSetEnd(t *testing.T) {
1012
body := readTestData(t, "baremetal_node_power_set.json")
@@ -52,7 +54,7 @@ func TestParseNodeState_ProvisionSetEnd(t *testing.T) {
5254
if msg.ProvisionState == nil || *msg.ProvisionState != "active" {
5355
t.Errorf("expected provision_state=active, got %v", msg.ProvisionState)
5456
}
55-
if msg.PowerState == nil || *msg.PowerState != "power on" {
57+
if msg.PowerState == nil || *msg.PowerState != powerStateOn {
5658
t.Errorf("expected power_state=power on, got %v", msg.PowerState)
5759
}
5860
}
@@ -131,7 +133,7 @@ func TestParseNodeState_MaintenanceSet(t *testing.T) {
131133

132134
// TestParseNodeState_PowerStateCorrected checks that power_state_corrected events are accepted.
133135
func TestParseNodeState_PowerStateCorrected(t *testing.T) {
134-
state := "power on"
136+
state := powerStateOn
135137
body := wrapInOslo(t, versionedMessage{
136138
EventType: "baremetal.node.power_state_corrected",
137139
Payload: versionedPayload{
@@ -147,7 +149,7 @@ func TestParseNodeState_PowerStateCorrected(t *testing.T) {
147149
if msg == nil {
148150
t.Fatal("expected a NodeStateMessage for power_state_corrected, got nil")
149151
}
150-
if msg.PowerState == nil || *msg.PowerState != "power on" {
152+
if msg.PowerState == nil || *msg.PowerState != powerStateOn {
151153
t.Errorf("expected power_state=power on, got %v", msg.PowerState)
152154
}
153155
}

0 commit comments

Comments
 (0)