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

Side by Side Diff: common/logdog/butlerproto/proto_test.go

Issue 1610993002: LogDog: Add collector service implementation. (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Created 4 years, 11 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 butlerproto 5 package butlerproto
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "io" 9 "io"
10 "strings" 10 "strings"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 So(protocol.ButlerMetadata_ContentType_name[int32(unknow nType)], ShouldEqual, "") 75 So(protocol.ButlerMetadata_ContentType_name[int32(unknow nType)], ShouldEqual, "")
76 76
77 md.Type = unknownType 77 md.Type = unknownType
78 push(&md) 78 push(&md)
79 79
80 err := r.Read(&buf) 80 err := r.Read(&buf)
81 So(err, ShouldNotBeNil) 81 So(err, ShouldNotBeNil)
82 So(err, assertions.ShouldErrLike, "unknown data type") 82 So(err, assertions.ShouldErrLike, "unknown data type")
83 }) 83 })
84 84
85 » » Convey(`Will fail to read if an unknown protocol version is iden tified.`, func() { 85 » » Convey(`Will not decode contents if an unknown protocol version is identified.`, func() {
86 // Assert that we are testing an unknown type. 86 // Assert that we are testing an unknown type.
87 md.ProtoVersion = "DEFINITELY NOT VALID" 87 md.ProtoVersion = "DEFINITELY NOT VALID"
88 push(&md) 88 push(&md)
89 push(&bundle) 89 push(&bundle)
90 90
91 » » » err := r.Read(&buf) 91 » » » So(r.Read(&buf), ShouldBeNil)
92 » » » So(err, ShouldNotBeNil) 92 » » » So(r.Bundle, ShouldBeNil)
93 » » » So(err, assertions.ShouldErrLike, "unknown protobuf vers ion")
94 }) 93 })
95 94
96 Convey(`Will fail to read junk metadata.`, func() { 95 Convey(`Will fail to read junk metadata.`, func() {
97 So(writeFrame([]byte{0xd0, 0x6f, 0x00, 0xd5}), ShouldBeN il) 96 So(writeFrame([]byte{0xd0, 0x6f, 0x00, 0xd5}), ShouldBeN il)
98 97
99 err := r.Read(&buf) 98 err := r.Read(&buf)
100 So(err, ShouldNotBeNil) 99 So(err, ShouldNotBeNil)
101 So(err, assertions.ShouldErrLike, "failed to unmarshal M etadata frame") 100 So(err, assertions.ShouldErrLike, "failed to unmarshal M etadata frame")
102 }) 101 })
103 102
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 r, err := read(&buf) 211 r, err := read(&buf)
213 So(err, ShouldBeNil) 212 So(err, ShouldBeNil)
214 So(r.Metadata.Compression, ShouldEqual, protocol.ButlerMetadata_ZLIB) 213 So(r.Metadata.Compression, ShouldEqual, protocol.ButlerMetadata_ZLIB)
215 So(r.Bundle.Source, ShouldEqual, bundle. Source) 214 So(r.Bundle.Source, ShouldEqual, bundle. Source)
216 So(r.Metadata.ProtoVersion, ShouldEqual, protocol.Version) 215 So(r.Metadata.ProtoVersion, ShouldEqual, protocol.Version)
217 }) 216 })
218 }) 217 })
219 }) 218 })
220 }) 219 })
221 } 220 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698