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

Side by Side Diff: appengine/logdog/coordinator/logStream_test.go

Issue 1910923002: LogDog: Add project namespace to service endpoint. (Closed) Base URL: https://github.com/luci/luci-go@logdog-project-coordinator-backend
Patch Set: Comments. Created 4 years, 7 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 coordinator 5 package coordinator
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "fmt" 9 "fmt"
10 "testing" 10 "testing"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 di.Testable().AutoIndex(true) 91 di.Testable().AutoIndex(true)
92 di.Testable().Consistent(true) 92 di.Testable().Consistent(true)
93 93
94 now := ds.RoundTime(tc.Now().UTC()) 94 now := ds.RoundTime(tc.Now().UTC())
95 95
96 ls := LogStream{ 96 ls := LogStream{
97 Prefix: "testing", 97 Prefix: "testing",
98 Name: "log/stream", 98 Name: "log/stream",
99 State: LSStreaming, 99 State: LSStreaming,
100 TerminalIndex: -1, 100 TerminalIndex: -1,
101 » » » Secret: bytes.Repeat([]byte{0x6F}, types.StreamSe cretLength), 101 » » » Secret: bytes.Repeat([]byte{0x6F}, types.PrefixSe cretLength),
102 Created: now.UTC(), 102 Created: now.UTC(),
103 ContentType: string(types.ContentTypeText), 103 ContentType: string(types.ContentTypeText),
104 } 104 }
105 ls.recalculateHashID() 105 ls.recalculateHashID()
106 106
107 desc := logpb.LogStreamDescriptor{ 107 desc := logpb.LogStreamDescriptor{
108 Prefix: "testing", 108 Prefix: "testing",
109 Name: "log/stream", 109 Name: "log/stream",
110 StreamType: logpb.StreamType_TEXT, 110 StreamType: logpb.StreamType_TEXT,
111 ContentType: "application/text", 111 ContentType: "application/text",
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 So(ls.Validate(), ShouldErrLike, "invali d prefix") 148 So(ls.Validate(), ShouldErrLike, "invali d prefix")
149 }) 149 })
150 Convey(`Without a valid Name`, func() { 150 Convey(`Without a valid Name`, func() {
151 ls.Name = "" 151 ls.Name = ""
152 ls.recalculateHashID() 152 ls.recalculateHashID()
153 153
154 So(ls.Validate(), ShouldErrLike, "invali d name") 154 So(ls.Validate(), ShouldErrLike, "invali d name")
155 }) 155 })
156 Convey(`Without a valid stream secret`, func() { 156 Convey(`Without a valid stream secret`, func() {
157 ls.Secret = nil 157 ls.Secret = nil
158 » » » » » So(ls.Validate(), ShouldErrLike, "invali d secret length") 158 » » » » » So(ls.Validate(), ShouldErrLike, "invali d prefix secret length")
159 }) 159 })
160 Convey(`Without a valid content type`, func() { 160 Convey(`Without a valid content type`, func() {
161 ls.ContentType = "" 161 ls.ContentType = ""
162 So(ls.Validate(), ShouldErrLike, "empty content type") 162 So(ls.Validate(), ShouldErrLike, "empty content type")
163 }) 163 })
164 Convey(`Without a valid created time`, func() { 164 Convey(`Without a valid created time`, func() {
165 ls.Created = time.Time{} 165 ls.Created = time.Time{}
166 So(ls.Validate(), ShouldErrLike, "create d time is not set") 166 So(ls.Validate(), ShouldErrLike, "create d time is not set")
167 }) 167 })
168 Convey(`With a terminal index, will not validate without a TerminatedTime.`, func() { 168 Convey(`With a terminal index, will not validate without a TerminatedTime.`, func() {
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 "_C": sps("PF:1:foo", "PR:1:baz", "PR:3:bar"), 441 "_C": sps("PF:1:foo", "PR:1:baz", "PR:3:bar"),
442 }) 442 })
443 }) 443 })
444 444
445 Convey(`Will error if more than one greedy glob is present.`, fu nc() { 445 Convey(`Will error if more than one greedy glob is present.`, fu nc() {
446 _, err := AddLogStreamPathFilter(q, "*/foo/**/bar/**") 446 _, err := AddLogStreamPathFilter(q, "*/foo/**/bar/**")
447 So(err, ShouldErrLike, "cannot have more than one greedy glob") 447 So(err, ShouldErrLike, "cannot have more than one greedy glob")
448 }) 448 })
449 }) 449 })
450 } 450 }
OLDNEW
« no previous file with comments | « appengine/logdog/coordinator/logStream.go ('k') | client/internal/logdog/butler/bundler/bundler.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698