mrutkows commented on a change in pull request #649: Support custom errors that
pass in lower-level errors.
URL:
https://github.com/apache/incubator-openwhisk-wskdeploy/pull/649#discussion_r153565622
##########
File path: utils/wskdeployerror_test.go
##########
@@ -133,52 +137,62 @@ func TestCustomErrorOutputFormat(t *testing.T) {
TEST_PARAM_TYPE_FLOAT)
actualResult = strings.TrimSpace(err8.Error())
msg8 := fmt.Sprintf("%s [%s]: %s %s: [%s], %s: [%s]",
- PARAMETER, TEST_PARAM_NAME,
- TYPE,
- EXPECTED, TEST_PARAM_TYPE_INT,
- ACTUAL, TEST_PARAM_TYPE_FLOAT)
- expectedResult = fmt.Sprintf("%s [%d]: [%s]: " + FILE + ": [%s]: %s",
+ STR_PARAMETER, TEST_PARAM_NAME,
+ STR_TYPE,
+ STR_EXPECTED, TEST_PARAM_TYPE_INT,
+ STR_ACTUAL, TEST_PARAM_TYPE_FLOAT)
+ expectedResult = fmt.Sprintf("%s [%d]: [%s]: %s: [%s]: %s",
packageName,
err8.LineNum,
ERROR_YAML_PARAMETER_TYPE_MISMATCH,
+ STR_FILE,
filepath.Base(TEST_EXISTANT_MANIFEST_FILE),
msg8 )
- assert.Equal(t, expectedResult, actualResult, "Expected [" +
expectedResult + "] but got [" + actualResult + "]")
+ assert.Equal(t, expectedResult, actualResult)
/*
* InvalidParameterType
*/
err9 := NewInvalidParameterTypeError(TEST_EXISTANT_MANIFEST_FILE,
TEST_PARAM_NAME, TEST_PARAM_TYPE_FOO)
actualResult = strings.TrimSpace(err9.Error())
msg9 := fmt.Sprintf("%s [%s]: %s [%s]",
- PARAMETER, TEST_PARAM_NAME,
- TYPE, TEST_PARAM_TYPE_FOO)
- expectedResult = fmt.Sprintf("%s [%d]: [%s]: " + FILE + ": [%s]: %s",
+ STR_PARAMETER, TEST_PARAM_NAME,
+ STR_TYPE, TEST_PARAM_TYPE_FOO)
+ expectedResult = fmt.Sprintf("%s [%d]: [%s]: " + STR_FILE + ": [%s]:
%s",
packageName,
err9.LineNum,
ERROR_YAML_INVALID_PARAMETER_TYPE,
filepath.Base(TEST_EXISTANT_MANIFEST_FILE),
msg9 )
- assert.Equal(t, expectedResult, actualResult, "Expected [" +
expectedResult + "] but got [" + actualResult + "]")
+ assert.Equal(t, expectedResult, actualResult)
/*
* YAMLParserErr
*/
- var TEST_LINES = []string{"40", LINE_UNKNOWN, "123"}
- var TEST_MESSAGES = []string{"did not find expected key", "did not find
expected ',' or ']'", "found duplicate %YAML directive"}
- err10 := NewYAMLParserErr(TEST_EXISTANT_MANIFEST_FILE, TEST_LINES,
TEST_MESSAGES)
- actualResult = strings.TrimSpace(err10.Error())
-
- msgs := "\n==> Line [40]: did not find expected key" +
- "\n==> Line [Unknown]: did not find expected ',' or ']'" +
- "\n==> Line [123]: found duplicate %YAML directive"
-
- expectedResult = fmt.Sprintf("%s [%d]: [%s]: " + FILE + ": [%s]: %s",
- packageName,
- err10.LineNum,
- ERROR_YAML_PARSER_ERROR,
- filepath.Base(TEST_EXISTANT_MANIFEST_FILE),
- msgs)
- assert.Equal(t, expectedResult, actualResult, "Expected [" +
expectedResult + "] but got [" + actualResult + "]")
+ // TODO add a unit test once we re-factor error related modules into a
new package
Review comment:
This is intentional see referenced issue 650. I do not want to refactor
using this issue.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services