v1.8.1
This commit is contained in:
@@ -51,16 +51,21 @@ func getBytesFromJSON(fileName string, t *testing.T) []byte {
|
||||
|
||||
func getErrorsFromJSON(bytes []byte, t *testing.T, cloud string) {
|
||||
var requests map[string]interface{}
|
||||
var logFileName string
|
||||
|
||||
switch cloud {
|
||||
case "cloudapi":
|
||||
requests = getRequestsMapCloudAPI()
|
||||
logFileName = "test_requests_cloudAPI.log"
|
||||
case "cloudbroker":
|
||||
requests = getRequestsMapCloudbroker()
|
||||
logFileName = "test_requests_cloudbroker.log"
|
||||
default:
|
||||
t.Fatalf("Wrong cloud provided, expected `cloudapi` or `cloudbroker`, got %s", cloud)
|
||||
}
|
||||
|
||||
var dataLogs []string
|
||||
|
||||
paths, err := getMapFromFile(bytes)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
@@ -131,14 +136,19 @@ func getErrorsFromJSON(bytes []byte, t *testing.T, cloud string) {
|
||||
}
|
||||
}
|
||||
if len(errs) > 0 {
|
||||
t.Errorf("Path %s has following errors: %v", k, errs)
|
||||
msg := fmt.Sprintf("Path %s has following errors: %v", k, errs)
|
||||
t.Error(msg)
|
||||
dataLogs = append(dataLogs, msg)
|
||||
}
|
||||
}
|
||||
|
||||
if len(requests) != i {
|
||||
t.Errorf("Amount of structure checked (%d) is not the same as amount of platform requests available (%d), please check getRequestsMapCloudAPI func in code.",
|
||||
msg := fmt.Sprintf("Amount of structure checked (%d) is not the same as amount of platform requests available (%d), please check getRequestsMapCloudAPI func in code.",
|
||||
i, len(requests))
|
||||
t.Error(msg)
|
||||
dataLogs = append(dataLogs, msg)
|
||||
}
|
||||
compareLogs(logFileName, dataLogs, t, "request")
|
||||
}
|
||||
|
||||
// checkName checks if name field from platform has the same value as json tag in golang structure (maybe including omitempty)
|
||||
@@ -211,8 +221,13 @@ func checkKind(platformType, items string, typ reflect.Type) bool {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
default: // for cases like dataDisks etc.
|
||||
return true
|
||||
|
||||
}
|
||||
|
||||
default: // for cases like drivers etc
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user