Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Side by Side Diff: appengine/logdog/coordinator/endpoints/logs/get_test.go

Issue 1838803002: LogDog: BigTable batching schema. (Closed) Base URL: https://github.com/luci/luci-go@recordio-split
Patch Set: Minor comments and quality of code tweaks. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package logs 5 package logs
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "errors" 9 "errors"
10 "fmt" 10 "fmt"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } { 248 } {
249 is := "is" 249 is := "is"
250 if !v { 250 if !v {
251 is += " not" 251 is += " not"
252 } 252 }
253 253
254 Convey(fmt.Sprintf(`When the log %s archived`, is), func () { 254 Convey(fmt.Sprintf(`When the log %s archived`, is), func () {
255 if !v { 255 if !v {
256 // Add the logs to the in-memory tempora ry storage. 256 // Add the logs to the in-memory tempora ry storage.
257 for _, le := range entries { 257 for _, le := range entries {
258 » » » » » » err := ms.Put(&storage.PutReques t{ 258 » » » » » » err := ms.Put(storage.PutRequest {
259 » » » » » » » Path: ls.Path(), 259 » » » » » » » Path: ls.Path(),
260 » » » » » » » Index: types.MessageInde x(le.StreamIndex), 260 » » » » » » » Index: types.MessageInd ex(le.StreamIndex),
261 » » » » » » » Value: protobufs[le.Stre amIndex], 261 » » » » » » » Values: [][]byte{protobu fs[le.StreamIndex]},
262 }) 262 })
263 if err != nil { 263 if err != nil {
264 panic(fmt.Errorf("failed to Put() LogEntry: %v", err)) 264 panic(fmt.Errorf("failed to Put() LogEntry: %v", err))
265 } 265 }
266 } 266 }
267 } else { 267 } else {
268 // Archive this log stream. We will gene rate one index entry for every 268 // Archive this log stream. We will gene rate one index entry for every
269 // 2 log entries. 269 // 2 log entries.
270 src := staticArchiveSource(entries) 270 src := staticArchiveSource(entries)
271 var lbuf, ibuf bytes.Buffer 271 var lbuf, ibuf bytes.Buffer
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 }) 434 })
435 435
436 Convey(`Will return Internal if the prot obuf log entry data is corrupt.`, func() { 436 Convey(`Will return Internal if the prot obuf log entry data is corrupt.`, func() {
437 if v { 437 if v {
438 // Corrupt the archive d atastream. 438 // Corrupt the archive d atastream.
439 stream := gsc.get("testb ucket", "stream") 439 stream := gsc.get("testb ucket", "stream")
440 zeroRecords(stream) 440 zeroRecords(stream)
441 } else { 441 } else {
442 // Add corrupted entry t o Storage. Create a new entry here, since 442 // Add corrupted entry t o Storage. Create a new entry here, since
443 // the storage will reje ct a duplicate/overwrite. 443 // the storage will reje ct a duplicate/overwrite.
444 » » » » » » » err := ms.Put(&storage.P utRequest{ 444 » » » » » » » err := ms.Put(storage.Pu tRequest{
445 » » » » » » » » Path: types.Str eamPath(req.Path), 445 » » » » » » » » Path: types.St reamPath(req.Path),
446 » » » » » » » » Index: 666, 446 » » » » » » » » Index: 666,
447 » » » » » » » » Value: []byte{0x 00}, // Invalid protobuf, zero tag. 447 » » » » » » » » Values: [][]byte {{0x00}}, // Invalid protobuf, zero tag.
448 }) 448 })
449 if err != nil { 449 if err != nil {
450 panic(err) 450 panic(err)
451 } 451 }
452 req.Index = 666 452 req.Index = 666
453 } 453 }
454 454
455 _, err := s.Get(c, &req) 455 _, err := s.Get(c, &req)
456 So(err, ShouldBeRPCInternal) 456 So(err, ShouldBeRPCInternal)
457 }) 457 })
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 resp, err := s.Tail(c, &req) 569 resp, err := s.Tail(c, &req)
570 So(err, ShouldBeRPCOK) 570 So(err, ShouldBeRPCOK)
571 So(resp, shouldHaveLogs, 7) 571 So(resp, shouldHaveLogs, 7)
572 So(resp.State, ShouldResemble, l oadLogStreamState(ls)) 572 So(resp.State, ShouldResemble, l oadLogStreamState(ls))
573 }) 573 })
574 }) 574 })
575 }) 575 })
576 } 576 }
577 }) 577 })
578 } 578 }
OLDNEW
« no previous file with comments | « appengine/logdog/coordinator/endpoints/logs/get.go ('k') | common/gcloud/pubsub/subscriber/source.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698