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

Side by Side Diff: go/src/infra/tools/kitchen/cook_logdog_test.go

Issue 2146403002: Kitchen: Generate LogDog prefix from Swarming. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Kitchen: Generate LogDog prefix from Swarming. Created 4 years, 5 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package main
6
7 import (
8 "testing"
9
10 "github.com/luci/luci-go/common/environ"
11 "github.com/luci/luci-go/common/logdog/types"
12
13 . "github.com/luci/luci-go/common/testing/assertions"
14 . "github.com/smartystreets/goconvey/convey"
15 )
16
17 func TestCookLogDogPrefix(t *testing.T) {
18 Convey(`With a fake environment`, t, func() {
19 env := environ.New([]string{
20 "SWARMING_SERVER=server.appspot.com",
21 "SWARMING_TASK_ID=1234567890abcdef",
22 })
23
24 Convey(`Can generate a LogDog prefix`, func() {
25 p, err := getLogdogPrefix(env)
26 So(err, ShouldBeNil)
27 So(p, ShouldEqual, types.StreamName("swarm/server.appspo t.com/1234567890abcdef"))
28 })
29
30 Convey(`If Swarming server is missing from the environment, will fail.`, func() {
31 env.Set("SWARMING_SERVER", "")
32
33 _, err := getLogdogPrefix(env)
34 So(err, ShouldErrLike, "failed to get swarming task para meters")
35 })
36
37 Convey(`If Swarming task ID is missing from the environment, wil l fail.`, func() {
38 env.Set("SWARMING_TASK_ID", "")
39
40 _, err := getLogdogPrefix(env)
41 So(err, ShouldErrLike, "failed to get swarming task para meters")
42 })
43 })
44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698