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

Side by Side Diff: deploytool/cmd/version_test.go

Issue 2182213002: deploytool: Add README.md, migrate docs to it. (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Rename to "luci_deploy" Created 4 years, 4 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
« no previous file with comments | « deploytool/cmd/version.go ('k') | deploytool/cmd/work.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 package main
6
7 import (
8 "testing"
9
10 "github.com/luci/luci-go/deploytool/api/deploy"
11
12 . "github.com/smartystreets/goconvey/convey"
13 )
14
15 func TestCloudProjectVersion(t *testing.T) {
16 Convey(`A cloud project version`, t, func() {
17 b := cloudProjectVersionBuilder{
18 currentUser: func() (string, error) {
19 return "test-person", nil
20 },
21 }
22 cp := layoutDeploymentCloudProject{
23 Deployment_CloudProject: &deploy.Deployment_CloudProject {
24 VersionScheme: deploy.Deployment_CloudProject_DE FAULT,
25 },
26 }
27 src := layoutSource{
28 FrozenLayout_Source: &deploy.FrozenLayout_Source{
29 MinorVersion: "--minor",
30 MajorVersion: "major",
31 },
32 sg: &layoutSourceGroup{
33 FrozenLayout_SourceGroup: &deploy.FrozenLayout_S ourceGroup{},
34 },
35 }
36
37 Convey(`Renders and parses without a tainted user.`, func() {
38 v, err := b.build(&cp, &src)
39 So(err, ShouldBeNil)
40
41 s := v.String()
42 So(s, ShouldEqual, "__minor-major")
43
44 parsed, err := parseCloudProjectVersion(deploy.Deploymen t_CloudProject_DEFAULT, s)
45 So(err, ShouldBeNil)
46 So(parsed, ShouldResemble, v)
47 })
48
49 Convey(`Renders and parses with a tainted user.`, func() {
50 src.sg.Tainted = true
51
52 v, err := b.build(&cp, &src)
53 So(err, ShouldBeNil)
54
55 s := v.String()
56 So(s, ShouldEqual, "__minor-major-tainted-test_person")
57
58 parsed, err := parseCloudProjectVersion(deploy.Deploymen t_CloudProject_DEFAULT, s)
59 So(err, ShouldBeNil)
60 So(parsed, ShouldResemble, v)
61 })
62 })
63 }
OLDNEW
« no previous file with comments | « deploytool/cmd/version.go ('k') | deploytool/cmd/work.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698