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

Commit f2d0d8c

Browse files
committed
Test glide import for branch with semver name
1 parent 3de8976 commit f2d0d8c

File tree

13 files changed

+156
-13
lines changed

13 files changed

+156
-13
lines changed

cmd/dep/glide_importer_test.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ func TestGlideConfig_Import(t *testing.T) {
4444
defer sm.Release()
4545

4646
h.TempDir(filepath.Join("src", testGlideProjectRoot))
47-
h.TempCopy(filepath.Join(testGlideProjectRoot, glideYamlName), "glide/glide.yaml")
48-
h.TempCopy(filepath.Join(testGlideProjectRoot, glideLockName), "glide/glide.lock")
47+
h.TempCopy(filepath.Join(testGlideProjectRoot, glideYamlName), "glide/glide0.yaml")
48+
h.TempCopy(filepath.Join(testGlideProjectRoot, glideLockName), "glide/glide0.lock")
4949
projectRoot := h.Path(testGlideProjectRoot)
5050

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

71-
goldenFile := "glide/expected_import_output.txt"
71+
goldenFile := "glide/golden0.txt"
7272
got := verboseOutput.String()
7373
want := h.GetTestFileString(goldenFile)
7474
if want != got {
@@ -82,7 +82,7 @@ func TestGlideConfig_Import(t *testing.T) {
8282
}
8383
}
8484

85-
func TestGlideConfig_Import2(t *testing.T) {
85+
func TestGlideConfig_Import_BranchWithSemverName(t *testing.T) {
8686
h := test.NewHelper(t)
8787
defer h.Cleanup()
8888

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

9494
h.TempDir(filepath.Join("src", testGlideProjectRoot))
95-
h.TempCopy(filepath.Join(testGlideProjectRoot, glideYamlName), "glide/foo/glide.yaml")
96-
h.TempCopy(filepath.Join(testGlideProjectRoot, glideLockName), "glide/foo/glide.lock")
95+
h.TempCopy(filepath.Join(testGlideProjectRoot, glideYamlName), "glide/glide1.yaml")
96+
h.TempCopy(filepath.Join(testGlideProjectRoot, glideLockName), "glide/glide1.lock")
9797
projectRoot := h.Path(testGlideProjectRoot)
9898

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

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

141-
h.TempDir(filepath.Join("src", "glidetest"))
142-
h.TempCopy(filepath.Join("glidetest", glideYamlName), "glide/glide.yaml")
143-
projectRoot := h.Path("glidetest")
141+
h.TempDir(filepath.Join("src", testGlideProjectRoot))
142+
h.TempCopy(filepath.Join(testGlideProjectRoot, glideYamlName), "glide/glide0.yaml")
143+
projectRoot := h.Path(testGlideProjectRoot)
144144

145145
g := newGlideImporter(ctx.Err, true, sm)
146146
if !g.HasDepMetadata(projectRoot) {
File renamed without changes.
File renamed without changes.

cmd/dep/testdata/glide/glide1.lock

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
hash: 3b7d5be7d68cd94765ac91ea2f58b554151f67f5d0bf499ea8cadb600538a0e5
2+
updated: 2017-05-03T15:13:27.629768623+02:00
3+
imports:
4+
- name: github.com/DataDog/datadog-go
5+
version: 0ddda6bee21174ef6c4873647cb0d6ec9cba996f
6+
subpackages:
7+
- statsd
8+
- name: github.com/mikespook/gearman-go
9+
version: b79fee29655dcdce7ba4a738f8388f9862b6779e
10+
subpackages:
11+
- worker
12+
- name: gopkg.in/mgo.v2
13+
version: 29cc868a5ca65f401ff318143f9408d02f4799cc
14+
subpackages:
15+
- bson
16+
- internal/sasl
17+
- internal/scram
18+
devImports: []

cmd/dep/testdata/glide/glide1.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package: github.com/wondernetwork/go-wiu-backend
2+
import:
3+
- package: github.com/mikespook/gearman-go
4+
version: master
5+
subpackages:
6+
- worker
7+
- package: gopkg.in/mgo.v2
8+
version: v2
9+
subpackages:
10+
- bson
11+
- package: github.com/DataDog/datadog-go
12+
version: ~1.1
13+
subpackages:
14+
- statsd
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
Detected glide configuration files...
22
Converting from glide.yaml and glide.lock...
3-
Using ^0.8.1 as initial constraint for imported dep github.com/sdboyer/deptest
4-
Trying v0.8.1 (3f4c3be) as initial lock for imported dep github.com/sdboyer/deptest
3+
Using master as initial constraint for imported dep github.com/sdboyer/deptest
54
Using ^2.0.0 as initial constraint for imported dep github.com/sdboyer/deptestdos
5+
Using master as initial constraint for imported dep github.com/golang/lint
6+
Trying v0.8.1 (3f4c3be) as initial lock for imported dep github.com/sdboyer/deptest
67
Trying v2.0.0 (5c60720) as initial lock for imported dep github.com/sdboyer/deptestdos
7-
Using cb00e56 as initial hint for imported dep github.com/golang/lint
8+
Trying master (cb00e56) as initial lock for imported dep github.com/golang/lint

cmd/dep/testdata/glide/golden1.txt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Detected glide configuration files...
2+
Converting from glide.yaml and glide.lock...
3+
Using master as initial constraint for imported dep github.com/mikespook/gearman-go
4+
Using v2 as initial constraint for imported dep gopkg.in/mgo.v2
5+
Using ~1.1.0 as initial constraint for imported dep github.com/DataDog/datadog-go
6+
Trying 1.1.0 (0ddda6b) as initial lock for imported dep github.com/DataDog/datadog-go
7+
Trying master (b79fee2) as initial lock for imported dep github.com/mikespook/gearman-go
8+
Trying v2 (29cc868) as initial lock for imported dep gopkg.in/mgo.v2

cmd/dep/testdata/harness_tests/init/glide/case4/final/Gopkg.lock

+27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
[[constraint]]
3+
name = "github.com/DataDog/datadog-go"
4+
version = "1.1.0"
5+
6+
[[constraint]]
7+
name = "github.com/mikespook/gearman-go"
8+
version = "0.1.3"
9+
10+
[[constraint]]
11+
branch = "v2"
12+
name = "gopkg.in/mgo.v2"

cmd/dep/testdata/harness_tests/init/glide/case4/initial/glide.lock

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package: github.com/wondernetwork/go-wiu-backend
2+
import:
3+
- package: github.com/mikespook/gearman-go
4+
version: master
5+
subpackages:
6+
- worker
7+
- package: gopkg.in/mgo.v2
8+
version: v2
9+
subpackages:
10+
- bson
11+
- package: github.com/DataDog/datadog-go
12+
version: ~1.1
13+
subpackages:
14+
- statsd
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2017 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package main
6+
7+
import (
8+
_ "github.com/DataDog/datadog-go/statsd"
9+
_ "github.com/mikespook/gearman-go/worker"
10+
_ "gopkg.in/mgo.v2/bson"
11+
)
12+
13+
func main() {
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"commands": [
3+
["init", "-no-examples"]
4+
],
5+
"error-expected": "",
6+
"gopath-initial": {},
7+
"vendor-final": [
8+
"github.com/DataDog/datadog-go",
9+
"github.com/mikespook/gearman-go",
10+
"gopkg.in/mgo.v2/bson",
11+
"gopkg.in/mgo.v2/dbtest",
12+
"gopkg.in/mgo.v2/internal",
13+
"gopkg.in/mgo.v2/testdb",
14+
"gopkg.in/mgo.v2/testserver",
15+
"gopkg.in/mgo.v2/txn"
16+
]
17+
}

0 commit comments

Comments
 (0)