diff --git a/pkg/spdk/engine.go b/pkg/spdk/engine.go index 5b77f920..2baadb91 100644 --- a/pkg/spdk/engine.go +++ b/pkg/spdk/engine.go @@ -126,7 +126,7 @@ func (e *Engine) checkInitiatorAndTargetCreationRequirements(podIP, initiatorIP, targetCreationRequired = true } } else { - err = fmt.Errorf("invalid initiator and target address for engine %s creation", e.Name) + err = fmt.Errorf("invalid initiator and target addresses for engine %s creation with initiator address %v and target address %v", e.Name, initiatorIP, targetIP) } } else if podIP == initiatorIP { e.log.Info("Creating an initiator instance") @@ -135,7 +135,7 @@ func (e *Engine) checkInitiatorAndTargetCreationRequirements(podIP, initiatorIP, e.log.Info("Creating a target instance") targetCreationRequired = true } else { - err = fmt.Errorf("invalid initiator and target address for engine %s creation", e.Name) + err = fmt.Errorf("invalid initiator and target addresses for engine %s creation with initiator address %v and target address %v", e.Name, initiatorIP, targetIP) } return initiatorCreationRequired, targetCreationRequired, err diff --git a/pkg/spdk/engine_test.go b/pkg/spdk/engine_test.go index 10dd1887..f4cba3bf 100644 --- a/pkg/spdk/engine_test.go +++ b/pkg/spdk/engine_test.go @@ -70,7 +70,7 @@ func (s *TestSuite) TestCheckInitiatorAndTargetCreationRequirements(c *C) { expectedError: nil, }, { - name: "Invalid initiator and target address", + name: "Invalid initiator and target addresses", podIP: "192.168.1.1", initiatorIP: "192.168.1.2", targetIP: "192.168.1.3", @@ -79,7 +79,7 @@ func (s *TestSuite) TestCheckInitiatorAndTargetCreationRequirements(c *C) { standbyTargetPort: 0, expectedInitiatorCreationRequired: false, expectedTargetCreationRequired: false, - expectedError: fmt.Errorf("invalid initiator and target address for engine %s creation", "test-engine"), + expectedError: fmt.Errorf("invalid initiator and target addresses for engine test-engine creation with initiator address 192.168.1.2 and target address 192.168.1.3"), }, { name: "Standby target instance is already created", @@ -107,8 +107,11 @@ func (s *TestSuite) TestCheckInitiatorAndTargetCreationRequirements(c *C) { initiatorCreationRequired, targetCreationRequired, err := engine.checkInitiatorAndTargetCreationRequirements(testCase.podIP, testCase.initiatorIP, testCase.targetIP) - c.Assert(initiatorCreationRequired, Equals, testCase.expectedInitiatorCreationRequired) - c.Assert(targetCreationRequired, Equals, testCase.expectedTargetCreationRequired) - c.Assert(err, DeepEquals, testCase.expectedError) + c.Assert(initiatorCreationRequired, Equals, testCase.expectedInitiatorCreationRequired, + Commentf("Test case '%s': unexpected initiator creation requirement", testCase.name)) + c.Assert(targetCreationRequired, Equals, testCase.expectedTargetCreationRequired, + Commentf("Test case '%s': unexpected target creation requirement", testCase.name)) + c.Assert(err, DeepEquals, testCase.expectedError, + Commentf("Test case '%s': unexpected error result", testCase.name)) } }