| Index: cipd/client/cipd/client_test.go
|
| diff --git a/cipd/client/cipd/client_test.go b/cipd/client/cipd/client_test.go
|
| index 5189cd66511a3b40cb31e145125eb3af0bb541b8..a7aaca696ca8c1816fb29fa67aa1a7047cd48d2c 100644
|
| --- a/cipd/client/cipd/client_test.go
|
| +++ b/cipd/client/cipd/client_test.go
|
| @@ -22,7 +22,6 @@ import (
|
| "github.com/luci/luci-go/common/clock"
|
| "github.com/luci/luci-go/common/clock/testclock"
|
| "github.com/luci/luci-go/common/logging/gologger"
|
| - . "github.com/luci/luci-go/common/testing/assertions"
|
|
|
| "github.com/luci/luci-go/cipd/client/cipd/common"
|
| "github.com/luci/luci-go/cipd/client/cipd/internal"
|
| @@ -607,150 +606,6 @@ func TestMaybeUpdateClient(t *testing.T) {
|
| })
|
| }
|
|
|
| -func TestProcessEnsureFile(t *testing.T) {
|
| - ctx := makeTestContext()
|
| -
|
| - call := func(c C, data string, calls []expectedHTTPCall) ([]common.Pin, error) {
|
| - client := mockClient(c, "", calls)
|
| - return client.ProcessEnsureFile(ctx, bytes.NewBufferString(data))
|
| - }
|
| -
|
| - Convey("ProcessEnsureFile works", t, func(c C) {
|
| - out, err := call(c, `
|
| - # Comment
|
| -
|
| - pkg/a 0000000000000000000000000000000000000000
|
| - pkg/b 1000000000000000000000000000000000000000
|
| - `, nil)
|
| - So(err, ShouldBeNil)
|
| - So(out, ShouldResemble, []common.Pin{
|
| - {"pkg/a", "0000000000000000000000000000000000000000"},
|
| - {"pkg/b", "1000000000000000000000000000000000000000"},
|
| - })
|
| - })
|
| -
|
| - Convey("ProcessEnsureFile resolves versions", t, func(c C) {
|
| - out, err := call(c, "pkg/a tag_key:value", []expectedHTTPCall{
|
| - {
|
| - Method: "GET",
|
| - Path: "/_ah/api/repo/v1/instance/resolve",
|
| - Query: url.Values{
|
| - "package_name": []string{"pkg/a"},
|
| - "version": []string{"tag_key:value"},
|
| - },
|
| - Reply: `{"status":"SUCCESS","instance_id":"0000000000000000000000000000000000000000"}`,
|
| - },
|
| - })
|
| - So(err, ShouldBeNil)
|
| - So(out, ShouldResemble, []common.Pin{
|
| - {"pkg/a", "0000000000000000000000000000000000000000"},
|
| - })
|
| - })
|
| -
|
| - Convey("ProcessEnsureFile empty", t, func(c C) {
|
| - out, err := call(c, "", nil)
|
| - So(err, ShouldBeNil)
|
| - So(out, ShouldResemble, []common.Pin{})
|
| - })
|
| -
|
| - Convey("ProcessEnsureFile bad package name", t, func(c C) {
|
| - _, err := call(c, "bad.package.name/a 0000000000000000000000000000000000000000", nil)
|
| - So(err, ShouldNotBeNil)
|
| - })
|
| -
|
| - Convey("ProcessEnsureFile bad version", t, func(c C) {
|
| - _, err := call(c, "pkg/a NO-A-REF", nil)
|
| - So(err, ShouldNotBeNil)
|
| - })
|
| -
|
| - Convey("ProcessEnsureFile bad line", t, func(c C) {
|
| - _, err := call(c, "pkg/a", nil)
|
| - So(err, ShouldNotBeNil)
|
| - })
|
| -
|
| - Convey("ProcessEnsureFile template package", t, func() {
|
| - Convey("simple expansion", func() {
|
| - Convey("success", func() {
|
| - pkg, _ := expandTemplate("something/${platform}-${arch}", "windows", "amd64")
|
| - So(pkg, ShouldEqual, "something/windows-amd64")
|
| - })
|
| -
|
| - Convey("lonesome", func() {
|
| - pkg, _ := expandTemplate("${platform}", "windows", "amd64")
|
| - So(pkg, ShouldEqual, "windows")
|
| - })
|
| -
|
| - Convey("missing close brace", func() {
|
| - _, err := expandTemplate("something/${notvar", "windows", "amd64")
|
| - So(err, ShouldErrLike, "unable to process")
|
| - })
|
| -
|
| - Convey("missing open brace", func() {
|
| - _, err := expandTemplate("something/$notvar}", "windows", "amd64")
|
| - So(err, ShouldErrLike, "unable to process")
|
| - })
|
| -
|
| - Convey("bad var", func() {
|
| - _, err := expandTemplate("something/${notvar}", "windows", "amd64")
|
| - So(err, ShouldErrLike, "unknown variable in ${notvar}")
|
| - })
|
| - })
|
| -
|
| - Convey("matchlist expansion", func() {
|
| - Convey("success, accepted", func() {
|
| - Convey("typical", func() {
|
| - pkg, err := expandTemplate("something/${platform=linux,windows}", "windows", "amd64")
|
| - So(err, ShouldBeNil)
|
| - So(pkg, ShouldEqual, "something/windows")
|
| - })
|
| -
|
| - Convey("typical 2", func() {
|
| - pkg, err := expandTemplate("something/${platform=linux,windows}-${arch=amd64,386}", "windows", "amd64")
|
| - So(err, ShouldBeNil)
|
| - So(pkg, ShouldEqual, "something/windows-amd64")
|
| - })
|
| -
|
| - Convey("lonesome", func() {
|
| - pkg, _ := expandTemplate("${platform=windows}", "windows", "amd64")
|
| - So(pkg, ShouldEqual, "windows")
|
| - })
|
| -
|
| - Convey("lonesome 2", func() {
|
| - pkg, _ := expandTemplate("${platform=windows,linux}${arch=386,amd64}", "windows", "amd64")
|
| - So(pkg, ShouldEqual, "windowsamd64")
|
| - })
|
| - })
|
| -
|
| - Convey("success, ignored", func() {
|
| - Convey("typical", func() {
|
| - _, err := expandTemplate("something/${platform=linux,windows}", "mac", "amd64")
|
| - So(err, ShouldEqual, errSkipTemplate)
|
| - })
|
| -
|
| - Convey("typical 2", func() {
|
| - _, err := expandTemplate("something/${platform=linux,windows}-${arch=amd64,386}", "windows", "armv6l")
|
| - So(err, ShouldEqual, errSkipTemplate)
|
| - })
|
| -
|
| - Convey("lonesome", func() {
|
| - _, err := expandTemplate("${platform=windows}", "linux", "amd64")
|
| - So(err, ShouldEqual, errSkipTemplate)
|
| - })
|
| -
|
| - Convey("lonesome 2", func() {
|
| - _, err := expandTemplate("${platform=windows,linux}${arch=386,amd64}", "mac", "armv6l")
|
| - So(err, ShouldEqual, errSkipTemplate)
|
| - })
|
| - })
|
| -
|
| - Convey("bad var", func() {
|
| - _, err := expandTemplate("something/${wutlol=mac}", "windows", "amd64")
|
| - So(err, ShouldErrLike, "unknown variable in ${wutlol=mac}")
|
| - })
|
| - })
|
| - })
|
| -}
|
| -
|
| func TestListPackages(t *testing.T) {
|
| ctx := makeTestContext()
|
|
|
|
|