Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
Test glide import for branch with semver name
Browse files Browse the repository at this point in the history
  • Loading branch information
carolynvs committed Jun 7, 2017
1 parent 3de8976 commit f2d0d8c
Show file tree
Hide file tree
Showing 13 changed files with 156 additions and 13 deletions.
20 changes: 10 additions & 10 deletions cmd/dep/glide_importer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ func TestGlideConfig_Import(t *testing.T) {
defer sm.Release()

h.TempDir(filepath.Join("src", testGlideProjectRoot))
h.TempCopy(filepath.Join(testGlideProjectRoot, glideYamlName), "glide/glide.yaml")
h.TempCopy(filepath.Join(testGlideProjectRoot, glideLockName), "glide/glide.lock")
h.TempCopy(filepath.Join(testGlideProjectRoot, glideYamlName), "glide/glide0.yaml")
h.TempCopy(filepath.Join(testGlideProjectRoot, glideLockName), "glide/glide0.lock")
projectRoot := h.Path(testGlideProjectRoot)

// Capture stderr so we can verify output
Expand All @@ -68,7 +68,7 @@ func TestGlideConfig_Import(t *testing.T) {
t.Fatal("Expected the lock to be generated")
}

goldenFile := "glide/expected_import_output.txt"
goldenFile := "glide/golden0.txt"
got := verboseOutput.String()
want := h.GetTestFileString(goldenFile)
if want != got {
Expand All @@ -82,7 +82,7 @@ func TestGlideConfig_Import(t *testing.T) {
}
}

func TestGlideConfig_Import2(t *testing.T) {
func TestGlideConfig_Import_BranchWithSemverName(t *testing.T) {
h := test.NewHelper(t)
defer h.Cleanup()

Expand All @@ -92,8 +92,8 @@ func TestGlideConfig_Import2(t *testing.T) {
defer sm.Release()

h.TempDir(filepath.Join("src", testGlideProjectRoot))
h.TempCopy(filepath.Join(testGlideProjectRoot, glideYamlName), "glide/foo/glide.yaml")
h.TempCopy(filepath.Join(testGlideProjectRoot, glideLockName), "glide/foo/glide.lock")
h.TempCopy(filepath.Join(testGlideProjectRoot, glideYamlName), "glide/glide1.yaml")
h.TempCopy(filepath.Join(testGlideProjectRoot, glideLockName), "glide/glide1.lock")
projectRoot := h.Path(testGlideProjectRoot)

// Capture stderr so we can verify output
Expand All @@ -116,7 +116,7 @@ func TestGlideConfig_Import2(t *testing.T) {
t.Fatal("Expected the lock to be generated")
}

goldenFile := "glide/foo/expected_import_output.txt"
goldenFile := "glide/golden1.txt"
got := verboseOutput.String()
want := h.GetTestFileString(goldenFile)
if want != got {
Expand All @@ -138,9 +138,9 @@ func TestGlideConfig_Import_MissingLockFile(t *testing.T) {
h.Must(err)
defer sm.Release()

h.TempDir(filepath.Join("src", "glidetest"))
h.TempCopy(filepath.Join("glidetest", glideYamlName), "glide/glide.yaml")
projectRoot := h.Path("glidetest")
h.TempDir(filepath.Join("src", testGlideProjectRoot))
h.TempCopy(filepath.Join(testGlideProjectRoot, glideYamlName), "glide/glide0.yaml")
projectRoot := h.Path(testGlideProjectRoot)

g := newGlideImporter(ctx.Err, true, sm)
if !g.HasDepMetadata(projectRoot) {
Expand Down
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions cmd/dep/testdata/glide/glide1.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
hash: 3b7d5be7d68cd94765ac91ea2f58b554151f67f5d0bf499ea8cadb600538a0e5
updated: 2017-05-03T15:13:27.629768623+02:00
imports:
- name: github.com/DataDog/datadog-go
version: 0ddda6bee21174ef6c4873647cb0d6ec9cba996f
subpackages:
- statsd
- name: github.com/mikespook/gearman-go
version: b79fee29655dcdce7ba4a738f8388f9862b6779e
subpackages:
- worker
- name: gopkg.in/mgo.v2
version: 29cc868a5ca65f401ff318143f9408d02f4799cc
subpackages:
- bson
- internal/sasl
- internal/scram
devImports: []
14 changes: 14 additions & 0 deletions cmd/dep/testdata/glide/glide1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package: github.com/wondernetwork/go-wiu-backend
import:
- package: github.com/mikespook/gearman-go
version: master
subpackages:
- worker
- package: gopkg.in/mgo.v2
version: v2
subpackages:
- bson
- package: github.com/DataDog/datadog-go
version: ~1.1
subpackages:
- statsd
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Detected glide configuration files...
Converting from glide.yaml and glide.lock...
Using ^0.8.1 as initial constraint for imported dep github.com/sdboyer/deptest
Trying v0.8.1 (3f4c3be) as initial lock for imported dep github.com/sdboyer/deptest
Using master as initial constraint for imported dep github.com/sdboyer/deptest
Using ^2.0.0 as initial constraint for imported dep github.com/sdboyer/deptestdos
Using master as initial constraint for imported dep github.com/golang/lint
Trying v0.8.1 (3f4c3be) as initial lock for imported dep github.com/sdboyer/deptest
Trying v2.0.0 (5c60720) as initial lock for imported dep github.com/sdboyer/deptestdos
Using cb00e56 as initial hint for imported dep github.com/golang/lint
Trying master (cb00e56) as initial lock for imported dep github.com/golang/lint
8 changes: 8 additions & 0 deletions cmd/dep/testdata/glide/golden1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Detected glide configuration files...
Converting from glide.yaml and glide.lock...
Using master as initial constraint for imported dep github.com/mikespook/gearman-go
Using v2 as initial constraint for imported dep gopkg.in/mgo.v2
Using ~1.1.0 as initial constraint for imported dep github.com/DataDog/datadog-go
Trying 1.1.0 (0ddda6b) as initial lock for imported dep github.com/DataDog/datadog-go
Trying master (b79fee2) as initial lock for imported dep github.com/mikespook/gearman-go
Trying v2 (29cc868) as initial lock for imported dep gopkg.in/mgo.v2
27 changes: 27 additions & 0 deletions cmd/dep/testdata/harness_tests/init/glide/case4/final/Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions cmd/dep/testdata/harness_tests/init/glide/case4/final/Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

[[constraint]]
name = "github.com/DataDog/datadog-go"
version = "1.1.0"

[[constraint]]
name = "github.com/mikespook/gearman-go"
version = "0.1.3"

[[constraint]]
branch = "v2"
name = "gopkg.in/mgo.v2"
18 changes: 18 additions & 0 deletions cmd/dep/testdata/harness_tests/init/glide/case4/initial/glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions cmd/dep/testdata/harness_tests/init/glide/case4/initial/glide.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package: github.com/wondernetwork/go-wiu-backend
import:
- package: github.com/mikespook/gearman-go
version: master
subpackages:
- worker
- package: gopkg.in/mgo.v2
version: v2
subpackages:
- bson
- package: github.com/DataDog/datadog-go
version: ~1.1
subpackages:
- statsd
14 changes: 14 additions & 0 deletions cmd/dep/testdata/harness_tests/init/glide/case4/initial/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
_ "github.com/DataDog/datadog-go/statsd"
_ "github.com/mikespook/gearman-go/worker"
_ "gopkg.in/mgo.v2/bson"
)

func main() {
}
17 changes: 17 additions & 0 deletions cmd/dep/testdata/harness_tests/init/glide/case4/testcase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"commands": [
["init", "-no-examples"]
],
"error-expected": "",
"gopath-initial": {},
"vendor-final": [
"github.com/DataDog/datadog-go",
"github.com/mikespook/gearman-go",
"gopkg.in/mgo.v2/bson",
"gopkg.in/mgo.v2/dbtest",
"gopkg.in/mgo.v2/internal",
"gopkg.in/mgo.v2/testdb",
"gopkg.in/mgo.v2/testserver",
"gopkg.in/mgo.v2/txn"
]
}

0 comments on commit f2d0d8c

Please sign in to comment.