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

Unified Diff: vpython/cipd/cipd_test.go

Issue 2699223002: vpython: Add CIPD support. (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« vpython/cipd/cipd.go ('K') | « vpython/cipd/cipd.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vpython/cipd/cipd_test.go
diff --git a/vpython/cipd/cipd_test.go b/vpython/cipd/cipd_test.go
new file mode 100644
index 0000000000000000000000000000000000000000..7baeb88d41e2884989b25cbe8bac2aedd0ad6f10
--- /dev/null
+++ b/vpython/cipd/cipd_test.go
@@ -0,0 +1,41 @@
+// Copyright 2017 The LUCI Authors. All rights reserved.
+// Use of this source code is governed under the Apache License, Version 2.0
+// that can be found in the LICENSE file.
+
+package cipd
+
+import (
+ "bytes"
+ "testing"
+
+ "github.com/luci/luci-go/vpython/api/env"
+
+ . "github.com/smartystreets/goconvey/convey"
+)
+
+func TestWriteEnsureFile(t *testing.T) {
+ t.Parallel()
+
+ Convey(`Test manifest generation`, t, func() {
+ var buf bytes.Buffer
+
+ Convey(`Invalid packages will panic.`, func() {
+ pkg := &env.Spec_Package{
+ Path: "foo/bar",
+ }
+ So(validatePackage(pkg), ShouldNotBeNil)
+ So(func() {
+ _ = writeEnsureFile(&buf, []*env.Spec_Package{pkg})
+ }, ShouldPanic)
+ })
+
+ Convey(`Can write a manifest for packages`, func() {
+ err := writeEnsureFile(&buf, []*env.Spec_Package{
+ &env.Spec_Package{"foo/bar", "baz"},
+ &env.Spec_Package{"pants", "key:value"},
+ })
+ So(err, ShouldBeNil)
+ So(buf.String(), ShouldResemble, "foo/bar baz\npants key:value\n")
+ })
+ })
+}
« vpython/cipd/cipd.go ('K') | « vpython/cipd/cipd.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698