Stackdriver Logging e2e: Explicitly check for docker and kubelet logs presence

This commit is contained in:
Mik Vyatskov
2017-08-18 13:18:49 +02:00
parent bd5e2d5878
commit cd23c5d1b0
4 changed files with 39 additions and 11 deletions

View File

@@ -315,23 +315,27 @@ func (p *sdLogProvider) tryGetName(sdLogEntry sd.LogEntry) (string, bool) {
return "", false
}
func convertLogEntry(sdLogEntry sd.LogEntry) (utils.LogEntry, error) {
func convertLogEntry(sdLogEntry sd.LogEntry) (entry utils.LogEntry, err error) {
entry = utils.LogEntry{LogName: sdLogEntry.LogName}
if sdLogEntry.TextPayload != "" {
return utils.LogEntry{TextPayload: sdLogEntry.TextPayload}, nil
entry.TextPayload = sdLogEntry.TextPayload
return
}
bytes, err := sdLogEntry.JsonPayload.MarshalJSON()
if err != nil {
return utils.LogEntry{}, fmt.Errorf("Failed to get jsonPayload from LogEntry %v", sdLogEntry)
err = fmt.Errorf("Failed to get jsonPayload from LogEntry %v", sdLogEntry)
return
}
var jsonObject map[string]interface{}
err = json.Unmarshal(bytes, &jsonObject)
if err != nil {
return utils.LogEntry{},
fmt.Errorf("Failed to deserialize jsonPayload as json object %s", string(bytes[:]))
err = fmt.Errorf("Failed to deserialize jsonPayload as json object %s", string(bytes[:]))
return
}
return utils.LogEntry{JSONPayload: jsonObject}, nil
entry.JSONPayload = jsonObject
return
}
func pullAndAck(service *pubsub.Service, subs *pubsub.Subscription) ([]*pubsub.ReceivedMessage, error) {